docs(engineering): 补充 ccache 提速与工具链安装排障
- 记录 IDF_CCACHE_ENABLE / CONFIG_IDF_BUILD_USE_CCACHE 加速重复编译 - 说明 export.sh 需 source 而非 ./ 执行、自定义 IDF_TOOLS_PATH 每次重设 - 增加工具链安装失败恢复:清理 ~/.espressif/dist、macOS 证书包、 Apple Silicon Rosetta 2、Windows 杀毒扫描排除 - 经验来自 esp-mosaico/esp-mosaico-vibe,双语同步更新
This commit is contained in:
1 parent
df3990726e
commit
3bacd66efd
6 files changed
+113
No files matched your search
@@ -29,6 +29,31 @@ changed defaults. Preserve intentional local settings, then run
|
||||
`idf.py set-target esp32c3` when the target or tracked defaults must be
|
||||
regenerated.
|
||||
|
||||
### Speeding up repeated builds
|
||||
|
||||
ccache keeps incremental builds fast. ESP-IDF does not enable it by default;
|
||||
enable it for the current terminal, or make it permanent per project:
|
||||
|
||||
```bash
|
||||
export IDF_CCACHE_ENABLE=1
|
||||
idf.py build
|
||||
```
|
||||
|
||||
```text
|
||||
CONFIG_IDF_BUILD_USE_CCACHE=y
|
||||
```
|
||||
|
||||
The ccache cache lives outside `build/`, so neither `idf.py fullclean` nor a
|
||||
temporary validation build removes it. When the cache must be cleared, remove
|
||||
the ccache directory itself (default `~/.ccache`, or wherever
|
||||
`CCACHE_DIR` points).
|
||||
|
||||
On Windows, slow repeated builds are frequently caused by antivirus or endpoint
|
||||
software scanning build directories in real time; add the ESP-IDF install
|
||||
directory, the tools directory (`%USERPROFILE%\.espressif` or a custom
|
||||
`IDF_TOOLS_PATH`), and the project build directory (`build/`) to the scan
|
||||
exclusions.
|
||||
|
||||
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 [protected Flash layout](protected-flash-layout.md): protected partition addresses, application size, partition-table MD5, and absence of protected payload data.
|
||||
|
||||
@@ -27,6 +27,26 @@ idf.py fullclean # 只清空过期生成状态(勿用于清理用
|
||||
target 或已跟踪 defaults 时,先保留有意的本地设置,再运行
|
||||
`idf.py set-target esp32c3`。
|
||||
|
||||
### 加速重复编译
|
||||
|
||||
ccache 能让增量编译保持快速。ESP-IDF 默认未启用;在当前终端启用,或在项目配置里永久启用:
|
||||
|
||||
```bash
|
||||
export IDF_CCACHE_ENABLE=1
|
||||
idf.py build
|
||||
```
|
||||
|
||||
```text
|
||||
CONFIG_IDF_BUILD_USE_CCACHE=y
|
||||
```
|
||||
|
||||
ccache 缓存位于 `build/` 之外,因此 `idf.py fullclean` 和临时验证构建都不会清掉它。
|
||||
需要清缓存时删除 ccache 目录本身(默认 `~/.ccache`,或 `CCACHE_DIR` 指向的位置)。
|
||||
|
||||
在 Windows 上,重复编译慢常见原因是杀毒或终端安全软件实时扫描构建目录;
|
||||
把 ESP-IDF 安装目录、工具链目录(`%USERPROFILE%\.espressif` 或自定义
|
||||
`IDF_TOOLS_PATH`)和工程构建目录(`build/`)加入扫描排除项。
|
||||
|
||||
仓库提交 `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`。门禁同时强制检查[受保护的 Flash 布局](protected-flash-layout.zh_CN.md):保护分区地址、应用大小、分区表 MD5 以及保护区数据不入包。
|
||||
|
||||
@@ -173,6 +173,40 @@ printf 'IDF_PATH=%s\n' "${IDF_PATH}"
|
||||
Stop if the reported version is not exactly `ESP-IDF v5.5.3`. Do not generate
|
||||
project configuration with another version.
|
||||
|
||||
Activation is shell-scoped: run `export.sh` with a leading dot (or `source`),
|
||||
never as `./export.sh`, which spawns a subshell and leaves the current shell
|
||||
unconfigured (`IDF_PATH is not set` or `idf.py: command not found` afterward).
|
||||
If a custom `IDF_TOOLS_PATH` was used during install, set it again before every
|
||||
`export.sh` call — the script does not remember it from an earlier session.
|
||||
|
||||
### Toolchain install failures
|
||||
|
||||
`install.sh` fetches toolchains themselves from the same mirror nodes. When it
|
||||
fails at a checksum mismatch or a corrupted download, clear the cache and
|
||||
retry:
|
||||
|
||||
```bash
|
||||
rm -rf ~/.espressif/dist
|
||||
"${AI_PASSPORT_IDF_ROOT}/install.sh" esp32c3
|
||||
```
|
||||
|
||||
On macOS, a certificate error (`[SSL: CERTIFICATE_VERIFY_FAILED]`) is usually a
|
||||
missing Python certificate bundle; run
|
||||
`Install Certificates.command` from the Python installation directory, then
|
||||
retry. On Apple Silicon, `bad CPU type in executable` or
|
||||
`tool xtensa-esp32-elf has no installed versions` means the toolchain binary is
|
||||
x86-64 and needs Rosetta 2:
|
||||
|
||||
```bash
|
||||
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
|
||||
```
|
||||
|
||||
On Windows the official ESP-IDF Tools Installer already handles mirrors and
|
||||
caching; if a manual install still fails at a corrupted archive, the partially
|
||||
downloaded files live under `%USERPROFILE%\.espressif\dist` — delete that
|
||||
folder, set `IDF_GITHUB_ASSETS` in the same session as `install.bat`, and
|
||||
retry.
|
||||
|
||||
For mainland China, optionally accelerate Managed Component archives in the
|
||||
current terminal:
|
||||
|
||||
|
||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user