Add LoRa partition migration recipes for ESP32 infrastructure boards

This commit is contained in:
mikecarper committed 2026-09-24 10:40:32 -07:00
1 parent e7f6d529a0
commit c0ef07a968
10 files changed
+288 -86

No files matched your search

@@ -72,12 +72,16 @@ TEST(Esp32PartitionMigrationPolicy, LoRaResumePreservesTheOldApplicationInEither
EXPECT_TRUE(from_a.valid);
EXPECT_EQ(0, from_a.bridge_slot);
EXPECT_EQ(1, from_a.resume_slot);
EXPECT_TRUE(from_a.copy_app1);
EXPECT_FALSE(from_a.restore_identity_in_full);
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);
EXPECT_TRUE(from_b.copy_app1);
EXPECT_FALSE(from_b.restore_identity_in_full);
}
auto overlapping = policy::kExpanded8MBLayout;
@@ -89,6 +93,14 @@ TEST(Esp32PartitionMigrationPolicy, LoRaResumePreservesTheOldApplicationInEither
EXPECT_FALSE(policy::planLoRaResume(policy::kLegacyLayout,
policy::kExpanded4MBLayout,
policy::kLegacyLayout.app0_address).valid);
const auto small_from_b = policy::planLoRaResume(
policy::kLegacyLayout, policy::kExpanded4MBLayout,
policy::kLegacyLayout.app1_address);
EXPECT_TRUE(small_from_b.valid);
EXPECT_EQ(1, small_from_b.bridge_slot);
EXPECT_EQ(0, small_from_b.resume_slot);
EXPECT_FALSE(small_from_b.copy_app1);
EXPECT_TRUE(small_from_b.restore_identity_in_full);
}
TEST(Esp32PartitionMigrationPolicy, GeneratedTablePrefixContainsAllSixEntriesAndMd5) {
+19 -9
View File
@@ -17,7 +17,8 @@ sys.path.insert(0, str(ROOT / "scripts"))
from build_esp32_partition_migration import ( # noqa: E402
build_steps, bundle_release, verify_archive,
)
from package_esp32_partition_migration import BOARDS, readme # noqa: E402
from package_esp32_partition_migration import BOARDS, mota_full, readme # noqa: E402
from motalib import FwIdent # noqa: E402
class Esp32MigrationRecipeTest(unittest.TestCase):
@@ -47,6 +48,7 @@ class Esp32MigrationRecipeTest(unittest.TestCase):
with self.subTest(board=board):
self.assertIn(spec["target"], env_names)
self.assertIn(spec["wifi_bridge"], env_names)
self.assertIn(spec["lora_bridge"], env_names)
self.assertEqual(expected_slots[spec["flash_bytes"]],
spec["slot_bytes"])
@@ -96,30 +98,38 @@ class Esp32MigrationRecipeTest(unittest.TestCase):
"xiao_s3_partition_migrator_lora_repeater",
], [command[3] for command, _ in steps[2:]])
def test_wifi_only_4mb_roles_share_one_bridge(self):
def test_4mb_roles_share_two_chip_family_bridges(self):
steps = build_steps(["thinknode-m2-repeater", "thinknode-m2-room-server"],
"v1.17.1.7-test", "usa-cascadia", "cascade", 4)
self.assertEqual([True, True, False], [full for _, full in steps])
self.assertEqual([True, True, False, False], [full for _, full in steps])
self.assertEqual("ThinkNode_M2_Repeater", steps[0][0][3])
self.assertEqual("ThinkNode_M2_room_server", steps[1][0][3])
self.assertEqual("esp32_s3_4mb_partition_migrator", steps[2][0][3])
self.assertEqual("esp32_s3_4mb_partition_migrator_lora", steps[3][0][3])
guide = readme("thinknode-m2-repeater", BOARDS["thinknode-m2-repeater"],
"v1.17.1.7-test", "01234567")
self.assertIn("no LoRa bridge", guide)
"v1.17.1.7-test", "01234567", full_mota_blocks=900)
self.assertIn("old slot B", guide)
self.assertIn("original private key from NVS", guide)
self.assertIn("power loss during", guide)
self.assertIn("exact\n `Started:` URL", guide)
self.assertNotIn("ota pull <id>", guide)
self.assertIn("ota pull <id>", guide)
large_guide = readme("heltec-v3-sensor", BOARDS["heltec-v3-sensor"],
"v1.17.1.7-test", "01234567", has_full_mota=False)
self.assertIn("does not include `full-application.mota`", large_guide)
"v1.17.1.7-test", "01234567", full_mota_blocks=1400)
self.assertIn("5600 bytes of proof scratch", large_guide)
def test_sensor_and_room_roles_share_the_8mb_bridge(self):
steps = build_steps(["xiao-s3-wio-sensor", "xiao-s3-wio-room-server"],
"v1.17.1.7-test", "usa-cascadia", "cascade", 4)
self.assertEqual([True, True, False], [full for _, full in steps])
self.assertEqual([True, True, False, False], [full for _, full in steps])
self.assertEqual("Xiao_S3_WIO_sensor", steps[0][0][3])
self.assertEqual("Xiao_S3_WIO_room_server", steps[1][0][3])
self.assertEqual("esp32_s3_8mb_partition_migrator", steps[2][0][3])
self.assertEqual("esp32_s3_8mb_partition_migrator_lora", steps[3][0][3])
def test_full_mota_can_exceed_old_seeder_scratch_limit(self):
image = b"\xE9" + b"\0" * (1024 * 2048)
package = mota_full(image, FwIdent(0x01020304, 0xAABBCCDD, "TEST"), 2048)
self.assertGreater(len(package), len(image))
def test_dry_run_has_no_build_side_effects(self):
with tempfile.TemporaryDirectory(prefix="esp32-migration-plan-") as temporary: