From 4c7e00630b1093e77a2070d0c364fe8d46860735 Mon Sep 17 00:00:00 2001 From: Terrence Date: Wed, 26 Mar 2025 23:07:47 +0800 Subject: [PATCH] fix sensecap watcher partition alignment --- partitions_32M_sensecap.csv | 7 ++++--- scripts/versions.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/partitions_32M_sensecap.csv b/partitions_32M_sensecap.csv index 33be2eb4..e95eb22f 100644 --- a/partitions_32M_sensecap.csv +++ b/partitions_32M_sensecap.csv @@ -4,6 +4,7 @@ nvsfactory, data, nvs, , 200K, nvs, data, nvs, , 840K, otadata, data, ota, , 0x2000, phy_init, data, phy, , 0x1000, -model, data, spiffs, , 1024K, -ota_0, app, ota_0, , 12M, -ota_1, app, ota_1, , 12M, +model, data, spiffs, , 0xF0000, +# According to scripts/versions.py, app partition must be aligned to 1MB +ota_0, app, ota_0, 0x200000, 12M, +ota_1, app, ota_1, , 12M, diff --git a/scripts/versions.py b/scripts/versions.py index 2a42db39..cc084c26 100644 --- a/scripts/versions.py +++ b/scripts/versions.py @@ -75,8 +75,14 @@ def get_board_name(folder): def read_binary(dir_path): merged_bin_path = os.path.join(dir_path, "merged-binary.bin") - data = open(merged_bin_path, "rb").read()[0x100000:] - if data[0] != 0xE9: + merged_bin_data = open(merged_bin_path, "rb").read() + + # find app partition + if merged_bin_data[0x100000] == 0xE9: + data = merged_bin_data[0x100000:] + elif merged_bin_data[0x200000] == 0xE9: + data = merged_bin_data[0x200000:] + else: print(dir_path, "is not a valid image") return # get flash size