Thank you! So I've proceeded with this:
Ugly, but it works. In my case magic_page is placed at 0x10012000, so is definitely in flash and aligned to a flash sector. My code is able to read and erase/write the page without issue. As a side benefit detecting first run is now trivial, as all I need to do is dereference the pointer; before, I was reading the end of the flash binary and rounding up to the sector size.
I'm satisfied but if there is an even better way to do this, I'm all ears...
Code:
uint8_t __in_flash() magic_sector[FLASH_SECTOR_SIZE] __attribute__((aligned(FLASH_SECTOR_SIZE))) = {[0 ... FLASH_SECTOR_SIZE-1] = 0xFF};
I'm satisfied but if there is an even better way to do this, I'm all ears...
Statistics: Posted by canyondotmid — Tue Oct 29, 2024 4:06 am