Documentation / example for "safely" accessible flash #1145
-
I want to use the STM32G474's flash to save some data, that I calculate in my application, similar to the G474 flash example. The example starts using the Flash from page 32 on, which is safe since the example is only a few bytes large. Is there a good way to find a safe starting page automatically? One way would probably be, to reduce the Am I missing something obvious? 😕 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
In many applications you wouldn't want that. If you like to upgrade the device with a larger binary without overwriting the present data in flash, the data section will have to be placed at a fixed location that can't overlap with the code. If you know how much space is needed for data you could reserve some pages at the end of flash. In the custom linker script you can reduce the In case you don't need data to be persistent across updates the end of your binary is accessible via the symbol |
Beta Was this translation helpful? Give feedback.
-
Yes, |
Beta Was this translation helpful? Give feedback.
In many applications you wouldn't want that. If you like to upgrade the device with a larger binary without overwriting the present data in flash, the data section will have to be placed at a fixed location that can't overlap with the code.
If you know how much space is needed for data you could reserve some pages at the end of flash. In the custom linker script you can reduce the
LENGTH
of theFLASH
section by that amount.In case you don't need data to be persistent across updates the end of your binary is accessible via the symbol
__rom_end
defined in the linker script. Just declareextern "C" const uint32_t __rom_end[];
.…