From 1009984a81bc84d2121483ab2ae4d2820b9f59de Mon Sep 17 00:00:00 2001 From: mikee47 Date: Tue, 7 Jan 2025 11:58:52 +0000 Subject: [PATCH 1/4] Support setting size=0 to drop partition from config Note: Not an error if partition undefined. --- Sming/Components/Storage/README.rst | 6 ++++++ Sming/Components/Storage/Tools/hwconfig/partition.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/Sming/Components/Storage/README.rst b/Sming/Components/Storage/README.rst index 9a08f5e44b..4d3d7eb6ed 100644 --- a/Sming/Components/Storage/README.rst +++ b/Sming/Components/Storage/README.rst @@ -133,12 +133,18 @@ To customise the hardware configuration for a project, for example 'my_project': "rom0": { "address": "0x10000", "size": "0x80000" + }, + "factory": { + "size": 0 } } } This will adjust flash parameters (previously via SPI_SPEED, SPI_MODE and SPI_SIZE), and the location/size of the primary application partition. + The **factory** partition is also dropped by setting its size to 0. + This is ignored if no such partition is defined. + 3. Add any additional partitions: diff --git a/Sming/Components/Storage/Tools/hwconfig/partition.py b/Sming/Components/Storage/Tools/hwconfig/partition.py index f7b5e312a0..a43edd640a 100644 --- a/Sming/Components/Storage/Tools/hwconfig/partition.py +++ b/Sming/Components/Storage/Tools/hwconfig/partition.py @@ -143,6 +143,11 @@ def parse_dict(self, data, devices): raise InputError("Duplicate partition '%s'" % name) partnames += name part = self.find_by_name(name) + # Setting size=0 drops partition if it exists + if entry.get('size') == 0: + if part: + self.remove(part) + continue if part is None: part = Entry(devices[0], name) self.append(part) From f4f1d963058b469f66d6cfff54d5f8b5ec8c4922 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Tue, 7 Jan 2025 11:59:23 +0000 Subject: [PATCH 2/4] Drop `factory` partition from Esp32 `spiffs-two-roms` --- Sming/Arch/Esp32/spiffs-two-roms.hw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Arch/Esp32/spiffs-two-roms.hw b/Sming/Arch/Esp32/spiffs-two-roms.hw index 0d7f3d35ea..07a59451e3 100644 --- a/Sming/Arch/Esp32/spiffs-two-roms.hw +++ b/Sming/Arch/Esp32/spiffs-two-roms.hw @@ -3,7 +3,7 @@ "base_config": "spiffs", "partitions": { "factory": { - "size": "1M" + "size": 0 }, "rom0": { "address": "0x110000", From 29f116275332aaaed117593996551446465be2f5 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Tue, 7 Jan 2025 12:03:29 +0000 Subject: [PATCH 3/4] Remove redundant hardware config overrides spiffs-two-roms already defines both ROM slots as OTA. --- .../OtaUpgradeMqtt/samples/Upgrade/component.mk | 2 +- Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/ota.hw | 11 ----------- samples/Basic_Ota/ota.hw | 6 ------ 3 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/ota.hw diff --git a/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/component.mk b/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/component.mk index b396b06b89..c6bf59b987 100644 --- a/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/component.mk +++ b/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/component.mk @@ -49,7 +49,7 @@ COMPONENT_DEPENDS := OtaUpgradeMqtt RBOOT_ENABLED := 1 ## Use standard hardware config with two ROM slots and two SPIFFS partitions -HWCONFIG := ota +HWCONFIG := spiffs-two-roms APP_CFLAGS = -DMQTT_URL="\"$(MQTT_URL)"\" \ -DMQTT_FINGERPRINT_SHA1=$(MQTT_FINGERPRINT_SHA1) \ diff --git a/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/ota.hw b/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/ota.hw deleted file mode 100644 index c5d71daa72..0000000000 --- a/Sming/Libraries/OtaUpgradeMqtt/samples/Upgrade/ota.hw +++ /dev/null @@ -1,11 +0,0 @@ -{ - "base_config": "spiffs-two-roms", - "partitions": { - "rom0": { - "subtype": "ota_0" - }, - "rom1": { - "subtype": "ota_1" - } - } -} \ No newline at end of file diff --git a/samples/Basic_Ota/ota.hw b/samples/Basic_Ota/ota.hw index ed59f038c9..c9f0e9307e 100644 --- a/samples/Basic_Ota/ota.hw +++ b/samples/Basic_Ota/ota.hw @@ -2,12 +2,6 @@ "name": "Basic OTA sample", "base_config": "spiffs-two-roms", "partitions": { - "rom0": { - "subtype": "ota_0" - }, - "rom1": { - "subtype": "ota_1" - }, "spiffs0": { "size": "512K" }, From 16666246f8ae57bb5611012383876b174c407645 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Thu, 9 Jan 2025 09:31:47 +0000 Subject: [PATCH 4/4] Revert "Drop `factory` partition from Esp32 `spiffs-two-roms`" This reverts commit f4f1d963058b469f66d6cfff54d5f8b5ec8c4922. --- Sming/Arch/Esp32/spiffs-two-roms.hw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sming/Arch/Esp32/spiffs-two-roms.hw b/Sming/Arch/Esp32/spiffs-two-roms.hw index 07a59451e3..0d7f3d35ea 100644 --- a/Sming/Arch/Esp32/spiffs-two-roms.hw +++ b/Sming/Arch/Esp32/spiffs-two-roms.hw @@ -3,7 +3,7 @@ "base_config": "spiffs", "partitions": { "factory": { - "size": 0 + "size": "1M" }, "rom0": { "address": "0x110000",