Add in-place ESP32 Wi-Fi and LoRa partition migration packages
This commit is contained in:
1 parent
352c8aed8c
commit
f8a1e2ff96
11 files changed
+555
-28
No files matched your search
@@ -55,6 +55,30 @@ TEST(Esp32PartitionMigrationPolicy, GenericPlansAcceptStableEightAndSixteenMiBLa
|
||||
out_of_bounds));
|
||||
}
|
||||
|
||||
TEST(Esp32PartitionMigrationPolicy, LoRaResumePreservesTheOldApplicationInEitherSlot) {
|
||||
for (const auto& target : {policy::kExpanded8MBLayout,
|
||||
policy::kExpandedLayout}) {
|
||||
const auto from_a = policy::planLoRaResume(policy::kLegacyLayout, target,
|
||||
policy::kLegacyLayout.app0_address);
|
||||
EXPECT_TRUE(from_a.valid);
|
||||
EXPECT_EQ(0, from_a.bridge_slot);
|
||||
EXPECT_EQ(1, from_a.resume_slot);
|
||||
|
||||
const auto from_b = policy::planLoRaResume(policy::kLegacyLayout, target,
|
||||
policy::kLegacyLayout.app1_address);
|
||||
EXPECT_TRUE(from_b.valid);
|
||||
EXPECT_EQ(1, from_b.bridge_slot);
|
||||
EXPECT_EQ(0, from_b.resume_slot);
|
||||
}
|
||||
|
||||
auto overlapping = policy::kExpanded8MBLayout;
|
||||
overlapping.app1_address = policy::kLegacyLayout.app1_address;
|
||||
EXPECT_FALSE(policy::planLoRaResume(policy::kLegacyLayout, overlapping,
|
||||
policy::kLegacyLayout.app0_address).valid);
|
||||
EXPECT_FALSE(policy::planLoRaResume(policy::kLegacyLayout,
|
||||
policy::kExpandedLayout, 0x300000).valid);
|
||||
}
|
||||
|
||||
TEST(Esp32PartitionMigrationPolicy, GeneratedTablePrefixContainsAllSixEntriesAndMd5) {
|
||||
EXPECT_EQ(0xE0U, policy::kExpandedPartitionTablePrefixBytes);
|
||||
EXPECT_EQ(0xAA, policy::kExpandedPartitionTablePrefix[0]);
|
||||
|
||||
@@ -42,6 +42,24 @@ assert_auto_unified Heltec_T190_repeater_ Heltec_T190_repeater_observer_mqtt
|
||||
assert_auto_unified LilyGo_TLora_V2_1_1_6_room_server LilyGo_TLora_V2_1_1_6_room_server_observer_mqtt_
|
||||
assert_auto_unified heltec_v4_r8_repeater_observer_mqtt heltec_v4_r8_repeater_observer_mqtt
|
||||
|
||||
# A one-board migration package must retain the old repeater's mOTA identity,
|
||||
# even when its Full sources come from the matching observer environment.
|
||||
(
|
||||
BUILD_PROFILE_OVERRIDE=full
|
||||
BUILD_PROFILE_EXPLICIT=1
|
||||
SINGLE_TARGET_FULL_BUILD=1
|
||||
EXACT_IDENTITY_FULL_BUILD=1
|
||||
RESOLVED_BUILD_TARGETS=(heltec_v4_repeater)
|
||||
configure_effective_build_profile build-firmware >/dev/null
|
||||
[ "${RESOLVED_BUILD_TARGETS[*]}" = heltec_v4_repeater ] \
|
||||
|| fail "exact Full target changed identity"
|
||||
run_logged_build_targets() {
|
||||
[ "${*}" = heltec_v4_repeater ] || fail "exact Full built a different target"
|
||||
[ "$ESP32_FULL_BUILD" = 1 ] || fail "exact Full lost expanded partitions"
|
||||
}
|
||||
run_command build-firmware >/dev/null
|
||||
)
|
||||
|
||||
# Only targets whose standard and FULL board recipes retain the exact same
|
||||
# partition table may omit their redundant portable bulk artifact.
|
||||
full_only_count=0
|
||||
@@ -157,7 +175,7 @@ done
|
||||
observed_filename=""
|
||||
observed_output=""
|
||||
build_artifacts_exist() {
|
||||
observed_filename=$2
|
||||
observed_filename=$3
|
||||
observed_output="$PACKET_LOGGING_OVERRIDE/$MQTT_BRIDGE_OVERRIDE/$MESHDEBUG_OVERRIDE/$MQTT_DEBUG_OVERRIDE"
|
||||
return 0
|
||||
}
|
||||
@@ -183,7 +201,7 @@ done
|
||||
observed_filename=""
|
||||
observed_full=0
|
||||
build_artifacts_exist() {
|
||||
observed_filename=$2
|
||||
observed_filename=$3
|
||||
observed_full=$ESP32_FULL_BUILD
|
||||
return 0
|
||||
}
|
||||
@@ -203,7 +221,7 @@ done
|
||||
FIRMWARE_FILENAME_INFIX=""
|
||||
observed_filename=""
|
||||
build_artifacts_exist() {
|
||||
observed_filename=$2
|
||||
observed_filename=$3
|
||||
return 0
|
||||
}
|
||||
build_firmware heltec_v4_r8_repeater >/dev/null
|
||||
|
||||
@@ -54,10 +54,16 @@ class HeltecV4PartitionMigratorTest(unittest.TestCase):
|
||||
migration_body = source[source.index("void runMigration()") :]
|
||||
self.assertLess(migration_body.index("stageLegacyIdentity()"),
|
||||
migration_body.index("copyAndVerify(*running"))
|
||||
self.assertLess(migration_body.index("esp_ota_set_boot_partition(&target_app0)"),
|
||||
self.assertLess(migration_body.index("esp_ota_set_boot_partition(&target_bridge)"),
|
||||
migration_body.index("publishExpandedPartitionTable(*plan)"))
|
||||
setup_body = source[source.index("void setup()") :]
|
||||
self.assertIn("restoreStagedIdentity()", setup_body)
|
||||
self.assertIn("resumeLegacyOtaReceiver(*plan)", setup_body)
|
||||
self.assertLess(setup_body.index("restoreStagedIdentity()"),
|
||||
setup_body.index("resumeLegacyOtaReceiver(*plan)"))
|
||||
self.assertIn("validLegacyOtaReceiver(*old_receiver)", migration_body)
|
||||
self.assertIn("copyAndVerify(*refs.app1", migration_body)
|
||||
self.assertIn("stageResumeSlot(resume.resume_slot)", migration_body)
|
||||
self.assertIn("AsyncElegantOTA.begin(&server)", source)
|
||||
self.assertIn("MeshCore-Migrate", source)
|
||||
self.assertIn("DRAM_ATTR esp_partition_t copy_destination", source)
|
||||
|
||||
Reference in new issue
Block a user