-->
Page 2 of 2

Re: Where in the flash map can I safely store configuration

PostPosted: Fri Dec 02, 2016 12:54 pm
by RexBrown
Just for reference to others that may be browsing this post I am replying with the results of what I did.
1) I am using the ESP12 E (similar to the module on the HUZZAH Feather)
2) I have set my IDE to use the 4M (1M SPIFFS)
3) I am accessing the Sector at the 1 Meg offset in the FLASH (sector 256) ( location referenced by
martinayotte as 4030 0000 address) which I access using the funcions:
int32_t result = spi_flash_read(CONFIG_ADDRESS ,(uint32 *)(&flashData[0]),(uint32_t)size );
result = spi_flash_erase_sector(CONFIG_SECTOR);
and
result = spi_flash_write((uint32 )CONFIG_ADDRESS ,(uint32 *)(&flashData[0]), (uint32_t)size);
where CONFIG_SECTOR for me is 256 and CONFIG_ADDRESS is 256 * 4096.
4) This works for me and the FLASH does not get corrupted after an update. My binary files fit below the 512K
boundary but based on the comments from martinayotte I expect the update would work on files up to 1M.
For completeness it should be understood that the CONFIG_ADDRESS should always be on a 4 byte boundary.