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.
This commit is contained in:
1 parent
545881ad1d
commit
cbede2d2fa
105 files changed
+1025
-1576
No files matched your search
@@ -0,0 +1,70 @@
|
||||
<p align="right">
|
||||
<a href="ble-recovery-compatibility.zh_CN.md">简体中文</a> · <strong>English</strong>
|
||||
</p>
|
||||
|
||||
# Mini-Program BLE Firmware Compatibility
|
||||
|
||||
This repository is a derivative-firmware template. Every application built from
|
||||
it must remain installable by the AI Passport mini-program through the permanent
|
||||
Recovery already provisioned by the official factory firmware.
|
||||
|
||||
## How installation works
|
||||
|
||||
The application does not implement the BLE flashing service. The user holds UP
|
||||
while powering on for five seconds; the custom bootloader then starts the
|
||||
factory-installed Recovery at `0x700000`. Recovery exposes the FFF0–FFF4 BLE
|
||||
service, verifies the device, receives the application and resource sections,
|
||||
protects device identity, commits a compatible partition table, and starts the
|
||||
new application.
|
||||
|
||||
The community artifact is therefore an input to Recovery, not a replacement for
|
||||
Recovery. A device whose permanent Recovery was erased must first be restored
|
||||
with the official USB recovery flow.
|
||||
|
||||
## Mandatory contract
|
||||
|
||||
Derivative projects must preserve all of the following:
|
||||
|
||||
- ESP32-C3, 8 MB Flash, ESP-IDF 5.5.3.
|
||||
- A merged ESP image starting at `0x0`, produced as
|
||||
`build/FoloToy-AI-Passport-full.bin`.
|
||||
- One main application image at `0x10000`, no larger than `0x300000` bytes.
|
||||
- `cardid`: data/NVS at `0x356000`, size `0x4000`.
|
||||
- `recovery`: app/test at `0x700000`, size `0x100000`.
|
||||
- The bootloader hook under `bootloader_components/recovery_boot_hook/`, which
|
||||
enters Recovery after the UP key is held for five seconds.
|
||||
- A valid partition-table MD5 marker and no partition overlap with either
|
||||
protected region.
|
||||
- No device-specific `cardid` payload and no replacement Recovery payload in a
|
||||
community artifact.
|
||||
|
||||
Applications may add resource partitions, but the partitions must not overlap
|
||||
the protected regions. Required resource partitions must be included in the
|
||||
merged artifact rather than declared empty.
|
||||
|
||||
## Enforced validation
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
./tools/validate.sh --firmware
|
||||
```
|
||||
|
||||
The check builds in an isolated directory, creates the merged image, verifies
|
||||
the bootloader/table/application offsets, parses the partition table, checks its
|
||||
MD5 and protected ranges, enforces the 3 MB application limit, rejects protected
|
||||
payload bytes, and confirms the Recovery boot hook is linked. CI runs the same
|
||||
gate. Do not publish an artifact when this command fails.
|
||||
|
||||
Upload only `build/FoloToy-AI-Passport-full.bin`; the similarly named app-only
|
||||
`build/FoloToy-AI-Passport.bin` cannot pass mini-program compatibility checks.
|
||||
|
||||
## Flashing safety during development
|
||||
|
||||
Never run `idf.py erase-flash` on a provisioned device. It destroys both the
|
||||
per-device identity and permanent Recovery. Prefer mini-program installation or
|
||||
the segmented `idf.py flash` development command, which does not write an image
|
||||
for the protected partitions. A raw single-file write from `0x0` is safe only
|
||||
when its byte range ends before `cardid`; a merged artifact containing later
|
||||
resource partitions spans the gap and must not be raw-flashed to a provisioned
|
||||
device.
|
||||
@@ -0,0 +1,59 @@
|
||||
<p align="right">
|
||||
<strong>简体中文</strong> · <a href="ble-recovery-compatibility.md">English</a>
|
||||
</p>
|
||||
|
||||
# 小程序 BLE 固件兼容规范
|
||||
|
||||
本仓库是二创固件模板。任何基于它开发的应用,都必须保持可由 AI Passport
|
||||
小程序通过官方默认固件预装的永久 Recovery 安装。
|
||||
|
||||
## 安装原理
|
||||
|
||||
玩法应用本身不实现 BLE 刷机服务。用户关机后按住上键开机 5 秒,自定义
|
||||
bootloader 跳转到 `0x700000` 的工厂预装 Recovery。Recovery 提供 FFF0–FFF4
|
||||
BLE 服务,验证设备后接收应用与资源分区,保护设备身份,写入兼容分区表,
|
||||
最后启动新应用。
|
||||
|
||||
因此,社区固件是 Recovery 的安装输入,不是 Recovery 的替代品。如果设备的永久
|
||||
Recovery 已被擦除,必须先走官网 USB 恢复流程。
|
||||
|
||||
## 必须保持的契约
|
||||
|
||||
二创项目必须同时保留:
|
||||
|
||||
- ESP32-C3、8 MB Flash、ESP-IDF 5.5.3。
|
||||
- 从 `0x0` 开始的合并 ESP 镜像,固定产物为
|
||||
`build/FoloToy-AI-Passport-full.bin`。
|
||||
- 位于 `0x10000` 的主应用镜像,不得超过 `0x300000` 字节。
|
||||
- `cardid`:data/NVS,地址 `0x356000`,大小 `0x4000`。
|
||||
- `recovery`:app/test,地址 `0x700000`,大小 `0x100000`。
|
||||
- `bootloader_components/recovery_boot_hook/` 下的 bootloader hook,上键持续
|
||||
5 秒后进入 Recovery。
|
||||
- 有效的分区表 MD5,且所有分区不得与两个保护区重叠。
|
||||
- 社区产物不得包含任何单台设备的 `cardid` 数据,也不得携带替换 Recovery
|
||||
的数据。
|
||||
|
||||
应用可以新增资源分区,但不得覆盖保护区。必需资源分区必须打入合并产物,
|
||||
不得只在分区表声明一个空分区。
|
||||
|
||||
## 强制验证
|
||||
|
||||
执行:
|
||||
|
||||
```bash
|
||||
./tools/validate.sh --firmware
|
||||
```
|
||||
|
||||
脚本会在隔离目录构建,生成合并镜像,验证 bootloader、分区表与应用的偏移,
|
||||
解析分区表并检查 MD5、保护范围和 3 MB 应用上限,拒绝保护分区数据,同时
|
||||
确认 Recovery boot hook 已链接。CI 执行同一门禁。该命令失败时不得发布。
|
||||
|
||||
只上传 `build/FoloToy-AI-Passport-full.bin`。名称相近的应用单镜像
|
||||
`build/FoloToy-AI-Passport.bin` 无法通过小程序兼容检测。
|
||||
|
||||
## 开发烧录安全
|
||||
|
||||
已写入设备身份的机器严禁执行 `idf.py erase-flash`,否则会同时破坏单机身份与永久
|
||||
Recovery。优先使用小程序安装,或使用不会写保护分区镜像的分段 `idf.py flash`。
|
||||
只有单文件的字节范围在 `cardid` 之前结束时,从 `0x0` 直接写入才是安全的;
|
||||
若合并产物包含位于 `cardid` 之后的资源分区,就不得对已写身份的设备做单文件直刷。
|
||||
@@ -0,0 +1,60 @@
|
||||
<p align="right">
|
||||
<a href="build-and-test.zh_CN.md">简体中文</a> · <strong>English</strong>
|
||||
</p>
|
||||
|
||||
# Build and Test
|
||||
|
||||
Use ESP-IDF 5.5.3. On a clean machine or when the toolchain is missing, follow
|
||||
the [environment bootstrap](environment-setup.md) first.
|
||||
|
||||
> Prefer `./tools/validate.sh --firmware` for firmware builds and flash its
|
||||
> verified `build/FoloToy-AI-Passport-full.bin` at offset `0x0` only when the
|
||||
> target is blank or the merged byte range ends before protected `cardid`.
|
||||
> On a provisioned device, prefer mini-program install or segmented
|
||||
> `idf.py flash`. Treat
|
||||
> `idf.py build` and `idf.py flash` as incremental development commands, not the
|
||||
> default delivery path.
|
||||
|
||||
```bash
|
||||
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 gate also enforces the [mini-program BLE compatibility contract](ble-recovery-compatibility.md): protected partition addresses, application size, partition-table MD5, absence of protected payload data, and the Recovery bootloader hook.
|
||||
|
||||
The baseline also has a hardware-independent logic test:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
./tools/validate.sh --static # repository checks, workflows, links, secrets, host tests
|
||||
./tools/validate.sh --firmware # build, merge-bin, offsets, and BLE compatibility
|
||||
./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.
|
||||
|
||||
Never upload the app-only `build/FoloToy-AI-Passport.bin` to the community. Only
|
||||
the validated `build/FoloToy-AI-Passport-full.bin` contains the structure the
|
||||
mini-program can inspect and transform safely.
|
||||
Loaded 3 of 105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user