Skip to content

boards/lckfb-szpi-esp32s3: switch all defconfigs to nxinit entrypoint - #19946

Merged
acassis merged 1 commit into
apache:masterfrom
JianyuWang0623:lckfb-esp32s3-nsh-to-init
Aug 25, 2026
Merged

boards/lckfb-szpi-esp32s3: switch all defconfigs to nxinit entrypoint#19946
acassis merged 1 commit into
apache:masterfrom
JianyuWang0623:lckfb-esp32s3-nsh-to-init

Conversation

@JianyuWang0623

Copy link
Copy Markdown
Contributor

Summary

  • The adb and txtable defconfigs already ran nxinit (init_main) as system init instead of nsh_main (see 73c949c). This switches the remaining 17 lckfb-szpi-esp32s3 defconfigs (camera, es7210, fastboot, fastboot_tcp, gc0308, gpio, lcd, lvgl, nsh, pca9557, psram, pwm, qmi8658, sdmmc, usb_device, uvc, vncviewer) to the same entrypoint, for consistency across the whole board.
  • For each defconfig: CONFIG_INIT_ENTRYPOINT switched to "init_main". The default init and nsh stacks overflow at runtime on this target: init_main overflows a smaller stack (observed near-100% usage with a corrupted task name), clobbering the global inode/mount tree so the procfs mount installed by board bringup disappears; "ls /" then crashes in read_pseudodir and "ps" reports "/proc not mounted"; the nsh console service also crashes in getumask while running "ps" because its stack is too small to reach the procfs read path. CONFIG_INIT_STACKSIZE and CONFIG_SYSTEM_NSH_STACKSIZE are both raised to 8192 to fix this. CONFIG_SYSTEM_NXINIT=y is added with its Kconfig dependencies (EXPERIMENTAL, LIBC_EXECFUNCS, SCHED_CHILD_STATUS -> SCHED_HAVE_PARENT), and missing ETC_ROMFS/FS_ROMFS are added where needed to ship init.rc.
  • nsh keeps running, just as a console service started by init.rc (boards/xtensa/esp32s3/common/src/etc/init.d/init.rc) instead of the top-level init, same as the existing adb/txtable configs.

Impact

  • Affects only lckfb-szpi-esp32s3 board defconfigs. No change to shared arch/board source, no ABI/API changes. Slightly higher init/nsh stack usage (8192 bytes each) on this board only.

Testing

Build Host: Linux x86_64, xtensa-esp32s3-elf-gcc 12.2.0 (ESP-IDF toolchain)
Target: esp32s3 / lckfb-szpi-esp32s3 (all 20 configs)

All 20 defconfigs (adb, camera, es7210, fastboot, fastboot_tcp, fastboot_usb, gc0308, gpio, lcd, lvgl, nsh, pca9557, psram, pwm, qmi8658, sdmmc, txtable, usb_device, uvc, vncviewer) build cleanly with make. tools/checkpatch.sh passes on the diff.

Flashed nsh and es7210 to real hardware (lckfb-szpi-esp32s3, MAC a0:85:e3:f4:43:30) and captured actual runtime output:

nsh config — flash log:

esptool.py v4.8.1
Serial port /dev/ttyUSB0
Chip is ESP32-S3 (QFN56) (revision v0.2)
MAC: a0:85:e3:f4:43:30
Configuring flash size...
Auto-detected Flash size: 16MB
Flash will be erased from 0x00000000 to 0x00033fff...
Compressed 212196 bytes to 105049...
Wrote 212196 bytes (105049 compressed) at 0x00000000 in 2.1 seconds
Hash of data verified.
Hard resetting via RTS pin...

nsh config — serial console after reset (UART0, 115200 8N1):

nsh> ps
  TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK COMMAND
    0     0     0   0 FIFO     Kthread   - Ready              0000000000000000 0003040 Idle_Task
    2     2     0 100 RR       Task      - Waiting  Semaphore 0000000000000000 0008120 init_main
    3     3     2 100 RR       Task      - Running            0000000000000000 0008144 sh

init_main (PID 2) is running as the root init and is the parent of the nsh console service sh (PID 3), confirming nxinit is in control of the boot sequence.

es7210 config — flash log:

esptool.py v4.8.1
Serial port /dev/ttyUSB0
Chip is ESP32-S3 (QFN56) (revision v0.2)
MAC: a0:85:e3:f4:43:30
Auto-detected Flash size: 16MB
Flash will be erased from 0x00000000 to 0x00045fff...
Compressed 286432 bytes to 172360...
Wrote 286432 bytes (172360 compressed) at 0x00000000 in 3.0 seconds
Hash of data verified.
Hard resetting via RTS pin...

es7210 config — via adb after reset:

