Commit graph

9192 commits

Author SHA1 Message Date
fangpeina
be038ce406 system: Add stty utility for terminal control
This commit adds a system utily 'stty' to NuttX, providing a standard
Unix-like interface for configuring terminal (TTY) device settings.
The command allows runtime configuration of termios attributes for
serial ports and other character devices.

Usage examples:

  # Set raw mode on ttyS0 (for binary communication)
  nsh> stty -F /dev/ttyS0 raw -echo

  # Set console mode for interactive terminal
  nsh> stty -F /dev/ttyS0 cooked

  # Display current settings
  nsh> stty -F /dev/ttyS0

  # Configure stdin (if it's a TTY)
  nsh> stty echo icanon

  # Set baudrate (if driver support)
  nsh> stty -F /dev/ttyS1 speed 115200

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-08-14 07:51:00 -03:00
Marco Casaroli
860815a33a testing/ostest: Split the fork test into vfork and fork.
ostest's "vfork" test was never testing vfork().  It has the child write a
global and the parent observe the write -- the defining property of *sharing*,
not of vfork(), whose defining property is that the parent is suspended and
whose contract forbids the child to write anything at all.  It passed because
NuttX implemented fork() and vfork() as the same sharing primitive, which
apache/nuttx#19562 separates.

vfork.c is rewritten to test what vfork() promises.  The child does only what
POSIX permits -- it calls _exit(42) and nothing else, not even exit(), which
would run atexit handlers and flush stdio in the parent's address space.  Since
the child may not write memory and the parent cannot run while the child lives,
the observable is the child's exit status:  had the parent not been suspended,
it would have reached waitpid() while the child was still alive.  Where child
status is not retained -- ostest_main() sets SA_NOCLDWAIT for the whole run,
deliberately -- ECHILD is accepted as equally good evidence, since it says the
child was already gone when the parent asked.

fork.c is new and tests POSIX fork():  the child's writes to .data, .bss and
the heap are invisible to the parent and vice versa, a pointer to a stack local
taken before the fork names the same object in both, and the child does
everything a vfork() child may not -- calls malloc() and printf(), and returns
from the function that called fork().

Both run at the top of user_main().  They exercise the lowest-level machinery
in the suite -- address environments, stack setup, the architecture's register
context -- so a fault in one takes the process down instead of reporting a
failure.  Learning that in seconds rather than after everything else has passed
matters when a port is being brought up.

Each test gates on the one primitive it tests, ARCH_HAVE_VFORK and
ARCH_HAVE_FORK respectively.  There is no compatibility layer and no mapping
between symbols.  vfork.c no longer requires SCHED_WAITPID:  the suspension is
in the kernel primitive now, so the test's core assertion holds without it and
only the status check is conditional.

The simulator is the one exception.  It selects ARCH_HAVE_VFORK, but ostest
takes the sim down as soon as the test runs there, so the call keeps the
!ARCH_SIM guard that apps ee7642793 put on the old test in 2024.  The old gate
hid this:  ARCH_HAVE_FORK is not set on the sim, so the test was not built
there at all.

The other in-tree callers are audited for which primitive they actually meant:

* interpreters/python's _posixsubprocess and netutils/libwebsockets'
  LWS_HAVE_WORKING_VFORK want the fork-then-exec path -- ARCH_HAVE_VFORK.
* python's os.fork() and libwebsockets' LWS_HAVE_FORK mean real fork() and stay
  on ARCH_HAVE_FORK, so they become *absent* rather than silently wrong.
* testing/fs/fdsantest's vfork case follows ARCH_HAVE_VFORK.

