$npx -y skills add easyzoom/aix-skills --skill esp-idf-integrationUse when integrating, configuring, or debugging ESP-IDF projects, components, sdkconfig, partition tables, bootloader, NVS, Wi-Fi, BLE, FreeRTOS, flash, or peripherals
| 1 | # ESP-IDF Integration |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Use this skill to debug ESP-IDF by separating project configuration, |
| 6 | components, partition table, bootloader, flash settings, FreeRTOS behavior, and |
| 7 | subsystem logs. ESP-IDF failures are often visible in `sdkconfig` or boot logs. |
| 8 | |
| 9 | ## When To Use |
| 10 | |
| 11 | Use this skill when: |
| 12 | |
| 13 | - The user is working with ESP-IDF, `idf.py`, ESP32-family SoCs, components, or |
| 14 | managed components. |
| 15 | - The issue involves `sdkconfig`, partition tables, NVS, Wi-Fi, BLE, OTA, flash |
| 16 | mode/size, bootloader logs, heap, tasks, or peripheral drivers. |
| 17 | - The project differs between menuconfig, CMake components, and runtime logs. |
| 18 | |
| 19 | Do not use this skill for generic FreeRTOS kernel bugs with no ESP-IDF surface. |
| 20 | Use `freertos-kernel-debug` instead. |
| 21 | |
| 22 | ## First Questions |
| 23 | |
| 24 | Ask for: |
| 25 | |
| 26 | - ESP-IDF version, target chip, module/board, toolchain, and `idf.py` command. |
| 27 | - `sdkconfig`, partition table, component layout, and dependency manifest. |
| 28 | - Boot log from reset through app start, including flash mode/size and reset |
| 29 | reason. |
| 30 | - Subsystem involved: Wi-Fi, BLE, NVS, OTA, filesystem, peripheral, or power. |
| 31 | - Current error code, log tag, panic dump, heap info, or task snapshot. |
| 32 | |
| 33 | ## Debug Workflow |
| 34 | |
| 35 | 1. Reproduce the build and target. |
| 36 | Confirm `IDF_TARGET`, `idf.py set-target`, clean build, flash, and monitor. |
| 37 | |
| 38 | 1. Inspect boot evidence. |
| 39 | Read reset reason, bootloader version, flash parameters, partition table, and |
| 40 | app image selection. |
| 41 | |
| 42 | 1. Verify configuration. |
| 43 | Check `sdkconfig`, Kconfig options, component dependencies, and CMake target |
| 44 | ownership. |
| 45 | |
| 46 | 1. Prove storage and partitions. |
| 47 | For NVS, OTA, SPIFFS, FAT, or custom data, confirm partition labels, sizes, |
| 48 | erase state, and encryption settings. |
| 49 | |
| 50 | 1. Debug subsystem state. |
| 51 | Use ESP-IDF logs, error names, event loops, heap tracing, and task snapshots. |
| 52 | |
| 53 | 1. Handle production constraints. |
| 54 | Treat secure boot, flash encryption, eFuse state, and OTA rollback as |
| 55 | one-way or high-risk changes. |
| 56 | |
| 57 | ## Common Failures |
| 58 | |
| 59 | - Built for one `IDF_TARGET` and flashed to another chip. |
| 60 | - Partition table label or size does not match application assumptions. |
| 61 | - NVS is full, version-incompatible, encrypted unexpectedly, or not erased. |
| 62 | - Wi-Fi/BLE event handling is missing or races initialization. |
| 63 | - Flash mode/frequency is unstable for the module. |
| 64 | - Secure boot or flash encryption is enabled before the recovery path is proven. |
| 65 | |
| 66 | ## Verification |
| 67 | |
| 68 | Before claiming ESP-IDF behavior works: |
| 69 | |
| 70 | - State ESP-IDF version, target, build/flash command, and partition table. |
| 71 | - Confirm boot log, reset reason, flash settings, and app start. |
| 72 | - Confirm subsystem logs and return codes for the exercised path. |
| 73 | - Confirm erase/reflash, OTA, or security implications when relevant. |
| 74 | |
| 75 | ## Example |
| 76 | |
| 77 | User: |
| 78 | |
| 79 | ```text |
| 80 | ESP32 OTA 后启动到旧固件。 |
| 81 | ``` |
| 82 | |
| 83 | Agent: |
| 84 | |
| 85 | 1. Reads bootloader log, partition table, selected app, and OTA state. |
| 86 | 1. Checks image validation, rollback flags, and app confirmation. |
| 87 | 1. Fixes OTA state handling before touching Wi-Fi download code. |