boards/xtensa/esp32s3/esp32s3-xiao: re-enable nxinit, with a working console - #20088
Draft
JianyuWang0623 wants to merge 1 commit into
Draft
boards/xtensa/esp32s3/esp32s3-xiao: re-enable nxinit, with a working console#20088JianyuWang0623 wants to merge 1 commit into
JianyuWang0623 wants to merge 1 commit into
Conversation
…console This restores the entrypoint switch from commit 7cc6707 ("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 <wangjianyu3@xiaomi.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-enables nxinit as the top-level init on esp32s3-xiao (restoring the
entrypoint switch from
7cc6707a76b10cc951f209c09b7f2b6cd228e535,reverted in
76b90e02cbe4967193b620abcb1efb9f6b3f8f5bafter areal-hardware regression report — board hangs, no USB console, on
Seeed XIAO ESP32-S3), this time actually fixing the root cause instead
of just reverting it.
Root cause: the shared
boards/xtensa/esp32s3init.rc starts theinteractive console as a plain
"sh", which, unlikensh_main'snsh_consolemain(), never registers/connects the CDC-ACM gadget thisboard uses as its console (
CONFIG_CDCACM_CONSOLE=y, noCONFIG_DEV_CONSOLE). Restoring the entrypoint switch on its own isnot sufficient — it would just reintroduce the same regression, so
that revert is folded into this change rather than kept as a separate,
individually-broken commit.
Fix, using the
"console"service option added to nxinit by thecompanion apache/nuttx-apps#3776:
init.rc: bring up the console gadget once, unconditionally, beforeany service starts, via
exec -- sercon(apps/system/cdcacmalready implements exactly this and depends on neither nxinit nor
nsh); flag the
"console"service with the newconsoleoption soits stdio is connected to the (now registered) gadget device.
usbnsh/combodefconfigs: addCONFIG_SYSTEM_CDCACM=ysoserconis actually built in. Generatedwith
make savedefconfigagainst both defconfigs (byte-identical tothe committed diff, no manual edits).
Depends on apache/nuttx-apps#3776 (
"console"service option) —without it,
init.rc'sconsoleline would fail to parse.Impact
combo/usbnshdefconfigs: top-level init switchesfrom
nsh_mainto nxinit (init_main), matching every otheresp32s3 board already on nxinit; nsh runs as a console service
started by
init.rcinstead of being init itself.init.rcbehavior changes ("console"option isopt-in per service;
exec -- serconis gated onCONFIG_SYSTEM_CDCACM, which no other esp32s3 board currentlyenables).
Testing
Build-verified:
Verified end to end on real Seeed XIAO ESP32-S3 Sense hardware
(
usbnsh, apps checked out at apache/nuttx-apps#3776). Real physicalreset (
dmesgshows a clean USB disconnect/reconnect, not just asoftware-triggered one):
Serial console over that device:
init_main(nxinit) is PID 2, parent ofsh(PID 4) — confirmingnxinit is genuinely running as top-level init and has successfully
spawned the console service, not just that the board booted.
Also independently reproduced the pre-fix regression on the same
physical board (real hard reset, no
esptool/JTAG involved): withentrypoint=init_mainand the old plain-"sh"init.rc, the board'sUSB device disappears entirely after reset and never re-enumerates —
matching the original bug report exactly.