The simulated UART driver currently opens the host path configured by
CONFIG_SIM_UARTx_NAME directly. This requires the host-side serial endpoint
to exist before NuttX opens the UART, so users and CI jobs need an external
setup step such as socat to create a PTY pair. It also means the host
endpoint path is effectively a build-time choice: changing the host device
path requires changing configuration and rebuilding, which is inconvenient
for tests that allocate a fresh PTY path on each run.
Add CONFIG_SIM_UART_PTY for Linux sim builds. When enabled, non-console
simulated UART ports allocate a host pseudoterminal from /dev/ptmx, put the
host master side in raw mode, and print the host slave path when the NuttX
UART is opened. The NuttX-side device name remains CONFIG_SIM_UARTx_NAME,
for example /dev/ttySIM0, so applications continue to use the normal NuttX
serial API.
Keep the option disabled by default so existing configurations still open
the configured host path directly. Console UART handling is also left on the
existing host-open path.
Also make host_uart_checkin() and host_uart_checkout() check the actual
POLLIN/POLLOUT bits returned by poll(). This avoids treating error-only or
unrelated poll events as readable or writable serial readiness.
The main benefit is simpler and more deterministic simulator integration: a
simulated UART can expose a real host-visible /dev/pts/N endpoint by itself,
without pre-creating a matching host device and without rebuilding NuttX
when the host PTY path changes. This is useful for host-side test scripts
and external protocol tools while keeping application code on the standard
NuttX UART interface.
Companion apps-side test branch:
https://github.com/LingaoM/nuttx-apps/tree/sim_uart_tester
Testing:
Host:
Ubuntu 22.04 x86_64
Board/config:
sim:nsh
Apps test code:
https://github.com/LingaoM/nuttx-apps/tree/sim_uart_tester
Common test configuration:
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_SIM_UART_NUMBER=1
CONFIG_SIM_UART0_NAME="/dev/ttySIM0"
CONFIG_SIM_UART_PTY=y
DMA-mode build and test:
1. Configure sim:nsh with the companion apps tree:
./tools/configure.sh -a ../nuttx-apps sim:nsh
2. Enable the common test configuration above and keep DMA enabled:
CONFIG_SIM_UART_DMA=y
CONFIG_SERIAL_TXDMA=y
CONFIG_SERIAL_RXDMA=y
3. Build:
make clean
make -j16
4. Start NuttX:
./nuttx
5. In NSH, run the hello test app:
nsh> hello
/dev/ttySIM0 connected to pseudotty: /dev/pts/73
6. In another terminal, run the host-side tester from the companion apps
branch with the printed PTY path:
cd ../nuttx-apps
./examples/hello/test_sim_uart_pty.py /dev/pts/73
7. The host-side tester sends 32768 bytes from the host to NuttX and
receives 49152 bytes from NuttX to the host. The payload includes
non-text binary bytes. Both sides validate deterministic payload
contents and checksums, then exchange an ACK.
8. Observed host-side output:
HOST_OPEN: /dev/pts/73
HOST_TX: 32768 bytes checksum=0x1f9989f4
HOST_RX: 49152 bytes checksum=0x06a45c69
HOST_TX: ACK
TEST PASSED
9. Observed NuttX output:
sim_uart_pty_test: binary RX 32768 TX 49152 passed
Non-DMA build and test:
1. Disable DMA for the same sim:nsh configuration:
# CONFIG_SIM_UART_DMA is not set
# CONFIG_SERIAL_TXDMA is not set
# CONFIG_SERIAL_RXDMA is not set
2. Refresh the configuration and rebuild. On this host, the installed
Python olddefconfig shim is broken, so I refreshed Kconfig directly
with kconfig-conf and the same environment that the NuttX Makefile
passes to Kconfig:
APPSDIR=/mnt/ssd/code/code/nuttx-apps \
APPSBINDIR=/mnt/ssd/code/code/nuttx-apps \
BINDIR=/mnt/ssd/code/code/nuttx \
EXTERNALDIR=/mnt/ssd/code/code/nuttx/dummy \
kconfig-conf --olddefconfig Kconfig
make clean
make -j16
3. Repeated the same runtime steps as the DMA test:
./nuttx
nsh> hello
cd ../nuttx-apps
./examples/hello/test_sim_uart_pty.py /dev/pts/73
4. Observed the same successful binary transfer result:
HOST_TX: 32768 bytes checksum=0x1f9989f4
HOST_RX: 49152 bytes checksum=0x06a45c69
HOST_TX: ACK
TEST PASSED
sim_uart_pty_test: binary RX 32768 TX 49152 passed
After the non-DMA test, I restored the default DMA configuration, rebuilt,
and reran the same binary PTY test successfully so the final local build
state was back on CONFIG_SIM_UART_DMA=y.
Assisted-by: Claude:Claude-Fable-5
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Document PBKDF2-HMAC-SHA256 ROMFS passwd generation and update board
Kconfig help text accordingly. Set the documented sim/login CI credential
in GitHub Actions.
Enable CONFIG_CODECS_BASE64 and CONFIG_NETUTILS_CODECS on sim:dropbear for
link compatibility with dropbear's bundled libtomcrypt.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Documents the configuration for the barometer dashboard example, and
explains how to set up a fake barometer to test it.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Describe how to build and use the Dropbear SSH server configuration on
the simulator, including host TAP network setup, user creation and the
volatile /tmp host key/passwd caveat.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Support NUTTX_ROMFS_PASSWD_PASSWORD via update_romfs_password.sh for
configs that enable ROMFS passwd without a defconfig password (sim/login
CI). Enable RANDOMIZE_KEYS in sim/login defconfig. Update mkpasswd.c
header, platform docs, and the mkpasswd_autogen guide.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
It is very easy to get NXDoom running on NuttX, but the instructions
was omitting the needed steps to get it running on Simulator.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Document the new mkpasswd-based password generation system and its
integration with the build process.
Changes:
* Add comprehensive mkpasswd tool documentation to components/tools
* Update SIM board docs to explain generated passwd workflow
* Update ESP32-C3-legacy board docs for passwd generation
* Update RX65N board docs with credential handling guidance
* Document how to configure and use BOARD_ETC_ROMFS_PASSWD_* options
* Explain security benefits of build-time generation vs static files
* Update all doc examples from default username "admin" to "root"
BREAKING CHANGE: Boards using static /etc/passwd files in ETC_ROMFS
must migrate to the new build-time generation workflow documented in
Documentation/components/tools/index.rst. The old static passwd files
are no longer present in migrated boards; boards that relied on them
will fail to build until credentials are configured via Kconfig.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Migrate README.txt about ROMFS to SIM documentation in RST format. Also
cleans up the formatting of the board documentation to leverage RST's
features.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
It is not recommend to just copy defconfig to .config instead of
running ./tools/configure.sh. The configure script will do more
than just copying the defconfig, it will create backup config,
it will check if apps/ dir exists, etc.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.
CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF
Signed-off-by: chao an <anchao.archer@bytedance.com>
We can send and receive data through device files
nuttx: /dev/cdc-wdm2
linux: /dev/cdc-wdm1
The number suffix depends on the actual situation.
And send and receive messages through network cards.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
add a documented description of the cdcncm device module, including
execution steps and associated outputs
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Most developers start learning Nuttx from sim/nsh, but the login experience is very bad,
they don't know where to get the username and password, this commit will remove the
limitation of sim/nsh login, and add sim/login configuration to ensure the feature of
NSH_CONSOLE_LOGIN is verified.
Signed-off-by: chao an <anchao@lixiang.com>
- spi/slave.h: revise comments in pulic types section
- doc/sim.rst: minor formatting, add ways to escape cu
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
- migrated /README are removed from /boards
- there are a lot of READMEs that should be further converted to rst.
At the moment they are moved to Documentation/platforms and included in rst files
Add documentation referring to sim:alsa defconfig, about how to
mount host system files in the simulator using `hostfs` and
playing them using the ALSA adapter.
Added examples of using the RTP Tools (`rtpdump`, in particular)
to receive RTP packets and 1) print the data and/or 2) playback
audio content through I2S.
In order to better test the lcdddev driver and framebuffer, newer
board configs (for the TTGO T-Display and for the simulator) were
added.
Adjusted references of the sim:lvgl_(fb/lcd) config.