(1) The 0 sector
(2) The last 4 sectors - on a 4MB board, this will be sectors 1020-1023.
When using a native, NonOS we need to expose something like this
Code: Select all
uint32 ICACHE_FLASH_ATTR user_rf_cal_sector_set(void)
{
enum flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
rf_cal_sec = 128 - 5;
break;
case FLASH_SIZE_8M_MAP_512_512:
rf_cal_sec = 256 - 5;
break;
case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal_sec = 512 - 5;
break;
case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
rf_cal_sec = 1024 - 5;
break;
case FLASH_SIZE_64M_MAP_1024_1024:
rf_cal_sec = 2048 - 5;
break;
case FLASH_SIZE_128M_MAP_1024_1024:
rf_cal_sec = 4096 - 5;
break;
default:
rf_cal_sec = 0;
break;
}
return rf_cal_sec;
}
Where it clearly puts rf cal stuff in sector -5 (the 5th sector from the end). Looking into the Arduino code base, Arduino appears to put it in sector -4 and use sector -5 for simulating the EEPROM.
Code: Select all
uint32_t user_rf_cal_sector_set(void)
{
spoof_init_data = true;
return flashchip->chip_size/SPI_FLASH_SEC_SIZE - 4;
}
When I tried to use sector -4 in NonOS, I get continuous reboots. My questions are...
- What is user_rf_cal_sector_set() sector contain / used for?
- Why is it variable for us developers to place in the flash?
- Since its required why is it not just part of the 4 end sectors already reserved? They are sparsely used and seem like they could easily hold the data placed in this user_rf_cal_sector_set sector.
- Arduino seems to use this, but puts it in a place where it is reserved by Espressif.
- Where is the Arduino version putting it so it can use sector -5 for EEPROM?
Thanks.