Merge pull request #1411 from MaBecker/wifi

rearange rf_cal_sector (fix #1294)
This commit is contained in:
Gordon Williams 2018-05-10 17:19:30 +01:00 committed by GitHub
commit 240984bf8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 17 deletions

View File

@ -44,10 +44,10 @@ chip = {
'adc' : 1,
'dac' : 0,
'saved_code' : {
'address' : 0x78000,
'address' : 0x77000,
'page_size' : 4096,
'pages' : 4,
'flash_available' : 472, # firmware can be up to this size
'flash_available' : 468, # firmware can be up to this size
},
};
devices = {

View File

@ -870,7 +870,6 @@ void jswrap_wifi_restore(void) {
JsVar *o = jswrap_storage_readJSON(name);
if (!o) { // no data
jsvUnLock2(name,o);
jsWarn("NO DATA\n");
return;
}

View File

@ -42,7 +42,7 @@ ET_FF ?= 80m # 80Mhz flash speed in esptool flash command
ET_BLANK ?= 0xFE000 # where to flash blank.bin
ET_DEFAULTS ?= 0xFC000 # where to flash esp_init_data_default.bin to default SDK settings
else # 512KB
ESP_FLASH_MAX ?= 483328 # max bin file: 472KB
ESP_FLASH_MAX ?= 479232 # max bin file: 468KB
ESP_FLASH_SIZE ?= 0 # 0->512KB
ESP_FLASH_MODE ?= 0 # 0->QIO
ESP_FLASH_FREQ_DIV ?= 0 # 0->40Mhz

View File

@ -1356,7 +1356,7 @@ JsVar *jshFlashGetFree() {
addFlashArea(jsFreeFlash, 0x300000, 0x40000);
addFlashArea(jsFreeFlash, 0x340000, 0x40000);
addFlashArea(jsFreeFlash, 0x380000, 0x40000);
addFlashArea(jsFreeFlash, 0x3C0000, 0x40000);
addFlashArea(jsFreeFlash, 0x3C0000, 0x40000-0x5000);
return jsFreeFlash;
}
@ -1370,10 +1370,10 @@ JsVar *jshFlashGetFree() {
addFlashArea(jsFreeFlash, 0xf7000, 0x5000);
}
if (espFlashKB == 2048) {
addFlashArea(jsFreeFlash, 0x100000, 0x100000-0x4000);
addFlashArea(jsFreeFlash, 0x100000, 0x100000-0x5000);
}
if (espFlashKB == 4096) {
addFlashArea(jsFreeFlash, 0x100000, 0x300000-0x4000);
addFlashArea(jsFreeFlash, 0x100000, 0x300000-0x5000);
}
}

View File

@ -306,18 +306,35 @@ void user_rf_pre_init() {
/**
* user_rf_cal_sector_set is a required function that is called by the SDK to get a flash
* sector number where it can store RF calibration data. This was introduced with SDK 1.5.4.1
* and is necessary because Espressif ran out of pre-reserved flash sectors. Ooops...
*/
uint32
user_rf_cal_sector_set(void) {
uint32_t sect = 0;
*
* sector map for last 5 sectors for flash: ABCCC
* A : rf cal
* B : rf init data
* C : sdk parameters
*/
uint32 user_rf_cal_sector_set(void) {
uint32_t rf_cal_sec = 0;
switch (system_get_flash_size_map()) {
case FLASH_SIZE_4M_MAP_256_256: // 512KB
sect = 128 - 10; // 0x76000
default:
sect = 128; // 0x80000
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;
default:
rf_cal_sec = 0;
break;
}
return sect;
return rf_cal_sec;
}
/**