fix(tools): resolve flash_models.sh partition CSV from the build config #12

Merged
troed merged 2 commits from fix/flash-models-partition-csv into devel 2026-10-10 18:32:21 +02:00
Owner

What

tools/flash_models.sh hardcoded partitions_ota16m.csv, so it could diverge from the firmware's partition table whenever the (gitignored) repo sdkconfig selected a different CSV. A stale sdkconfig still on partitions_sr16m.csv therefore wrote the mww payload to the wrong offset: the app booted, mww_init() aborted on a bad header, and the device reset-looped (audible as codec clicks on every reboot).

Fix

  • Resolve the partition CSV from sdkconfig (CONFIG_PARTITION_TABLE_CUSTOM_FILENAME, else CONFIG_PARTITION_TABLE_FILENAME); add --csv FILE as the explicit override; fail clearly when neither is available.
  • Correct the stale sg dialout guidance (the developer is in dialout).
  • Record the sdkconfig vs sdkconfig.defaults drift trap in AGENTS.md.

Tests

  • New host/tests/test_flash_models.py: --csv override drives the mww offset; the default comes from the sdkconfig-named CSV; unknown args are rejected.
  • Full host suite: 61 passed (58 before + 3 new).

Verification

Reproduced on hardware: a stale-sdkconfig build plus an ota16m model write produced 45 reboots / 60 s with mww … bad header. After aligning sdkconfig to ota16m, rebuilding, and reflashing both the app and the model partition: 0 resets, 0 errors, wake-word engine running.

## What `tools/flash_models.sh` hardcoded `partitions_ota16m.csv`, so it could diverge from the firmware's partition table whenever the (gitignored) repo `sdkconfig` selected a different CSV. A stale `sdkconfig` still on `partitions_sr16m.csv` therefore wrote the `mww` payload to the wrong offset: the app booted, `mww_init()` aborted on a bad header, and the device reset-looped (audible as codec clicks on every reboot). ## Fix - Resolve the partition CSV from `sdkconfig` (`CONFIG_PARTITION_TABLE_CUSTOM_FILENAME`, else `CONFIG_PARTITION_TABLE_FILENAME`); add `--csv FILE` as the explicit override; fail clearly when neither is available. - Correct the stale `sg dialout` guidance (the developer is in `dialout`). - Record the `sdkconfig` vs `sdkconfig.defaults` drift trap in AGENTS.md. ## Tests - New `host/tests/test_flash_models.py`: `--csv` override drives the `mww` offset; the default comes from the sdkconfig-named CSV; unknown args are rejected. - Full host suite: **61 passed** (58 before + 3 new). ## Verification Reproduced on hardware: a stale-sdkconfig build plus an ota16m model write produced 45 reboots / 60 s with `mww … bad header`. After aligning `sdkconfig` to ota16m, rebuilding, and reflashing both the app and the model partition: **0 resets, 0 errors**, wake-word engine running.
flash_models.sh hardcoded partitions_ota16m.csv, so it diverged from the
firmware whenever the gitignored repo sdkconfig selected a different table
(e.g. a stale sdkconfig still on partitions_sr16m.csv). The mww payload then
landed at the wrong offset, mww_init() aborted on a bad header, and the device
reset-looped (audible as codec clicks).

Resolve the CSV from sdkconfig (CONFIG_PARTITION_TABLE_CUSTOM_FILENAME, else
CONFIG_PARTITION_TABLE_FILENAME); add --csv as the explicit override and fail
clearly when neither is available. Tests cover the override, the sdkconfig
default, and unknown-arg rejection.
The developer is in dialout (gid 488), so the sg wrapper is unnecessary.
Record why a stale sdkconfig can leave the app booting against the wrong mww
offset (mww_init bad header -> device reset loop).
troed merged commit e608c64583 into devel 2026-10-10 18:32:21 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starfleet/communicator-esp32!12
No description provided.