interpreters/bas is deliberately left alone.  Its SHELL and EDIT statements
reach for vfork() under an ARCH_HAVE_FORK guard and want the same treatment,
but checkpatch.sh checks the whole of any file a patch touches and
bas_statement.c produces 1681 pre-existing findings against master, so a
one-line change there fails CI on its own.  The consequence is small:
EXAMPLES_BAS_SHELL is EXPERIMENTAL and already depends on ARCH_HAVE_FORK, so it
becomes unselectable rather than misbehaving.

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-14 07:46:54 -03:00
Ricard Rosson
569d8f31db examples/apa102: use fprintf() instead of the kernel _err() macro
_err() is a kernel-internal debug macro from <debug.h>; it resolves to
the kernel-only _err symbol, which an application cannot reference.  In a
flat build the example therefore fails to link:

  apa102_main.c: undefined reference to `_err'

(observed on xtensa/esp32s3).  Report the failure with fprintf(stderr),
which is what the open() error path a few lines above already does.

Signed-off-by: Ricard Rosson <ricard@groundbits.com>
Assisted-by: Claude Opus 5 (Claude Code)
2026-08-11 18:13:21 -03:00
Ricard Rosson
a76f5bab50 examples/apa102: depend on LEDS_APA102, not LCD_APA102
This example drives the APA102 LED-strip character driver: it opens
/dev/leddrv0 and writes an array of struct apa102_ledstrip_s from
<nuttx/leds/apa102.h>, which is provided by drivers/leds/apa102.c
(CONFIG_LEDS_APA102).  CONFIG_LCD_APA102 selects an unrelated driver,
drivers/lcd/apa102.c, which drives an APA102 matrix as a framebuffer LCD
and registers no /dev/leddrvN node at all.

The wrong dependency makes the example unusable either way: with the LED
strip driver enabled the example cannot be selected in menuconfig, and
with CONFIG_LCD_APA102 the dependency is met but the driver the example
needs is absent, so it fails at open().

Signed-off-by: Ricard Rosson <ricard@groundbits.com>
Assisted-by: Claude Opus 5 (Claude Code)
2026-08-11 18:13:21 -03:00
simbit18
3d0d710975 netutils/paho_mqtt: fixed the header file
- fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
9827090fa9 videoutils/x264: fixed the header file
- fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
af029c0e56 testing/drivers/crypto: Fix Kconfig style
- Add TABs

- Fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
e657381610 tee/optee_client: Fix Kconfig style
- Remove spaces from Kconfig

- Add TABs

- Fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
10fef9d916 mlearning/tflite-micro: fixed the header file
- fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
e6e968b706 math: fixed the header file
- fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
3d06069783 games/NXDoom: Fix Kconfig style
- Remove spaces from Kconfig

- Add TABs

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
8e5f3d30d5 examples/smf: Fix Kconfig style
- Remove spaces from Kconfig

- Add TABs

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
simbit18
211f507239 system: Fix Kconfig style
- Remove spaces from Kconfig

- Add TABs

- Fixed the header file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-11 15:38:46 -04:00
dependabot[bot]
fec07a1d14 build(deps): bump actions/github-script from 7 to 9
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 9.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-11 11:21:58 +08:00
wangjianyu3
ab7e0660d5 nshlib/ifconfig: support "ifconfig <iface> up|down"
Previously "ifconfig eth0 up" fell through to the host-IP parsing
branch, where inet_addr("up") returns INADDR_NONE, so the address was
silently set to 255.255.255.255 and the interface was never brought
up.  Users had to run the separate "ifup"/"ifdown" commands.

Recognize the "up" and "down" tokens explicitly and apply them once
the rest of the configuration is in place, so up/down is just another
keyword in the argument list as it is in Linux ifconfig.

A bare "ifconfig <iface> up|down" needs no special case: the preceding
patch made the address, netmask, gateway, DNS and DHCP blocks check
whether they were asked for, so the command falls through them without
touching anything.

The up/down handling calls netlib_ifup()/netlib_ifdown() from netlib, so
it stays available regardless of CONFIG_NSH_DISABLE_IFUPDOWN (which only
strips the standalone ifup/ifdown commands).

Assisted-by: GitHubCopilot:claude-opus-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-08-11 11:21:43 +08:00
wangjianyu3
198b89a81d nshlib/ifconfig: drop the redundant "argc > 2" check
cmd_ifconfig() returns early for argc <= 2, so by the time the argument
loop is reached argc > 2 always holds.  Remove the dead condition and
unindent the loop.

No functional change.

Assisted-by: GitHubCopilot:claude-opus-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-08-11 11:21:43 +08:00
wangjianyu3
a8d55f4a10 nshlib/ifconfig: only apply the settings that were asked for
cmd_ifconfig() pushed every setting to the device on each invocation,
whether or not the command line carried it, and stopped parsing as soon
as it saw "mtu".  So a command meant to touch one thing quietly rewrote
the rest of the interface configuration:

  ifconfig eth0 hw 00:11:22:33:44:55  # clears the address, netmask,
                                      # gateway and resolver, and kicks
                                      # off a DHCP request
  ifconfig eth0 mtu 1500              # same, plus the default route
  ifconfig eth0 mtu 1500 dns 8.8.8.8  # dns silently ignored

In detail:

  - the address was written unconditionally.  For IPv6 that read the
    uninitialized addr6 off the stack and pushed whatever it held into
    the device; for IPv4 it forced 0.0.0.0.
  - the netmask fell back to a hard-coded 255.255.255.0, or to
    ffff:ffff:ffff:ffff:: for IPv6.
  - the IPv4 gateway was always written, unlike the IPv6 one, so it fell
    back to INADDR_ANY.
  - the resolver fell back to that gateway, i.e. to 0.0.0.0.
  - the DHCP client was started whenever gip was left at zero instead of
    when "dhcp" was asked for, and gip only becomes non-zero when an
    address or a gateway is parsed.
  - the "mtu" branch returned as soon as netlib_set_mtu() succeeded, so
    every argument behind it was dropped.

Write each setting only when the user provided it, or when an address
is being assigned and the setting belongs to it.  Keeping the address
case is deliberate: a freshly assigned address still needs a mask and
a route, so dropping the derived netmask and "x.x.x.1" gateway there
would be a regression of its own.  DHCP now triggers on the "dhcp"
keyword, which is the only way to request it.  And with nothing left
to clobber, the "mtu" branch no longer has to bail out early.

This is how ifconfig behaves elsewhere: Linux net-tools walks the
argument vector in a single loop where every keyword handler ends in
"continue" and none of them returns, so each keyword is an independent,
idempotent operation applied in the order it was written.

As a side effect mip is now only read along the paths that assign it,
since the IPv4 gateway fallback only derives an address from mip when
gip came from hostip.

Assisted-by: GitHubCopilot:claude-opus-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-08-11 11:21:43 +08:00
zhangyuan29
413d2ddbc3 testing/libc/arch_libc: Cover unaligned src/dst copy paths.
test_strcpy(), test_strncpy() and test_stpcpy() applied the same offset
to the source and to the destination, so both pointers always shared the
same word congruence.  Architecture optimized copy routines take a
different code path when the two offsets differ: a byte prologue to
align the destination, then either a byte fallback or a shift-merge loop
that recombines two source words per store.  None of that was reached by
the test.

Vary the source and destination offsets independently over 0..7 in those
three tests, so both the equal congruence (aligned word copy) and the
unequal congruence (shift-merge) paths are covered, and report both
offsets on failure so a regression points at the offending combination.

Also drop the ARCH_TOOLCHAIN_GNU dependency from TESTING_ARCH_LIBC.  The
test only uses standard C string functions and perf_gettime(), with no
GNU specific construct, so it builds with non GNU toolchains such as
TASKING as well.

Impact: test only, selected by CONFIG_TESTING_ARCH_LIBC (default n).
Dropping the ARCH_TOOLCHAIN_GNU dependency only widens the set of
toolchains that may select the test, no existing configuration changes.

Testing: built and ran sim:nsh on Linux x86_64 (Ubuntu 24.04,
gcc 13.3.0) with CONFIG_TESTING_ARCH_LIBC=y.  strcpy, strncpy and
stpcpy report PASSED for all 64 offset combinations, and
"arch_libc_test Passed".

Assisted-by: Claude:claude-opus-5
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2026-08-10 16:55:36 -03:00
dengwenqi
7043f96fef testing/libc/arch_libc: Fix out-of-bounds write in memmove test.
The adjacent overlap case in test_memmove() placed the source at a fixed
g_buf1 + align + 64 and the destination one size further, so the
destination tail reached align + 64 + 2 * size.  g_buf1 is only
TEST_BUF_SIZE + MAX_ALIGN (528) bytes, so the larger swept sizes ran off
the end: align=0 with size=255 writes up to offset 573, that is 46 bytes
past the object.  AddressSanitizer aborted arch_libctest with a
global-buffer-overflow.

Start the adjacent layout at g_buf1 + align instead.  The tail then
reaches align + 2 * size, which is at most 7 + 2 * 257 = 521 and stays
inside g_buf1 for every alignment and boundary size that is swept, while
still keeping source and destination exactly adjacent.

Impact: test only, selected by CONFIG_TESTING_ARCH_LIBC (default n).

Testing: built and ran sim:nsh on Linux x86_64 (Ubuntu 24.04,
gcc 13.3.0) with CONFIG_TESTING_ARCH_LIBC=y.  memmove reports PASSED
with no sanitizer report, and "arch_libc_test Passed".

Assisted-by: Claude:claude-opus-5
Signed-off-by: dengwenqi <dengwenqi@xiaomi.com>
2026-08-10 16:55:36 -03:00
anjiahao
0b3049b6ca testing/libc/arch_libc: Add strchrnul test and sweep size boundaries.
Add test_strchrnul() and speed_strchrnul(), selected by the new
CONFIG_TESTING_ARCH_LIBC_STRCHRNUL option, covering the hit, miss and
NUL cases.

Sweep alignment 0..7 and the boundary sizes {0, 1, 7, 8, 9, 15, 16, 17,
31, 32, 33, 63, 64, 65, 127, 128, 129, 255, 256, 257} in the scan
function tests (memcmp, memchr, strlen, strcmp, strchr, strncmp,
strnlen, strrchr) and in memmove.  Those sizes sit on the 8 and 16 byte
chunk edges and on the sub-word tails, so vectorized (NEON/MVE) and
word-at-a-time implementations are stressed exactly at their alignment
and size boundaries instead of only at "nice" lengths.  memmove is
additionally exercised across four overlap layouts: forward, backward,
contained and adjacent.

Impact: test only, selected by CONFIG_TESTING_ARCH_LIBC (default n).

Testing: built and ran qemu-armv7a:nsh (Cortex-A7, generic C
implementation) and sim:nsh on Linux x86_64 (Ubuntu 24.04, gcc 13.3.0)
with CONFIG_TESTING_ARCH_LIBC=y.  All 16 enabled functions report
PASSED and "arch_libc_test Passed".  These tests pass against the
generic C routines, which establishes the correctness baseline before
architecture optimized assembly is introduced.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-08-10 16:55:36 -03:00
Xiang Xiao
ed56c56d7b testing/libc/arch_libc: Add tests for all string/memory functions.
The arch_libc test only covered strcpy, so the architecture optimized
implementations of the remaining string and memory routines were never
exercised by the test suite.

Extend the test to also cover memcpy, memmove, memset, memcmp, memchr,
strlen, strcmp, strchr, strncmp, strnlen, strncpy, stpcpy, strcat and
strrchr:

* Every function gets a correctness test that sweeps the buffer
  alignment and the transfer size and compares the result against the
  expected value.
* Every function gets a speed test that reports the average cycle count
  measured with perf_gettime().
* Every individual test is selected by its own
  CONFIG_TESTING_ARCH_LIBC_<FUNC> option (default y), so a target can
  drop the ones it does not need.

Impact: test only.  Nothing is built unless CONFIG_TESTING_ARCH_LIBC
(default n) is selected, so no existing board configuration changes.

Testing: built and ran sim:nsh on Linux x86_64 (Ubuntu 24.04,
gcc 13.3.0) with CONFIG_TESTING_ARCH_LIBC=y.  All 15 enabled functions
report PASSED and "arch_libc_test Passed".

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-08-10 16:55:36 -03:00
Alan Carvalho de Assis
cc8a6c8b85 cmake: Use NUTTX(_DIR/_BINARY_DIR) instead of CMAKE(_SOURCE_DIR/BINARY_DIR)
This companion change updates the nuttx-apps CMake build to use
NuttX’s NUTTX_DIR and NUTTX_BINARY_DIR instead of CMAKE_SOURCE_DIR
and CMAKE_BINARY_DIR, which incorrectly refer to the outermost project
when NuttX is embedded via add_subdirectory(). Since apps/ is itself
included from NuttX’s top-level CMakeLists.txt, these variables were
effectively being used as references to NuttX’s root and inherited
the same bug fixed in the matching NuttX change for #19697. All
self-referencing uses are replaced while intentionally preserving
standalone projects and unrelated custom variables or hardcoded paths.
The change affects only the CMake build system, preserves normal
standalone behavior, and was tested with sim:nsh both standalone and
embedded, with apps such as hello and ostest successfully built and
available in NSH.

Fixes #19697.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com>
2026-08-09 10:43:01 -03:00
simbit18
680c5ce797 apps/system/adcscope: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-08 16:56:29 -03:00
simbit18
1cda63ad0f apps/tee/optee_client: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-08 16:56:29 -03:00
simbit18
d88aa87e38 apps/interpreters/jimtcl: nxstyle fix Missing file header
- fix Missing file header

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-08 16:56:29 -03:00
simbit18
9ae5f15073 apps/industry/nxmodbus: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-08 16:56:29 -03:00
simbit18
15de50d80c apps/examples/xedge_demo: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-08 16:56:29 -03:00
simbit18
8af42424fa apps/examples/smf: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-08-08 16:56:29 -03:00
Justin Hammond
82c1e7d9be import: Link libnx for graphics applications in a kernel build.
The link line for applications in a kernel build is libmm, libc and the
proxies.  libnx is never named, though the export has been shipping it
all along.  So every application built on NX or NXFONTS fails to link,
the nx examples and fbcon alike, with undefined references to the font
and geometry routines.

Name it, ahead of libc since it calls into it, and only when CONFIG_NX
is set so that configurations without graphics are unaffected.

Tested on an EIC7700 EVB in a kernel build: with this, an application
built on NXFONTS links and runs; without it the same application fails
at link time.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-09 03:18:40 +08:00
Justin Hammond
a65a5372f9 examples/fbcon: Do not require a builtin registry to spawn the shell.
fbcon asked the registry of built-in applications for the stack size and
priority to spawn its shell with.  A kernel build has no such registry:
its programs are ELF files in a filesystem, which is exactly what the
posix_spawn() below already handles, PATH search and all.  The lookup
therefore fails to compile there.

Ask the registry only where there is one, and take the numbers from this
example's own configuration otherwise.

Tested on an EIC7700 EVB in a kernel build: fbcon renders its console on
a 1080p HDMI framebuffer and spawns a shell whose prompt appears on the
monitor.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-09 03:18:28 +08:00
Justin Hammond
30a028d4e6 examples/lvglterm: Let the shell be named something other than nsh.
The terminal spawned "nsh" by a name compiled in, which finds nothing
on a system that installs NSH under another name, as a kernel build
does when NSH is the system's init: the program is /system/bin/init
and no "nsh" exists at all.  The terminal came up,
took keystrokes, and had no shell behind it.

The name is now configurable and still defaults to "nsh", so a bare
name is looked up on PATH as before and a path is taken as given.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-09 03:18:20 +08:00
Junbo Zheng
145e64a5d4 nshlib: boot: guard nsh_getfullpath against NULL argv[1]
A bare `boot` (no argument, argc == 1) passes argv[1] == NULL.
nsh_getfullpath(NULL) returns strdup(g_home) == "/" instead of NULL,
which turned the default-boot path (NULL -> board default image)
into "/".  board_boot_image("/") then failed with -EINVAL (-22),
preventing the board from booting.

Guard the nsh_getfullpath() call so NULL passes through unchanged,
restoring the original default-boot behavior while still resolving
relative paths when an argument is given.

This fixes the regression introduced by the relative-path support
```
commit fabafbc361 (origin/master, origin/HEAD)
Author: Junbo Zheng <zhengjunbo1@xiaomi.com>
Date:   Fri Jul 24 23:47:44 2026 +0800

    nshlib: add relative image path support in boot command

    cmd_boot passed the image path straight to boardctl(), which resolves
    it in a context that does not inherit the NSH shell cwd, so relative
    paths failed and only absolute paths worked. Use nsh_getfullpath() to
    resolve relative paths against the cwd before calling boardctl().

    Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
