diff --git a/Sming/Components/Storage/ota-migration.rst b/Sming/Components/Storage/ota-migration.rst index bcd3044997..ec94caa351 100644 --- a/Sming/Components/Storage/ota-migration.rst +++ b/Sming/Components/Storage/ota-migration.rst @@ -33,6 +33,8 @@ Add this to your application:: { // Note: This file won't exist on initial build! IMPORT_FSTR(partitionTableData, PROJECT_DIR "/out/Esp8266/debug/firmware/partitions.bin") + // Current bootloader is partition-aware + IMPORT_FSTR(rbootData, PROJECT_DIR "/out/Esp8266/debug/firmware/rboot.bin") } extern "C" void __wrap_user_pre_init(void) @@ -45,6 +47,11 @@ Add this to your application:: flash.erase_range(PARTITION_TABLE_OFFSET, flash.getBlockSize()); flash.write(PARTITION_TABLE_OFFSET, data, partitionTableData.size()); flash.loadPartitions(PARTITION_TABLE_OFFSET); + + // For consistency update bootloader as well + LOAD_FSTR(data, rbootData) + flash.erase_range(0, flash.getBlockSize()); + flash.write(0, data, rbootData.size()); } extern void __real_user_pre_init(void); @@ -77,7 +84,7 @@ An alternative method is to build the partition table layout in code, so there a using FullType = Storage::Partition::FullType; using SubType = Storage::Partition::SubType; #define PT_ENTRY(name, fulltype, offset, size) \ - { ESP_PARTITION_MAGIC, FullType(fulltype).type, FullType(fulltype).subtype, offset, size, name, 0 } + { Storage::ESP_PARTITION_MAGIC, FullType(fulltype).type, FullType(fulltype).subtype, offset, size, name, 0 } static constexpr Storage::esp_partition_info_t partitionTableData[] PROGMEM{ PT_ENTRY("spiFlash", Storage::Device::Type::flash, 0, 0x400000),