更新固件版本号从2.6.54至2.6.59 新增badge_network_close_ap接口,支持主动关闭激活的SoftAP与配置Web服务器 启动AI助手时自动关闭当前激活的配置热点,避免网络冲突问题 调整主界面菜单顺序,将小智AI设为首页首个选项 重构设置页面菜单,移除冗余的AI设置入口,优化交互逻辑 完善小智AI的网络错误提示,新增热点未关闭、Wi-Fi断开的针对性提示 新增自动化编译、烧录、数据备份恢复的流水线脚本及中英文使用文档 同步更新单元测试用例以适配新的菜单与导航逻辑
3.0 KiB
简体中文 · English
AI Agent Guide: Version Update, Firmware Build, and Flashing Pipeline
This document defines the unified pipeline for firmware version bumping, compilation, 0x0 merged binary generation, layout verification, and device flashing.
1. Automated Pipeline Tool: tools/pipeline.py
The repository provides a unified script (tools/pipeline.py) that chains the entire workflow, supporting version bumping, building, flashing, and full backup/restore of user data.
Usage Examples
-
Standard Safe Flash (Fastest, preserves NVS & profiles in-place):
python tools/pipeline.py --bump patch --flash -
Flash with explicit Backup & Restore (Full safety net):
python tools/pipeline.py --bump patch --flash --backup --restore -
Backup only (Save Wi-Fi, profiles & QR codes to disk):
python tools/pipeline.py --backup-only --backup-dir ./backups/my_backup -
Restore only (Write saved user data back to device):
python tools/pipeline.py --restore-only --backup-dir ./backups/my_backup -
Build and package 0x0 binary without flashing:
python tools/pipeline.py --bump patch
2. Core Execution Stages
Stage 1: Update Version
- Location:
main/badge_profile.h - Macro:
#define BADGE_VERSION "X.Y.Z"
Stage 2: Activate ESP-IDF 5.5.3 Environment
- Toolchain path:
D:\esp\esp-idf - Activation in Windows PowerShell:
[Environment]::SetEnvironmentVariable('MSYSTEM', '') Set-Location D:\esp\esp-idf . .\export.ps1 Set-Location <repo_root>
Stage 3: Build & Merge Binary (0x0)
- Compile application:
idf.py build - Merge full image:
idf.py merge-bin -o FoloToy-AI-Passport-full.bin - Verify firmware layout:
python tools/verify_firmware.py build
Stage 4: Flash Device (Preserve User Data vs Full Erase)
⚠️ Critical Safety Rule:
- Incremental / Feature Update: DO NOT write 0x0 full image directly! Writing at 0x0 overwrites
0x9000(NVS, Wi-Fi credentials) and0x690000/0x7d0000(custom profiles & QR codes).- Preserving Flash (Recommended): Only flash application image to
0x10000. Finishes in seconds and preserves all user configuration and credentials.
-
Safe Flashing (Preserves all user data):
esptool --port <PORT> --chip esp32c3 -b 460800 write-flash 0x10000 build/FoloToy-AI-Passport.binOr via the pipeline script:
python tools/pipeline.py --flash -
Factory Reset Flash (Erases all data): Use only when initializing a blank chip or requested by the user:
python tools/pipeline.py --erase-all
3. Troubleshooting
- Port Disappears After Flashing: Press the UP (wake) key or replug the USB cable to re-enumerate the USB CDC/JTAG serial port.
- Compressed Size vs Flash Size:
esptoolcompresses the 8 MB flash payload during transport. The decompressed 8 MB image is written completely.