```

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2026-08-07 21:31:18 +08:00
Marco Casaroli
6e61ce7cb7 examples/fdpicxip, testing/fs/xipfs: A DT_NEEDED library is one instance.
Both the demo and the test asserted that each running instance of a module
gets its own copy of a library named in DT_NEEDED: two instances adding
their own seed each saw a total of seed*3.

That was true of the loader that walked DT_NEEDED itself.  The loader now
hands the work to dlopen(), which returns the object already in the module
registry rather than loading a second copy of it, so there is one library
and one set of its globals, shared by every module that names it.  The
module's own data stays private per instance, because exec() loads the
module afresh each time.

What an instance can still assert on its own is that every add it made
landed in the library, so that is what it checks; the totals interleave and
the final one counts both.  The test additionally checks the consequences:
the library is pinned once rather than once per instance, and its
destructor runs once, at the last close, holding what both instances built
up.

USER_FAIL_PRIVATE becomes USER_FAIL_SHARED rather than gaining a
companion.  The bit is a private protocol between cxxuser.cpp, which sets
it, and testing/fs/xipfs, which reads it; nothing else names it, and the
property it used to report no longer exists.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-07 11:24:32 +08:00
Marco Casaroli
2946d7961b examples/fdpicxip: Follow the fdpic-embed.py rename.
The two helper scripts this Makefile names gained a file extension when
tools/fdpic came into the nuttx tree: checkpatch rejects an executable file
that is not .sh, .py or .bat.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-07 11:24:32 +08:00
Alan Carvalho de Assis
4f5adbd346 system/readline: Fix espace sequence returning to user console
This commit fixes the issue:
https://github.com/apache/nuttx-apps/issues/3680

Signed-off-by: Alan C. Assis <acassis@gmail.com>
Assisted-by: Claude Code
2026-08-06 18:19:31 -03:00
Jorge Guzman
baef9ebf6e wireless/lora_pkt_fwd: add Semtech UDP packet forwarder and lora command
Forward the packets received by a LoRa concentrator to a LoRaWAN network
server with the Semtech UDP protocol version 2, and turn the downlink
requests of the server into transmissions.  The server may be given as a name
and is resolved with getaddrinfo().  No floating point is used anywhere.

The same program provides the "lora" command, which mirrors the AT command
set of the vendor gateway firmwares, plus tx, which sends a single packet and
so brings a gateway up against any LoRa receiver without a network server.

Nothing here names a chip: the types and the commands are the device
independent gateway ones of the nuttx repository,
nuttx/wireless/lpwan/lora_gw.h.  The application depends on LPWAN_LORA_GW,
the symbol such a driver selects, so until one is merged nothing here is
compiled.

Assisted-by: Claude Code 4.8
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-06 13:01:26 -03:00
zhangning21
2aebae7400 ci: Support pull request dependencies via Depends-On.
Allow pull requests targeting master to declare same- and
cross-repository dependencies. Parse declarations with a tested Python
helper, apply exact dependency commits before the existing build matrix,
and rerun heavy CI only when an edited description changes the dependency
state.

Keep fork builds read-only and use a trusted workflow_run to validate
artifacts and post per-build dependency results. Keep the apps workflow
consistent with the implementation already merged in apache/nuttx.

Assisted-by: Kiro:gpt-5.6-sol
Signed-off-by: zhangning21 <zhangning21@xiaomi.com>
2026-08-06 17:22:54 +08:00
raiden00pl
f2e9924b6a testing/ostest: set STACKSIZE for the standalone ELF build
The CMake build passed no STACKSIZE, so kernel-mode ELF loading fell
back to CONFIG_ELF_STACKSIZE, which may exceed the initial user heap.
Use CONFIG_DEFAULT_TASK_STACKSIZE as the Makefile does.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-06 01:39:13 +08:00
Martin Krasula
eea8384ff5 testing/ostest: Add timed mutex timeout regression tests
Verify that a mutex remains reusable after its last waiter times out
and that ownership is transferred when another waiter remains queued.

Signed-off-by: Martin Krasula <mkrasula@elektroline.cz>
2026-08-05 21:52:16 +08:00
renjianguang
3da1f4e94b nxplayer: add tone cmd implementation
Play 20 seconds tone:
    1.nxplayer
    2.nxplayer> device pcm0p
    3.nxplayer> tone 48000 20

Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2026-08-05 12:35:26 +02:00
Jorge Guzman
5a73a6f124 games/NXDoom: drop the assignments left over from dehacked
Six statements assign a variable to itself, which clang rejects:

  src/doom/f_finale.c:637:16: error: explicitly assigning value of
  variable of type 'const char *' to itself [-Werror,-Wself-assign]
    637 |       lumpname = (lumpname);

Chocolate DOOM wraps those strings in DEH_String() so that a dehacked
patch can substitute them. The port has no dehacked support, and the
macro went away with it, leaving the parentheses behind. Two comments
that only described the substitution go as well.

Nothing changes at run time. GCC does not warn about this, so the
configurations built so far never noticed; the ones built with clang
do, and they fail because the CI treats warnings as errors.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-04 12:48:54 +08:00
dependabot[bot]
40c3e33bcb build(deps): bump docker/login-action from 4.5.1 to 4.6.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 4.5.1 to 4.6.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](abd2ef45e7...dbcb813823)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-04 10:38:00 +08:00
Marco Casaroli
d3de432a2c examples/sotest: Check that a library can be opened twice.
dlopen() of an already loaded library used to fail, so nothing exercised
what happens when two callers hold the same object.

Open the library a second time, check the same handle comes back, close
one of the two and check the library is still usable through the other.

Needs the counterpart change in nuttx; without it the second dlopen()
returns NULL and this reports it.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-04 10:37:33 +08:00
Marco Casaroli
f1033082f9 netutils/dropbear, testing/nand_sim: do not use fork() to run in background.
Neither of these wants fork() semantics.  Both reach for fork() only to put
work in the background, and each has a NuttX-native way to do that, so
neither needs a fork primitive at all -- which matters once apache/nuttx#19562
makes ARCH_HAVE_FORK conditional on the architecture implementing POSIX
fork().

netutils/dropbear: the port already routes every fork-then-exec through
vfork(), because sysoptions.h selects DROPBEAR_VFORK when HAVE_FORK is
undefined and the port leaves it undefined.  spawn_command() in dbutil.c and
both call sites in scp.c follow that switch.  The one exception is the
daemon() fallback that compat.c compiles under #ifndef HAVE_DAEMON, which
calls fork() directly and bypasses it.  NuttX provides daemon() in
libs/libc/unistd/lib_daemon.c and declares it in unistd.h, so the fallback is
redundant; define HAVE_DAEMON alongside the HAVE_STRLCAT and HAVE_STRLCPY
entries that are there for exactly the same reason.  The code was unreachable
in any case -- the port hands svr_getopts() an argv containing -F, so
svr_opts.forkbg is always zero and dropbear never calls daemon() at all.

testing/drivers/nand_sim: forked so that the parent could return to the shell
while the child registered the MTD device and slept forever.  Nothing from
before the fork is used after it, so the child is a self-contained entry
point, and task_create() expresses that directly.  The emulator body moves
into nand_sim_daemon() unchanged.  TESTING_NAND_SIM therefore needs no fork
dependency, and the two sim configurations that enable it keep working
whatever ARCH_HAVE_FORK is set to.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-03 09:22:39 -03:00
Marco Casaroli
795ea8d534 testing, system: do not build tests that call fork() where it is absent.
Two places call fork() from code that is compiled unconditionally, which is
fine only for as long as every architecture provides it.  NuttX is splitting
fork() into three primitives -- see apache/nuttx#19562 -- after which
ARCH_HAVE_FORK announces POSIX fork() specifically, and is off until an
architecture implements it.  Both then fail to link.  Each is dropped only
where ARCH_HAVE_FORK is unset, so builds that have fork() are unaffected.

system/libuv: test-fork.c and test-pipe-close-stdout-read-stdin.c are
filtered out of the test-*.c glob.  Nothing is lost even where they are
dropped: every test they define is already excluded from the task list on
NuttX by 0001-libuv-port-for-nuttx.patch, which extends the _WIN32 guards
around them to __NuttX__ -- all nine fork_* entries and
pipe_close_stdout_read_stdin.  They are compiled today but never run.

testing/ltp: the open_posix_testsuite is filtered through LTP's existing
BLACKWORDS mechanism, which already drops tests for absent features and is
already conditioned on configuration symbols.  The pattern spares vfork()
and task_fork().  Where fork() is absent this drops 278 of 1943 test files;
those tests exercise fork() and cannot link without it, and they return per
architecture as fork() lands.

Against today's master this is a no-op: ARCH_HAVE_FORK is set everywhere, so
neither filter drops anything.  It is part of what lets the NuttX side build
against apps master.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-03 09:22:39 -03:00
Jorge Guzman
e59fee53af nshlib, graphics/microwindows: require the keyboard byte stream
Both read a keyboard as a stream of characters:  NSH uses a USB HID
keyboard for stdin, and the raw mode of the Microwindows keyboard driver
decodes the stream with the codec.  That stream now comes from
INPUT_KEYBOARD_BYTESTREAM rather than from the USB HID driver itself.

Say so, so that Kconfig refuses a combination that cannot work instead of
letting the application read events and treat them as text.  No in-tree
configuration selects either option.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-02 18:36:37 +08:00
Jorge Guzman
ece6221edb examples/hidkbd: follow the byte stream option rename
The example gated its decoding on HIDKBD_ENCODED, which no longer
exists: the USB HID keyboard driver reports through the keyboard upper
half now, and what produces the byte stream is
INPUT_KEYBOARD_BYTESTREAM.

Left as it was, the option could never be satisfied and the example
would quietly stop decoding special keys.

Reaching the option again brings hidkbd_decode() back into the build
after a spell of being unreachable, and it uses isprint() without
including ctype.h. That is an error rather than a warning under the
-Werror the CI builds with, in the nine configurations that enable
EXAMPLES_HIDKBD, so add the include here rather than in a later commit.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-02 18:36:37 +08:00
Jorge Guzman
b62cec9eb1 system/kbd: inject keys into a uinput keyboard
Somebody porting a board has to work on the application side before the
keyboard driver exists, and somebody reviewing that work often does not
have the board at hand at all.

With -i the tool goes the other way and writes into a uinput keyboard,
either what it reads from its own stdin or every key of another keyboard.
So an application reading /dev/ukeyboard is driven from the serial
console, or from whatever is on the far end of it, and a real keyboard
and an injected one can drive it at the same time, which neither can do
on its own since an application opens a single device.

Nothing in the application changes:  it is reading a keyboard like any
other, which is the point.

Validated on a Linum STM32H753BI, forwarding a USB HID keyboard and the
serial console into the same virtual keyboard, with the LVGL terminal
reading it.  24 press and release pairs survived the crossing with no
duplicate, no orphan and three keys held at once.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-02 18:36:37 +08:00
Jorge Guzman
47b3f92f9d examples/lvglterm: read any keyboard through one input path
The terminal had three input sources to choose from, and its own help
text explained why:  the physical keyboard options "differ in the data
the keyboard device delivers on read(), so pick the one that matches the
hardware".  That is the abstraction leaking.  A user had to know that
the keyboard was USB rather than a matrix in order to compile the
terminal, and swapping one for the other meant rebuilding.

There are two sources now, touch and physical, and the physical one
reads any keyboard registered with keyboard_register().  Which format
arrives is decided by INPUT_KEYBOARD_BYTESTREAM, a property of the build
rather than of the hardware, so the terminal no longer asks.

Cursor keys reported as special events scroll the terminal, which is
what a driver following the current contract sends.  The out of band
codes that the M5Stack Cardputer reports as ordinary presses are still
honoured, so that board keeps working until its driver is converted.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-02 18:36:37 +08:00
Jorge Guzman
f52bc61adb games/NXDoom: handle the special key events
i_get_event() handled KEYBOARD_PRESS and KEYBOARD_RELEASE and dropped
everything else, so every key reported as KEYBOARD_SPECPRESS went
nowhere.  On the simulator that is already every arrow key, since
sim_keyboard reports them that way:  the game is unplayable and says
nothing about why.

Handle all four types.  A special key carries a value from enum
kbd_keycode_e rather than a character, so it gets its own translation
into doomkeys.h and contributes no printable character to the event.

The map covers what the game binds by default, which now includes Ctrl,
Shift and Alt.  Fire, run and strafe are on the modifiers, so a keyboard
that reports them is the difference between playing and walking around.

Enter needed folding onto KEY_ENTER as well.  A driver reports it as the
character that it produces, which is the line feed, so it never arrived
as KEYCODE_ENTER and never matched the carriage return that the game
binds the menu to.  Confirmed on hardware with a USB keyboard.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2026-08-02 18:36:37 +08:00