If you're just experimenting, accessing the address via .map is fine.
But for production firmware, we would recommend to:
- Define the region in the scatter file.
- Use symbols for start/end (more portable and safer):
extern const uint8_t __start_myKnowledge__;
extern const uint8_t __end_myKnowledge__;
Then compute size at runtime:
size_t size = &__end_myKnowledge__ - &__start_myKnowledge__;
The risks of not using the Scatter File are:
1.Uncontrolled Placement
- Flash address may vary between builds
- No reserved space for future growth
- Can’t easily exclude from CRC or secure checks
2.Optimization & Linker Shifts
- Section may be optimized out if unused
- Address may shift with minor code changes
3.Risk of Overlap
- Other sections (e.g., .text) can grow into .neai, causing corruption
4.Upgrade & Maintenance Issues
- Inconsistent location complicates backups, OTA updates, and version management
So it depends on what you are doing.
Have a good day,
Julian