Skip to content

Commit

Permalink
Update documentation to include updating boot sector during migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Mar 12, 2024
1 parent db6010d commit 594ed48
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sming/Components/Storage/ota-migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 594ed48

Please sign in to comment.