Files
ai-passport/docs/development/build-and-test.md
T
Cjiio ae2a840131 docs(dev): add AI environment bootstrap (#20)
* docs(dev): add AI environment bootstrap

* docs(ui): document CJK font pitfall
2026-08-27 12:42:51 +08:00

2.5 KiB

简体中文 · English

Build and Test

Use ESP-IDF 5.5.3. On a clean machine or when the toolchain is missing, follow the environment bootstrap first.

Prefer ./tools/validate.sh --firmware for firmware builds and flash its verified build/FoloToy-AI-Passport-full.bin at offset 0x0. Treat idf.py build and idf.py flash as incremental development commands, not the default delivery path.

source <path-to-esp-idf-v5.5.3>/export.sh
idf.py --version             # must report ESP-IDF v5.5.3
./tools/validate.sh --firmware # preferred: build and verify merged 0x0 image
idf.py set-target esp32c3     # fresh checkout or changed target
idf.py build                  # optional incremental application build
idf.py flash monitor          # optional incremental application flash
idf.py fullclean              # remove stale generated build state only

idf.py fullclean does not fully synchronize an existing sdkconfig with changed defaults. Preserve intentional local settings, then run idf.py set-target esp32c3 when the target or tracked defaults must be regenerated.

The tracked dependencies.lock pins Managed Component resolution. After changing an idf_component.yml, regenerate the lock with ESP-IDF 5.5.3, review version changes, and commit it with the manifest. An ordinary build must not leave an unexplained lock-file diff.

Firmware validation uses a fresh temporary build directory and an isolated sdkconfig generated from the tracked defaults. It does not consume or overwrite a developer's root sdkconfig, and it copies only the verified merged image to build/FoloToy-AI-Passport-full.bin.

The baseline also has a hardware-independent logic test:

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

Use the unified validation entry point:

./tools/validate.sh --static    # repository checks, workflows, links, secrets, host tests
./tools/validate.sh --firmware  # build, merge-bin, image offsets and byte verification
./tools/validate.sh             # complete gate; requires an activated ESP-IDF environment

CI calls the same script. Fix the shared script or environment if local and CI behavior differs; do not duplicate command sequences in workflows.

Hardware-affecting changes must also run the applicable on-device checklist in the hardware guide. Report compilation separately from physical-device validation.