JianyuWang0623 opened a new pull request, #19979: URL: https://github.com/apache/nuttx/pull/19979
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Switch all three esp32p4 boards' `nsh` defconfigs (esp32p4-function-ev-board, esp32p4-pico-wifi-wareshare, esp32p4-tab5) from `nsh_main` to nxinit (`init_main`) as the system init entry point, matching the esp32s3 boards' existing nxinit configs for consistency across Espressif boards. - Add `boards/risc-v/esp32p4/common/src/etc/init.d/init.rc`, copied from the esp32s3 common version: registers a "console sh" service (nsh) guarded by `CONFIG_SYSTEM_NSH`, plus adbd/fastbootd service stubs guarded by their own Kconfig symbols for future reuse; "on init" starts whichever services are enabled. - `boards/risc-v/esp32p4/common/src/Make.defs`: ship `init.rc` via ROMFS (`RCSRCS`) when `CONFIG_SYSTEM_NXINIT=y`, alongside the existing rc.sysinit/rcS, mirroring esp32s3's Make.defs. - Per board defconfig: - `CONFIG_INIT_ENTRYPOINT` switched to `"init_main"` - `CONFIG_INIT_STACKSIZE=8192` (was unset/2048 default), matching the value already used and measured on esp32s3 boards for the nxinit init task running console-sh (and up to two services) - `CONFIG_SYSTEM_NXINIT=y` added, plus its direct Kconfig dependencies: `CONFIG_LIBC_EXECFUNCS`, `CONFIG_SCHED_CHILD_STATUS` (which depends on `CONFIG_SCHED_HAVE_PARENT`); `CONFIG_EXPERIMENTAL` was already set on all three boards - `CONFIG_SYSTEM_NSH_STACKSIZE=8192` added: nsh now runs as a service spawned by init.rc instead of being init itself, so it needs its own stack instead of borrowing the init stack - `CONFIG_ETC_ROMFS`/`CONFIG_FS_ROMFS` added, needed to ship init.rc via the board's ROMFS nsh continues to run as a console service started by init.rc (`boards/risc-v/esp32p4/common/src/etc/init.d/init.rc`), not as the top-level init. ## Impact - Affects only the three esp32p4 boards' `nsh` defconfigs; no change to other boards or to the nxinit/apps code itself. - Boot behavior changes: init entry point is now nxinit instead of nsh directly, but the end-user-visible nsh console experience is unchanged (still starts automatically and behaves the same once running). - **CMake gap (pre-existing, not introduced by this PR)**: esp32p4's `boards/risc-v/esp32p4/common/src/CMakeLists.txt` currently has no ROMFS/`RCSRCS`/`nuttx_add_romfs()` wiring at all (unlike e.g. esp32c3's common CMakeLists.txt), so `rc.sysinit`/`rcS`/`init.rc` are only shipped via the Make build path. This gap predates this change and is left untouched here; only the Make build path is verified/affected. - No security, compatibility, or documentation impact beyond the boot flow described above. ## Testing Host: Ubuntu Linux, toolchain xPack `riscv-none-elf-gcc` 14.2.0 (`riscv64-unknown-elf-gcc` bare-metal toolchain lacks `sys/cdefs.h` needed by esp-hal-3rdparty, so `CROSSDEV=riscv-none-elf-` was used explicitly). All three boards configured and built: ``` ./tools/configure.sh -l <board>:nsh make -j$(nproc) CROSSDEV=riscv-none-elf- ``` All three link cleanly with no errors/warnings. Each defconfig was regenerated with `make savedefconfig` to normalize field ordering. ### Hardware verification (esp32p4-pico-wifi-wareshare) Flashed to a real Waveshare ESP32-P4 board (chip: ESP32-P4 rev v1.3, MAC `80:f1:b2:d0:84:c4`) via: ``` make flash ESPTOOL_PORT=/dev/serial/by-id/usb-1a86_USB_Single_Serial_5ABA078172-if00 ``` Serial console log confirms clean boot into nsh via nxinit: ``` *** Booting NuttX *** ... nsh> ``` `ps` output shows nxinit (`init_main`) as PID 2 (init task) with `sh` (PID 3) running as its spawned child, confirming nxinit is driving the boot instead of nsh being the top-level init: ``` TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND 0 0 0 0 FIFO Kthread - Ready 0000000000000000 0002016 Idle_Task 2 2 0 100 RR Task - Waiting Semaphore 0000000000000000 0008120 init_main 3 3 2 100 RR Task - Running 0000000000000000 0008144 sh ``` `uname -a` confirms the running firmware matches this branch's commit: ``` NuttX 13.0.1-RC0 c7fe77b8b61 Aug 26 2026 23:03:21 risc-v esp32p4-pico-wifi-wareshare ``` ### Not verified on real hardware `esp32p4-function-ev-board` and `esp32p4-tab5` were build-verified only (no matching hardware available in this session); only `esp32p4-pico-wifi-wareshare` was flash/boot verified. The three boards' nsh defconfig diffs are structurally identical (same nxinit-related Kconfig additions), so the boot behavior is expected to be the same, but this has not been confirmed on the EV Board or Tab5 hardware. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
