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 8bd50d27970 boards/xtensa/esp32s3/esp32s3-xiao: re-enable nxinit, with 
a working console
8bd50d27970 is described below

commit 8bd50d27970f634575caaffe32dc69baba337c51
Author: wangjianyu3 <[email protected]>
AuthorDate: Tue Sep 8 13:43:48 2026 +0800

    boards/xtensa/esp32s3/esp32s3-xiao: re-enable nxinit, with a working console
    
    This restores the entrypoint switch from commit
    7cc6707a76b10cc951f209c09b7f2b6cd228e535 ("boards/esp32s3-xiao: switch
    defconfigs to nxinit entrypoint"), reverted in 76b90e02cbe4967193
    b620abcb1efb9f6b3f8f5b after a real-hardware regression report on
    Seeed XIAO ESP32-S3 (board hangs, no USB console), and fixes the
    actual root cause this time instead of just reverting it.
    
    Root cause: the shared boards/xtensa/esp32s3 init.rc starts the
    interactive console as a plain "sh", which, unlike nsh_main's
    nsh_consolemain(), never registers/connects the CDC-ACM gadget this
    board uses as its console (CONFIG_CDCACM_CONSOLE=y, no
    CONFIG_DEV_CONSOLE). Restoring the previous commit's entrypoint switch
    on its own is therefore not sufficient - it would just reintroduce the
    same regression, so that commit is folded into this one rather than
    kept as a separate, individually broken step.
    
    Fix, using the "console" service option added to nxinit by a companion
    apps change:
    
    - init.rc: bring up the console gadget once, unconditionally, before
      any service starts, via "exec -- sercon" (apps/system/cdcacm already
      implements exactly this and depends on neither nxinit nor nsh); flag
      the "console" service with the new "console" option so its stdio is
      connected to the (now registered) gadget device.
    - esp32s3-xiao's usbnsh/combo defconfigs: add CONFIG_SYSTEM_CDCACM=y so
      sercon is actually built in. Verified with "make savedefconfig"
      against both defconfigs (byte-identical, no manual edits beyond the
      generated diff).
    
    Verified end to end on real Seeed XIAO ESP32-S3 Sense hardware
    (usbnsh): after this change the board enumerates its NuttX CDC-ACM
    gadget on a normal reset and boots to an interactive nsh session
    spawned by nxinit ("ps" shows init_main as PID 2, parent of "sh").
    
    Assisted-by: Kiro:claude-sonnet-5
    Signed-off-by: wangjianyu3 <[email protected]>
---
 boards/xtensa/esp32s3/common/src/etc/init.d/init.rc        |  4 ++++
 boards/xtensa/esp32s3/esp32s3-xiao/configs/combo/defconfig | 14 +++++++++++---
 .../xtensa/esp32s3/esp32s3-xiao/configs/usbnsh/defconfig   | 14 +++++++++++---
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/boards/xtensa/esp32s3/common/src/etc/init.d/init.rc 
b/boards/xtensa/esp32s3/common/src/etc/init.d/init.rc
index 44d885ea956..d3409b16fae 100644
--- a/boards/xtensa/esp32s3/common/src/etc/init.d/init.rc
+++ b/boards/xtensa/esp32s3/common/src/etc/init.d/init.rc
@@ -24,6 +24,7 @@
 
 #ifdef CONFIG_SYSTEM_NSH
 service console sh
+   console
    restart_period 1000
 #endif
 
@@ -36,6 +37,9 @@ service fastbootd fastbootd
 #endif
 
 on init
+#ifdef CONFIG_SYSTEM_CDCACM
+   exec -- sercon
+#endif
 #ifdef CONFIG_SYSTEM_NSH
    start console
 #endif
diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/configs/combo/defconfig 
b/boards/xtensa/esp32s3/esp32s3-xiao/configs/combo/defconfig
index b41c3015748..5c77a2a5cfc 100644
--- a/boards/xtensa/esp32s3/esp32s3-xiao/configs/combo/defconfig
+++ b/boards/xtensa/esp32s3/esp32s3-xiao/configs/combo/defconfig
@@ -22,7 +22,6 @@ CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
 CONFIG_ARCH_NUSER_INTERRUPTS=2
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARCH_XTENSA=y
-CONFIG_BOARDCTL_USBDEVCTRL=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
 CONFIG_CDCACM=y
@@ -33,15 +32,19 @@ CONFIG_DEV_GPIO=y
 CONFIG_ESP32S3_GPIO_IRQ=y
 CONFIG_ESP32S3_OTG=y
 CONFIG_ESP32S3_UART0=y
+CONFIG_ETC_ROMFS=y
 CONFIG_EXAMPLES_GPIO=y
 CONFIG_EXAMPLES_LEDS=y
+CONFIG_EXPERIMENTAL=y
 CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_IDLETHREAD_STACKSIZE=3072
-CONFIG_INIT_ENTRYPOINT="nsh_main"
-CONFIG_INIT_STACKSIZE=4096
+CONFIG_INIT_ENTRYPOINT="init_main"
+CONFIG_INIT_STACKSIZE=8192
 CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_EXECFUNCS=y
 CONFIG_LINE_MAX=64
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
@@ -50,11 +53,16 @@ CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=114688
 CONFIG_RAM_START=0x20000000
 CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_CHILD_STATUS=y
+CONFIG_SCHED_HAVE_PARENT=y
 CONFIG_SCHED_WAITPID=y
 CONFIG_START_DAY=6
 CONFIG_START_MONTH=12
 CONFIG_START_YEAR=2011
 CONFIG_SYSLOG_BUFFER=y
+CONFIG_SYSTEM_CDCACM=y
 CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_STACKSIZE=8192
+CONFIG_SYSTEM_NXINIT=y
 CONFIG_USERLED=y
 CONFIG_USERLED_LOWER=y
diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/configs/usbnsh/defconfig 
b/boards/xtensa/esp32s3/esp32s3-xiao/configs/usbnsh/defconfig
index f631e45164f..c32c97e7bb3 100644
--- a/boards/xtensa/esp32s3/esp32s3-xiao/configs/usbnsh/defconfig
+++ b/boards/xtensa/esp32s3/esp32s3-xiao/configs/usbnsh/defconfig
@@ -21,7 +21,6 @@ CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
 CONFIG_ARCH_NUSER_INTERRUPTS=2
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARCH_XTENSA=y
-CONFIG_BOARDCTL_USBDEVCTRL=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
 CONFIG_CDCACM=y
@@ -30,13 +29,17 @@ CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_ESP32S3_OTG=y
 CONFIG_ESP32S3_UART0=y
+CONFIG_ETC_ROMFS=y
+CONFIG_EXPERIMENTAL=y
 CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_IDLETHREAD_STACKSIZE=3072
-CONFIG_INIT_ENTRYPOINT="nsh_main"
-CONFIG_INIT_STACKSIZE=4096
+CONFIG_INIT_ENTRYPOINT="init_main"
+CONFIG_INIT_STACKSIZE=8192
 CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_EXECFUNCS=y
 CONFIG_LINE_MAX=64
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
@@ -45,9 +48,14 @@ CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=114688
 CONFIG_RAM_START=0x20000000
 CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_CHILD_STATUS=y
+CONFIG_SCHED_HAVE_PARENT=y
 CONFIG_SCHED_WAITPID=y
 CONFIG_START_DAY=6
 CONFIG_START_MONTH=12
 CONFIG_START_YEAR=2011
 CONFIG_SYSLOG_BUFFER=y
+CONFIG_SYSTEM_CDCACM=y
 CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_STACKSIZE=8192
+CONFIG_SYSTEM_NXINIT=y

Reply via email to