sysparam: reserve one more flash sector before placing the sysparams

This is to help work with recent SDKs that add a RF cal sector by
default in the fifth last sector - just so the sysparam sectors do not
jump around when using different SDK versions.
This commit is contained in:
Our Air Quality 2017-08-01 09:16:12 +10:00
parent 42ccb47eb3
commit ec5dabd237
3 changed files with 7 additions and 5 deletions

View file

@ -214,8 +214,8 @@ void IRAM sdk_user_start(void) {
memcpy(&sdk_g_ic.s, buf32, sizeof(struct sdk_g_ic_saved_st)); memcpy(&sdk_g_ic.s, buf32, sizeof(struct sdk_g_ic_saved_st));
// By default, put the sysparam region just below the config sectors at the // By default, put the sysparam region just below the config sectors at the
// top of the flash space // top of the flash space, and allowing one extra sector spare.
sysparam_addr = flash_size - (4 + DEFAULT_SYSPARAM_SECTORS) * sdk_flashchip.sector_size; sysparam_addr = flash_size - (5 + DEFAULT_SYSPARAM_SECTORS) * sdk_flashchip.sector_size;
status = sysparam_init(sysparam_addr, flash_size); status = sysparam_init(sysparam_addr, flash_size);
if (status == SYSPARAM_NOTFOUND) { if (status == SYSPARAM_NOTFOUND) {
status = sysparam_create_area(sysparam_addr, DEFAULT_SYSPARAM_SECTORS, false); status = sysparam_create_area(sysparam_addr, DEFAULT_SYSPARAM_SECTORS, false);

View file

@ -8,7 +8,7 @@ include ../../common.mk
# `make dump-flash` can be used to view the current contents of the sysparam # `make dump-flash` can be used to view the current contents of the sysparam
# regions in flash. # regions in flash.
dump-flash: dump-flash:
esptool.py read_flash 0x1f8000 8192 r1.bin esptool.py read_flash 0x1f7000 8192 r1.bin
hexdump -C r1.bin hexdump -C r1.bin
esptool.py read_flash 0x1fa000 8192 r2.bin esptool.py read_flash 0x1f9000 8192 r2.bin
hexdump -C r2.bin hexdump -C r2.bin

View file

@ -173,7 +173,7 @@ void sysparam_editor_task(void *pvParameters) {
// stuff, so if the user uses this utility to reformat it, it will put // stuff, so if the user uses this utility to reformat it, it will put
// it somewhere the system will find it later // it somewhere the system will find it later
num_sectors = DEFAULT_SYSPARAM_SECTORS; num_sectors = DEFAULT_SYSPARAM_SECTORS;
base_addr = sdk_flashchip.chip_size - (4 + num_sectors) * sdk_flashchip.sector_size; base_addr = sdk_flashchip.chip_size - (5 + num_sectors) * sdk_flashchip.sector_size;
} }
while (true) { while (true) {
printf("==> "); printf("==> ");
@ -246,5 +246,7 @@ void user_init(void)
{ {
uart_set_baud(0, 115200); uart_set_baud(0, 115200);
sdk_wifi_set_opmode(NULL_MODE);
xTaskCreate(sysparam_editor_task, "sysparam_editor_task", 512, NULL, 2, NULL); xTaskCreate(sysparam_editor_task, "sysparam_editor_task", 512, NULL, 2, NULL);
} }