Files
ai-passport/docs/development/engineering/build-and-test.zh_CN.md
T
Shinku cbede2d2fa docs: reorganize reference area and unify directory READMEs
Reorganize the AI-agent documentation by function area:
- Move the plays/ application archive and experiences into docs/reference/, grouped by contributor <username>/ (flat experience entries + application subdirectories), with a single reference/README entry.
- Add a second level under docs/development/ (engineering/, ci/, release/); fold agent-guide into ai-guide; flatten the six project-completion sub-documents into one file.
- Unify each directory to a single README (drop every INDEX); fold assets/{fonts,images,music} README leaves into assets/README; remove the empty docs/software-design/.
- Add an upstream-PR rule: do not add or modify the repository-root README.
- Update all cross-references and bibliographic links (EN/ZH aligned); validate.sh --static passes. The repository-root README is left untouched.
2026-08-31 15:05:42 +08:00

3.1 KiB
Raw Blame History

简体中文 · English

构建与验证(Build & Test)

使用 ESP-IDF 5.5.3。全新机器或缺少工具链时,先按 环境引导完成安装。

固件编译优先运行 ./tools/validate.sh --firmware,烧录优先把验证通过的 build/FoloToy-AI-Passport-full.bin 写入空白设备;对已有身份的设备,只有合并文件 在保护区 cardid 之前结束时才可从 0x0 直刷,其余情况优先用小程序或分段 idf.py flash。idf.py build 和 idf.py flash 只作为增量开发命令,不作为默认交付方式。

source <ESP-IDF-v5.5.3-路径>/export.sh
idf.py --version             # 必须输出 ESP-IDF v5.5.3
./tools/validate.sh --firmware # 优先:编译并验证 0x0 合并固件
idf.py set-target esp32c3     # 配置目标芯片(fresh checkout 后/换 target 后运行)
idf.py build                  # 可选:增量 app 编译
idf.py flash monitor          # 可选:增量 app 烧录
idf.py fullclean              # 只清空过期生成状态(勿用于清理用户源码改动)

idf.py fullclean 不能让已有 sdkconfig 完整同步变更后的 defaults。需要重建 target 或已跟踪 defaults 时,先保留有意的本地设置,再运行 idf.py set-target esp32c3。

仓库提交 dependencies.lock 以固定 ESP-IDF Managed Components 的解析结果。修改 idf_component.yml 后必须使用 ESP-IDF 5.5.3 重新生成锁文件、review 版本变化并与 manifest 一起提交;普通构建不应产生未提交的锁文件差异。

固件门禁使用全新的临时构建目录,并从仓库 sdkconfig.defaults 生成隔离的 sdkconfig。它不会读取或覆盖开发者根目录的 sdkconfig,只把验证通过的合并镜像复制到 build/FoloToy-AI-Passport-full.bin。门禁同时强制检查小程序 BLE 兼容契约:保护分区地址、应用大小、分区表 MD5、保护区数据不入包,以及 Recovery bootloader hook。

当前基线含一个可独立运行的纯逻辑测试:

cc -std=c11 -Wall -Wextra -Werror -Imain \
  tests/test_ui_pixel_math.c main/ui_pixel_math.c \
  -o /tmp/test_ui_pixel_math
/tmp/test_ui_pixel_math

统一验证入口:

./tools/validate.sh --static    # 仓库一致性、workflow、文档链接、敏感信息、host tests
./tools/validate.sh --firmware  # ESP-IDF build、merge-bin、偏移与 BLE 兼容校验
./tools/validate.sh             # 完整验证

完整验证要求预先激活 ESP-IDF 5.5.3。CI 与本地使用同一脚本;若 CI 和本地行为不同,应先修复脚本或环境,而不是维护两份命令。

涉及物理外设的改动必须在真机运行硬件指南验收清单,并把“编译通过”与“硬件验证通过”分开记录。

社区只能上传验证通过的 build/FoloToy-AI-Passport-full.bin,不得上传应用单镜像 build/FoloToy-AI-Passport.bin,后者没有小程序可安全解析与转换的完整结构。