Here is an easy way to store and use configuration data in the flash memory of a microcontroller.
This places the configuration data at a specific absolute memory address and uses no special pragmas to enable read access.
This is a slight reworking and consolidation of what MCU on Eclipse suggests, and slightly easier than marking variables with __attribute__((section(".etwas")))
all the time, though that is useful in other cases. Also, the SEGGER J-Link debugger on my development kit was always erasing the configuration data (as I’d placed it between other code and data, at a pretty low flash address), which was the opposite of the problem MCU on Eclipse was having. So, I needed a way to protect specific flash regions from getting erased, as Kinetis Design Studio has no easy options for this.
Continue reading Flash-based Configuration Data Using The ld Linker