Skip to content

Documentation / example for "safely" accessible flash #1145

Answered by chris-durand
hshose asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a good way to find a safe starting page automatically?

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 the FLASH 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 declare extern "C" const uint32_t __rom_end[];.…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@hshose
Comment options

@salkinium
Comment options

@hshose
Comment options

Answer selected by hshose
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1144 on March 11, 2024 22:18.