Closed AloyseTech closed 8 years ago
The reserved bytes are the bootloader itself:
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}
We use the first 8KB of flash to store the bootloader, BTW the bootloader is about 6KB long so the last piece of this flash area may be used to pass data to the bootloader, you can use the methods:
void write(const volatile void *flash_ptr, const void *data, uint32_t size);
void erase(const volatile void *flash_ptr, uint32_t size);
to write your data on the address 0x1F00 (remember that flash memory is erased in "pages" of 256 bytes, so you should use the page from 0x00001F00 to 0x00001FFF). Remember also that flash memory has a low number of write-cycles, if you are going to write often your data is probably better to find an alternative solution.
Hi,
In the Zero linker script, there are some bytes reserved between the bootloader space and application space. Is it possible to use your code to store data there, and retrieve it in the bootloader? (I think it's the initial utility of those reserved bytes)