feat: add OTA firmware update for ESP32 platforms#54
Merged
Conversation
Extend the network abstraction layer with HTTP GET for lightweight requests (e.g. OTA version check JSON). Both ESP-IDF and RT-Thread backends implement the new function following the same pattern as the existing claw_net_post(). Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
Add Over-The-Air update support following the board-interface pattern (claw_ota.h), not OSAL abstraction — OTA is fundamentally a platform operation (flash write, partition switch, bootloader interaction). New components: - claw_ota.h: platform OTA callback interface - ota_service.c: version check, JSON parse, update worker thread - esp_ota.c: ESP-IDF implementation (esp_ota_ops A/B partition) - tool_ota.c: AI tools (ota_check, ota_update, ota_version, ota_rollback) - /ota shell command (check|update|rollback|version) Build integration: - Meson: -Dota=true feature flag, OTA URL/interval config overrides - Kconfig: CONFIG_RTCLAW_OTA_ENABLE for ESP32-C3 and S3 - CMake: app_update component dependency - sdkconfig: rollback enabled on xiaozhi-xmini and S3 default Target boards: xiaozhi-xmini (C3, 16MB) and ESP32-S3 default (16MB), both already have OTA dual-partition tables (ota_0 + ota_1 + otadata). Closes #53 Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
15 test cases covering OTA pure-logic functions: - version_compare: equal, major/minor/patch, mixed precedence - parse_version_json: full/minimal/spaced JSON, missing fields, empty input, field truncation - trigger_update: NULL and empty URL rejection - tool registration: all 4 OTA AI tools present Platform OTA functions are stubbed (no real flash needed). Test runner enables -Dota=true automatically via run.py. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
On ESP-IDF the CONFIG_RTCLAW_OTA_ENABLE flag comes from Kconfig (sdkconfig → cross.ini), not from Meson -Dota=true. When sdkconfig enables OTA but Meson ota=false (the default), OTA call-sites in claw_init.c and shell_commands.c are active but OTA source files are missing, causing undefined reference errors at link time. Fix: always include ota_service.c, tool_ota.c, and test_ota.c in the build. The #ifdef CONFIG_RTCLAW_OTA_ENABLE inside each file controls whether any code is emitted. This matches the pattern used by swarm, sched, ai_engine, and other modules. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
esp_ota.c was compiled into libmain.a, but the Meson-compiled ota_service.o (in librt_claw.a) references its symbols. ESP-IDF links librt_claw.a before libmain.a, so the linker cannot resolve claw_ota_platform_init, claw_ota_running_version, etc. Fix: compile esp_ota.c as part of the rt_claw component so all OTA symbols live in the same static library. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
During firmware flashing/erasing, output now goes directly to the right-side Serial Monitor panel instead of a separate flash-log div. All serial controls (Connect, Reset, Clear, baudrate, input, Send) are disabled during flash to prevent conflicts, except the Expand button which remains usable. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claw_net_get()) for lightweight requestsesp_ota_opsA/B partition switchingota_check,ota_update,ota_version,ota_rollback) for AI-driven OTA/ota check|update|rollback|versionfor interactive useArchitecture
OTA follows the board interface pattern (like
claw_board.h):Target Boards
Test plan
-Dota=true(vexpress-a9 cross)scripts/check-patch.shpasses on all new/modified filesmake test-unitpasses (15 OTA tests + existing suites)make build-esp32c3-xiaozhi-xminicompiles with OTA enabledCloses #53