Dual-board IDF v5.4 layout with board components, motor EN safe state on WROOM, TWDT left enabled. Local idf.py verify blocked: no IDF_PATH or espressif/idf:v5.4 image in this environment.
134 lines
3.5 KiB
Markdown
134 lines
3.5 KiB
Markdown
# P01 — IDF dual-board skeleton
|
|
|
|
STATUS: BLOCKED
|
|
BLOCKED: no IDF (IDF_PATH unset; no idf.py; no docker.io/espressif/idf:v5.4). Sources landed; builds not run; no binaries faked.
|
|
DEPENDS: P00
|
|
READ: `AGENTS.md`, `docs/megaplans/REFACTOR-MEGAPLAN.md`, this file
|
|
OUT: recipes, UI, motor, Arduino-as-component, Gitea workflow, touching `src/` behaviour
|
|
FORBIDDEN: `esp_task_wdt_deinit`, Arduino `#include`, new libraries, changing recipe files
|
|
|
|
## IN
|
|
|
|
Create a compileable ESP-IDF v5.4 app for two boards. App: init GPIO motor-EN as disabled (HIGH), log board name, idle loop `vTaskDelay`, TWDT on. No LCD yet.
|
|
|
|
## FILES (create)
|
|
|
|
```
|
|
CMakeLists.txt
|
|
main/CMakeLists.txt
|
|
main/idf_component.yml # empty dependencies: {} (no Arduino yet)
|
|
main/main.c
|
|
components/board_wroom/CMakeLists.txt
|
|
components/board_wroom/include/board.h
|
|
components/board_wroom/board.c
|
|
components/board_jc4827w543/CMakeLists.txt
|
|
components/board_jc4827w543/include/board.h
|
|
components/board_jc4827w543/board.c
|
|
sdkconfig.defaults
|
|
sdkconfig.wroom
|
|
sdkconfig.s3
|
|
```
|
|
|
|
Edit `.gitignore` append:
|
|
|
|
```
|
|
build/
|
|
sdkconfig
|
|
sdkconfig.old
|
|
managed_components/
|
|
dependencies.lock
|
|
```
|
|
|
|
Do not delete `platformio.ini` / `src/` / `include/`.
|
|
|
|
## Board CMake
|
|
|
|
Exactly one board component is compiled.
|
|
|
|
`main/CMakeLists.txt`:
|
|
|
|
```
|
|
if(NOT DEFINED AUTOFILM_BOARD)
|
|
set(AUTOFILM_BOARD wroom CACHE STRING "wroom|jc4827w543")
|
|
endif()
|
|
if(AUTOFILM_BOARD STREQUAL "wroom")
|
|
set(BOARD_COMP board_wroom)
|
|
elseif(AUTOFILM_BOARD STREQUAL "jc4827w543")
|
|
set(BOARD_COMP board_jc4827w543)
|
|
else()
|
|
message(FATAL_ERROR "AUTOFILM_BOARD=${AUTOFILM_BOARD}")
|
|
endif()
|
|
idf_component_register(SRCS "main.c" INCLUDE_DIRS "." REQUIRES ${BOARD_COMP} driver)
|
|
```
|
|
|
|
Both `board.h` **identical API**:
|
|
|
|
```c
|
|
#pragma once
|
|
#include "driver/gpio.h"
|
|
const char *board_name(void);
|
|
gpio_num_t board_pin_motor_en(void); /* WROOM: 27. S3: GPIO_NUM_NC until P07 maps real spare IO */
|
|
int board_motor_en_disable_level(void); /* 1 = HIGH means disabled */
|
|
```
|
|
|
|
`board_wroom`: `name="wroom"`, EN=27, disable_level=1.
|
|
`board_jc4827w543`: `name="jc4827w543"`, EN=`GPIO_NUM_NC`, disable_level=1. If EN is NC, `main.c` skips gpio config.
|
|
|
|
## main.c contract
|
|
|
|
- `ESP_LOGI("app", "board=%s", board_name());`
|
|
- if EN valid: `gpio_set_direction`, `gpio_set_level(pin, disable_level)` **before** any other actuator
|
|
- do **not** call `disableWatchdogTimers` or `esp_task_wdt_deinit`
|
|
- loop: `vTaskDelay(pdMS_TO_TICKS(1000))`
|
|
|
|
## sdkconfig (minimal)
|
|
|
|
`sdkconfig.defaults`:
|
|
|
|
```
|
|
CONFIG_ESP_TASK_WDT_EN=y
|
|
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10
|
|
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
|
```
|
|
|
|
`sdkconfig.wroom`:
|
|
|
|
```
|
|
CONFIG_IDF_TARGET="esp32"
|
|
```
|
|
|
|
`sdkconfig.s3`:
|
|
|
|
```
|
|
CONFIG_IDF_TARGET="esp32s3"
|
|
CONFIG_SPIRAM=y
|
|
CONFIG_SPIRAM_MODE_OCT=y
|
|
CONFIG_SPIRAM_SPEED_80M=y
|
|
```
|
|
|
|
If a Kconfig name fails on v5.4, fix to the v5.4 equivalent; do not drop PSRAM on S3.
|
|
|
|
## VERIFY
|
|
|
|
Need `IDF_PATH` or docker `espressif/idf:v5.4`.
|
|
|
|
```
|
|
idf.py -B /tmp/af-wroom -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.wroom" -D AUTOFILM_BOARD=wroom set-target esp32 build
|
|
idf.py -B /tmp/af-s3 -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.s3" -D AUTOFILM_BOARD=jc4827w543 set-target esp32s3 build
|
|
```
|
|
|
|
Pass = both exit 0. If no IDF in environment: document `BLOCKED: no IDF` and still land the files; do not fake binaries.
|
|
|
|
## COMMITS
|
|
|
|
1. `Add ESP-IDF skeleton for wroom and jc4827w543 boards`
|
|
2. (if needed) `Ignore IDF build products`
|
|
|
|
## DoD
|
|
|
|
- [ ] Both CMake board comps export the same `board.h` API
|
|
- [ ] Motor EN disabled at boot on wroom
|
|
- [ ] TWDT not disabled
|
|
- [ ] Legacy Arduino tree untouched
|
|
- [ ] STATUS→DONE
|