Merge branch 'sysparam'

This commit is contained in:
luisbebop 2016-06-05 15:38:13 -03:00
commit 7b2319d9b1
6 changed files with 1728 additions and 0 deletions

View file

@ -26,6 +26,7 @@
#include "espressif/esp_common.h"
#include "espressif/phy_info.h"
#include "sdk_internal.h"
#include "sysparam.h"
/* This is not declared in any header file (but arguably should be) */
@ -139,6 +140,8 @@ void IRAM sdk_user_start(void) {
uint32_t cksum_len;
uint32_t cksum_value;
uint32_t ic_flash_addr;
uint32_t sysparam_addr;
sysparam_status_t status;
SPI(0).USER0 |= SPI_USER0_CS_SETUP;
sdk_SPIRead(0, buf32, 4);
@ -204,6 +207,20 @@ void IRAM sdk_user_start(void) {
}
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
// top of the flash space
sysparam_addr = flash_size - (4 + DEFAULT_SYSPARAM_SECTORS) * sdk_flashchip.sector_size;
status = sysparam_init(sysparam_addr, flash_size);
if (status == SYSPARAM_NOTFOUND) {
status = sysparam_create_area(sysparam_addr, DEFAULT_SYSPARAM_SECTORS, false);
if (status == SYSPARAM_OK) {
status = sysparam_init(sysparam_addr, 0);
}
}
if (status != SYSPARAM_OK) {
printf("WARNING: Could not initialize sysparams (%d)!\n", status);
}
user_start_phase2();
}