This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 0dccf2b289a boards/esp32p4: switch all nsh defconfigs to nxinit
entrypoint
0dccf2b289a is described below
commit 0dccf2b289a0ce757a7b5734c869e36fccfbdc10
Author: wangjianyu3 <[email protected]>
AuthorDate: Wed Aug 26 22:37:55 2026 +0800
boards/esp32p4: switch all nsh defconfigs to nxinit entrypoint
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.
CMake: esp32p4's common/src/CMakeLists.txt currently has no ROMFS/RCSRCS
wiring at all (unlike e.g. esp32c3's nuttx_add_romfs() block), so
rc.sysinit/rcS/init.rc are only shipped via the Make build. This is a
pre-existing gap independent of this change and is left untouched here.
Verified all three defconfigs with:
./tools/configure.sh -l <board>:nsh
make -j$(nproc) CROSSDEV=riscv-none-elf-
using the xPack riscv-none-elf-gcc 14.2.0 toolchain (the local
riscv64-unknown-elf-gcc bare-metal toolchain lacks sys/cdefs.h needed
by esp-hal-3rdparty). All three link cleanly with no errors/warnings;
the built nuttx.bin contains the init.rc-embedded "service console sh"
string, confirming init.rc is picked up by the ROMFS build. Each
defconfig was regenerated with "make savedefconfig" to normalize
field ordering.
esp32p4 has no hardware attached in this session, so this change is
build-verified only; no flash/boot pass was performed.
Assisted-by: opencode/claude-sonnet-5
Signed-off-by: wangjianyu3 <[email protected]>
---
boards/risc-v/esp32p4/common/src/Make.defs | 3 ++
.../risc-v/esp32p4/common/src/etc/init.d/init.rc | 47 ++++++++++++++++++++++
.../configs/nsh/defconfig | 10 ++++-
.../configs/nsh/defconfig | 10 ++++-
.../esp32p4/esp32p4-tab5/configs/nsh/defconfig | 10 ++++-
5 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/boards/risc-v/esp32p4/common/src/Make.defs
b/boards/risc-v/esp32p4/common/src/Make.defs
index f321ba528b6..e1c806c2cfe 100644
--- a/boards/risc-v/esp32p4/common/src/Make.defs
+++ b/boards/risc-v/esp32p4/common/src/Make.defs
@@ -86,6 +86,9 @@ endif
ifeq ($(CONFIG_ETC_ROMFS),y)
RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS
+ifeq ($(CONFIG_SYSTEM_NXINIT),y)
+ RCSRCS += etc/init.d/init.rc
+endif
endif
DEPPATH += --dep-path src
diff --git a/boards/risc-v/esp32p4/common/src/etc/init.d/init.rc
b/boards/risc-v/esp32p4/common/src/etc/init.d/init.rc
new file mode 100644
index 00000000000..91f90547253
--- /dev/null
+++ b/boards/risc-v/esp32p4/common/src/etc/init.d/init.rc
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * boards/risc-v/esp32p4/common/src/etc/init.d/init.rc
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifdef CONFIG_SYSTEM_NSH
+service console sh
+ restart_period 1000
+#endif
+
+#ifdef CONFIG_SYSTEM_ADBD
+service adbd adbd
+#endif
+
+#ifdef CONFIG_SYSTEM_FASTBOOTD
+service fastbootd fastbootd
+#endif
+
+on init
+#ifdef CONFIG_SYSTEM_NSH
+ start console
+#endif
+#ifdef CONFIG_SYSTEM_ADBD
+ start adbd
+#endif
+#ifdef CONFIG_SYSTEM_FASTBOOTD
+ start fastbootd
+#endif
diff --git
a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/nsh/defconfig
b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/nsh/defconfig
index 8d18527fe06..f74b041738b 100644
--- a/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/nsh/defconfig
+++ b/boards/risc-v/esp32p4/esp32p4-function-ev-board/configs/nsh/defconfig
@@ -21,11 +21,15 @@ CONFIG_ARCH_RISCV=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
+CONFIG_ETC_ROMFS=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
-CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INIT_ENTRYPOINT="init_main"
+CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
@@ -36,12 +40,16 @@ CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_CHILD_STATUS=y
+CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_STACKSIZE=8192
+CONFIG_SYSTEM_NXINIT=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y
diff --git
a/boards/risc-v/esp32p4/esp32p4-pico-wifi-wareshare/configs/nsh/defconfig
b/boards/risc-v/esp32p4/esp32p4-pico-wifi-wareshare/configs/nsh/defconfig
index 155b54607ce..2a837505df4 100644
--- a/boards/risc-v/esp32p4/esp32p4-pico-wifi-wareshare/configs/nsh/defconfig
+++ b/boards/risc-v/esp32p4/esp32p4-pico-wifi-wareshare/configs/nsh/defconfig
@@ -24,11 +24,15 @@ CONFIG_BUILTIN=y
CONFIG_ESP32P4_REV_MIN_100=y
CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y
CONFIG_ESPRESSIF_FLASH_32M=y
+CONFIG_ETC_ROMFS=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
-CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INIT_ENTRYPOINT="init_main"
+CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MM_REGIONS=2
@@ -40,12 +44,16 @@ CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_CHILD_STATUS=y
+CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=18
CONFIG_START_MONTH=3
CONFIG_START_YEAR=2026
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_STACKSIZE=8192
+CONFIG_SYSTEM_NXINIT=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig
b/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig
index 6905a5e4f4c..5036bf0f1f7 100644
--- a/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig
+++ b/boards/risc-v/esp32p4/esp32p4-tab5/configs/nsh/defconfig
@@ -32,11 +32,15 @@ CONFIG_ESPRESSIF_I2C0_SCLPIN=32
CONFIG_ESPRESSIF_I2C0_SDAPIN=31
CONFIG_ESPRESSIF_SPIRAM=y
CONFIG_ESPRESSIF_USBSERIAL=y
+CONFIG_ETC_ROMFS=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
-CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INIT_ENTRYPOINT="init_main"
+CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MM_REGIONS=3
@@ -48,6 +52,8 @@ CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
+CONFIG_SCHED_CHILD_STATUS=y
+CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
@@ -55,3 +61,5 @@ CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_STACKSIZE=8192
+CONFIG_SYSTEM_NXINIT=y