diff --git a/Sming/Arch/Esp8266/Components/esp8266/startup.cpp b/Sming/Arch/Esp8266/Components/esp8266/startup.cpp index ef6d1d07d3..ff62f084d2 100644 --- a/Sming/Arch/Esp8266/Components/esp8266/startup.cpp +++ b/Sming/Arch/Esp8266/Components/esp8266/startup.cpp @@ -55,9 +55,8 @@ extern "C" void WEAK_ATTR user_rf_pre_init(void) extern "C" uint32 ICACHE_FLASH_ATTR WEAK_ATTR user_rf_cal_sector_set(void) { - // RF calibration stored in last sector of sysParam - auto sysParam = *Storage::findPartition(Storage::Partition::SubType::Data::sysParam); - return ((sysParam.address() + sysParam.size()) / SPI_FLASH_SEC_SIZE) - 1; + auto rfCal = *Storage::findPartition(Storage::Partition::SubType::Data::rfCal); + return rfCal.address(); } #ifdef SDK_INTERNAL @@ -71,16 +70,14 @@ extern "C" void ICACHE_FLASH_ATTR WEAK_ATTR user_pre_init(void) Storage::initialize(); auto sysParam = *Storage::findPartition(Storage::Partition::SubType::Data::sysParam); + auto rfCal = *Storage::findPartition(Storage::Partition::SubType::Data::rfCal); auto phy = *Storage::findPartition(Storage::Partition::SubType::Data::phy); - // RF calibration stored in last sector of sysParam - auto sysParamSize = sysParam.size() - SPI_FLASH_SEC_SIZE; - static const partition_item_t partitions[] = { {SYSTEM_PARTITION_BOOTLOADER, 0, SPI_FLASH_SEC_SIZE}, {SYSTEM_PARTITION_PHY_DATA, phy.address(), phy.size()}, - {SYSTEM_PARTITION_SYSTEM_PARAMETER, sysParam.address(), sysParamSize}, - {SYSTEM_PARTITION_RF_CAL, sysParam.address() + sysParamSize, SPI_FLASH_SEC_SIZE}, + {SYSTEM_PARTITION_SYSTEM_PARAMETER, sysParam.address(), sysParam.size()}, + {SYSTEM_PARTITION_RF_CAL, rfCal.address(), rfCal.size()}, }; enum flash_size_map sizeMap = system_get_flash_size_map(); diff --git a/Sming/Arch/Esp8266/legacy/standard-4m.hw b/Sming/Arch/Esp8266/legacy/standard-4m.hw index 72bbcf0ca8..8e6404321a 100644 --- a/Sming/Arch/Esp8266/legacy/standard-4m.hw +++ b/Sming/Arch/Esp8266/legacy/standard-4m.hw @@ -1,17 +1,20 @@ { "name": "Standard config with 4M flash (LEGACY)", "base_config": "standard-4m", - "partition_table_offset": "0x100000", + "partition_table_offset": "0x3FA000", "partitions": { "rom0": { "address": "0x2000", "size": "1016K" }, - "phy_init": { + "rf_cal": { "address": "0x3FB000" }, - "sys_param": { + "phy_init": { "address": "0x3FC000" + }, + "sys_param": { + "address": "0x3FD000" } } } diff --git a/Sming/Arch/Esp8266/legacy/standard.hw b/Sming/Arch/Esp8266/legacy/standard.hw index cc1849e1af..3493cbf0ae 100644 --- a/Sming/Arch/Esp8266/legacy/standard.hw +++ b/Sming/Arch/Esp8266/legacy/standard.hw @@ -7,11 +7,14 @@ "address": "0x2000", "size": "0x0F8000" }, - "phy_init": { + "rf_cal": { "address": "0x0FB000" }, - "sys_param": { + "phy_init": { "address": "0x0FC000" + }, + "sys_param": { + "address": "0x0FD000" } } } diff --git a/Sming/Arch/Esp8266/legacy/two-rom-mode.hw b/Sming/Arch/Esp8266/legacy/two-rom-mode.hw index 23917d7bdf..312e6bd874 100644 --- a/Sming/Arch/Esp8266/legacy/two-rom-mode.hw +++ b/Sming/Arch/Esp8266/legacy/two-rom-mode.hw @@ -1,21 +1,18 @@ { "name": "Two ROM slots in 1MB of flash (LEGACY)", - "base_config": "two-rom-mode", - "partition_table_offset": "0x0FA000", + "base_config": "legacy/standard", "partitions": { "rom0": { + "subtype": "ota_0", "address": "0x2000", "size": "504K" }, "rom1": { "address": "0x80000", - "size": "488K" - }, - "phy_init": { - "address": "0x0FB000" - }, - "sys_param": { - "address": "0x0FC000" + "size": "488K", + "type": "app", + "subtype": "ota_1", + "filename": "$(RBOOT_ROM_1_BIN)" } } } diff --git a/Sming/Arch/Esp8266/standard.hw b/Sming/Arch/Esp8266/standard.hw index 240e56f679..2ef77eee71 100644 --- a/Sming/Arch/Esp8266/standard.hw +++ b/Sming/Arch/Esp8266/standard.hw @@ -21,10 +21,16 @@ }, "sys_param": { "address": "0x004000", - "size": "16K", + "size": "12K", "type": "data", "subtype": "sysparam" }, + "rf_cal": { + "address": "0x007000", + "size": "4K", + "type": "data", + "subtype": "rfcal" + }, "rom0": { "address": "0x008000", "size": "992K", diff --git a/Sming/Components/Storage/Tools/hwconfig/partition.py b/Sming/Components/Storage/Tools/hwconfig/partition.py index 73d9bbf97f..5b7646134c 100644 --- a/Sming/Components/Storage/Tools/hwconfig/partition.py +++ b/Sming/Components/Storage/Tools/hwconfig/partition.py @@ -85,6 +85,7 @@ "nvs_keys": 0x04, "efuse": 0x05, "sysparam": 0x40, + "rfcal": 0x41, "esphttpd": 0x80, "fat": 0x81, "spiffs": 0x82, diff --git a/Sming/Components/Storage/src/include/Storage/Partition.h b/Sming/Components/Storage/src/include/Storage/Partition.h index 0c141abad0..9b5badeee1 100644 --- a/Sming/Components/Storage/src/include/Storage/Partition.h +++ b/Sming/Components/Storage/src/include/Storage/Partition.h @@ -59,6 +59,7 @@ XX(nvsKeys, 0x04, "NVS key information") \ XX(eFuseEm, 0x05, "eFuse emulation") \ XX(sysParam, 0x40, "System Parameters") \ + XX(rfCal, 0x41, "RF Calibration") \ XX(espHttpd, 0x80, "ESPHTTPD") \ XX(fat, 0x81, "FAT") \ XX(spiffs, 0x82, "SPIFFS") \