$ adb -s 1234 shell uname -a
NuttX 13.0.1-RC0 73ad366f45c Aug 24 2026 14:46:29 xtensa lckfb-szpi-esp32s3

$ adb -s 1234 shell ps
  TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK             STACK    USED FILLED COMMAND
    0     0     0   0 FIFO     Kthread   - Ready              0000000000000000  0002992 0000848  28.3%  Idle_Task
    1     0     0 224 RR       Kthread   - Waiting  Semaphore 0000000000000000  0008056 0000976  12.1%  hpwork
    2     0     0 100 RR       Kthread   - Waiting  Semaphore 0000000000000000  0008064 0000624   7.7%  lpwork
    4     4     0 100 RR       Task      - Waiting  Semaphore 0000000000000000  0008080 0005632  69.7%  init_main
    5     5     4 100 RR       Task      - Waiting  Semaphore 0000000000000000  0008096 0001184  14.6%  sh
    6     6     4 100 RR       Task      - Ready              0000000000000000  0008088 0001088  13.4%  adbd
    8     8     6 100 RR       Task      - Running            0000000000000000  0008080 0002432  30.0%  sh -c ps

init_main (PID 4) is the parent of both the console sh (PID 5) and adbd (PID 6), matching init.rc's on init service list (console, adbd).

The remaining 15 changed defconfigs (camera, fastboot, fastboot_tcp, gc0308, gpio, lcd, lvgl, pca9557, psram, pwm, qmi8658, sdmmc, usb_device, uvc, vncviewer) were build-verified only in this pass (not flashed/run on hardware — no dedicated peripherals like camera/LCD/touch were wired up for each one).

@JianyuWang0623
JianyuWang0623 marked this pull request as ready for review August 24, 2026 09:02
@github-actions github-actions Bot added Size: M The size of the change in this PR is medium Board: xtensa labels Aug 24, 2026
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@JianyuWang0623

Copy link
Copy Markdown
Contributor Author

wait for fix in apache/nuttx-apps#3733

Switch all lckfb-szpi-esp32s3 defconfigs from nsh_main to nxinit
(init_main) as the system init entry point, for consistency across
the whole board (adb and txtable already used nxinit, see
73c949c).

For each defconfig (adb, camera, es7210, fastboot, fastboot_tcp,
gc0308, gpio, lcd, lvgl, nsh, pca9557, psram, pwm, qmi8658, sdmmc,
usb_device, uvc, vncviewer):

- CONFIG_INIT_ENTRYPOINT="nsh_main" -> "init_main"
- CONFIG_INIT_STACKSIZE raised to 8192. The default init and nsh
  stacks overflow at runtime on this target: init_main overflows a
  smaller stack (observed 100% usage with a corrupted task name),
  clobbering the global inode/mount tree so the procfs mount
  installed by board bringup disappears; "ls /" then crashes in
  read_pseudodir and "ps" reports "/proc not mounted". Raising
  CONFIG_INIT_STACKSIZE to 8192 drops init_main to about 61% usage
  on hardware, and /proc stays mounted.
- CONFIG_SYSTEM_NXINIT=y added, plus its direct Kconfig dependencies
  (CONFIG_EXPERIMENTAL, CONFIG_LIBC_EXECFUNCS, CONFIG_SCHED_CHILD_STATUS
  which in turn selects CONFIG_SCHED_HAVE_PARENT)
- CONFIG_SYSTEM_NSH_STACKSIZE=8192 added: the nsh console service
  launched by init.rc also needs a larger stack, otherwise it
  crashes in getumask while running "ps" because its stack is too
  small to reach the procfs read path.
- ETC_ROMFS/FS_ROMFS added where missing, needed to ship init.rc via
  the board's ROMFS

nsh continues to run as a console service started by init.rc
(boards/xtensa/esp32s3/common/src/etc/init.d/init.rc), not as the
top-level init, matching the adb/txtable configs.

Verified all 20 defconfigs (adb, camera, es7210, fastboot,
fastboot_tcp, fastboot_usb, gc0308, gpio, lcd, lvgl, nsh, pca9557,
psram, pwm, qmi8658, sdmmc, txtable, usb_device, uvc, vncviewer) build
cleanly with `make`. Flashed nsh and es7210 to hardware:
- nsh: UART0 console reachable, "ps" shows init_main (PID 2) as the
  parent of nsh's "sh" (PID 3).
- es7210: adb reachable, "ps" shows init_main (PID 4) as the parent of
  both "sh" (PID 5) and "adbd" (PID 6).

Assisted-by: Kiro:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
@JianyuWang0623
JianyuWang0623 force-pushed the lckfb-esp32s3-nsh-to-init branch from 73ad366 to 35b6524 Compare August 25, 2026 08:54
@acassis
acassis merged commit 021a113 into apache:master Aug 25, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Board: xtensa Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants