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>
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>
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>
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>
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>
The hidkbd and keyboard examples do the same thing for one kind of
keyboard each: hidkbd reads a USB HID keyboard as a byte stream, and
keyboard reads an upper half keyboard as events. Neither works with the
other, so bringing up a new keyboard means picking the right example
first, and there is no answer for somebody whose keyboard is neither.
Every keyboard registered with keyboard_register() is read the same way,
so one tool covers them all: USB HID, matrix, simulator, virtio, VNC.
The payload follows INPUT_KEYBOARD_BYTESTREAM rather than a switch of
its own. An application has no business knowing what hardware is behind
the device, and a build cannot mix the two formats anyway.
The two examples stay for now. They are what the in-tree configurations
still name, and removing them has to wait until those configurations
have been moved over.
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
The bundled encoder was checked out from lame's trunk with no revision, so
every build took whatever trunk happened to be at that moment. lame's trunk
grows vector tiers over time, and each one adds sources that the two build
files have to name: r6655 offered AVX2 to the vector routines on 2026-07-25,
and r6718 and r6720 added an AVX-512 tier on 2026-07-30. The AVX-512 sources
were never listed, so sim:alsa stopped linking on x86 hosts:
takehiro.c:332: undefined reference to `quantize_lines_xrpow_avx512'
takehiro.c:533: undefined reference to `ix_max_avx512'
takehiro.c:569: undefined reference to `count_bit_esc_avx512'
vbrquantize.c:261: undefined reference to `calc_sfb_noise_x34_avx512'
Pin the checkout to r6720 through a LAME_VERSION variable, as the rest of
apps/ pins its third-party sources, and list the three AVX-512 files that
revision provides. The pin is what keeps the two in step: the source list is
maintained by hand, so it can only be correct for a known revision.
The checkout is also only performed when lame/configure is absent and is never
updated afterwards, so before this an unpinned tree was frozen at whatever
trunk was on the day it was first built. Anyone who checked out before
2026-07-30 still links and cannot reproduce the failure, which is why this
surfaced only in CI.
Makefile named just vector/xmm_quantize_sub.c and none of the other vector
sources, so a Make build on an x86 host fails the same way with a longer list
of symbols, from SSE2 upwards. CI builds sim:alsa through CMake only, so that
half was latent rather than visible. Both files now list the same nine
sources under the same host condition.
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds two sections to the xipfs suite, guarded by CONFIG_FDPIC so a build
without the loader is unaffected. They belong here rather than in their own
test because what they exercise is modules loaded *out of the filesystem* --
the pin, the in-place mapping and the loader are one path.
'fdpic' asserts on the loader properties that otherwise fail *quietly*: a
loader that skips DT_INIT_ARRAY runs a C++ module happily with every global
left zero, one that skips DT_JMPREL loads a module that hard-faults only
once it calls out, and one that mis-sizes the descriptor pool corrupts the
heap. None of those announce themselves. The module exit status is the
channel -- each module checks its own invariants and reports a bitmask. It
also covers shared libraries across concurrent instances, per-instance data,
the leaf-library GOT fallback, the R_ARM_FUNCDESC descriptor pool, and every
firmware entry point that has to resolve a module callback, including
mq_notify and timer_create with SIGEV_THREAD.
'reject' mutates a known-good module byte by byte and asserts the loader
refuses it rather than loading something broken: a missing import, and more
DT_NEEDED entries than the walk will follow.
The modules are embedded as headers, for the same reason as in
examples/fdpicxip, and built for cortex-m3 for the same reason: one set of
blobs then runs on both the v7-M and v8-M targets. Their sources and the
makefile that regenerates these headers live in
apps/examples/fdpicxip/modules, so the copies the two apps carry are built
from the same sources in the same way.
Verified on a Pimoroni Pico Plus 2: fdpic 33/33, reject 7/7, and the whole
suite 130/130 with them included. The same three numbers on mps2-an500 under
QEMU, which is a Cortex-M7 rather than the RP2350's Cortex-M33.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
The FDPIC counterpart of examples/nxflatxip, kept separate from it: that
example is about NXFLAT, and mixing the two module formats into one program
would leave neither demonstrating anything clearly.
Four subcommands, each showing one property of the loader. 'qsort' is the
simplest case it has -- one self-contained module, two concurrent instances,
one shared copy of the text in flash and a private copy of the data each,
with the pin count showing the extent held in place while they run and
released after. 'solib' adds a shared library, so two objects are mapped
and each instance still gets its own copy of both objects' data. 'cxx' is
the same in C++, which additionally requires global constructors to have run
in dependency order before main. 'jmprel' is a module whose imports are all
in DT_JMPREL rather than DT_REL.
The modules are embedded as headers rather than built as part of the app:
linking one needs arm-uclinuxfdpiceabi binutils, which the tree does not
require, so the headers are committed and both this example and
testing/fs/xipfs build with a plain toolchain.
Their sources are in modules/, with a makefile that rebuilds every header
from them on an explicit 'make regen NUTTX_DIR=...' and is never invoked by
the application build. It drives nuttx/tools/fdpic and writes the headers
this example needs alongside the ones testing/fs/xipfs needs, so one source
tree serves both and the two cannot drift apart. CPU is cortex-m3 there
deliberately: a v7-M module runs on the v8-M targets too, so one set of blobs
serves both the RP2350 and mps2-an500, while a cortex-m33 build produces
blobs the Cortex-M7 cannot execute at all.
This demonstrates; it does not assert. The assertions are in the fdpic and
reject sections of apps/testing/fs/xipfs.
Verified on a Pimoroni Pico Plus 2: all four subcommands, and nxflatxip
unaffected alongside them. Also verified on mps2-an500 under QEMU, which is
a Cortex-M7 -- a different core generation from the RP2350's Cortex-M33.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
In flashtool_main.c, the 'default:' label in a switch statement was
followed directly by '}', which is invalid in C.
This commit adds a 'break;' statement after the default label to
resolve the error.
Signed-off-by: tuansuper <tunainnet@tutanota.com>
perf_gettime() and perf_getfreq() are kernel functions, defined in
sched/clock/clock_perf.c. Neither appears in syscall.csv, and libc supplies
only perf_gettime(), under CONFIG_ARCH_HAVE_PERF_EVENTS_USER_ACCESS. So a
protected or kernel build cannot resolve either of them from user space:
ostest/perf_gettime.c:91: undefined reference to `perf_gettime'
ostest/perf_gettime.c:184: undefined reference to `perf_getfreq'
make[1]: *** [nuttx_user.elf] Error 1
The call in user_main() is guarded by CONFIG_ARCH_PERF_EVENTS &&
!CONFIG_ARCH_PERF_EVENTS_USER_ACCESS -- which is exactly the case where the
symbols are kernel-only -- so every such configuration fails to link.
mps3-an547:knsh is one: it sets CONFIG_SCHED_IRQMONITOR, which makes
ARCH_PERF_EVENTS default y. mps2-an521:knsh escapes only because it sets
neither monitor, leaving ARCH_PERF_EVENTS off, so the call compiles out and
the archive member is never pulled in.
Require CONFIG_BUILD_FLAT, where ostest links against the kernel's own copy.
No configuration that runs the test today stops running it.
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
CONFIG_NETUTILS_MDNS_STACKSIZE defaulted to DEFAULT_TASK_STACKSIZE,
which resolves to as little as 2KiB on some targets. The bundled
mjansson responder uses a deeper stack than that (DNS record parsing
with name decompression, plus the send/receive buffers) and overflows
on startup, taking the board down with a hardfault before it answers a
single query.
Default to 8KiB, the value that reliably runs the responder, and
correct the help text, which previously claimed a 4KiB default that did
not match DEFAULT_TASK_STACKSIZE.
Assisted-by: Claude (Anthropic Claude Code)
Signed-off-by: Ricard Rosson <ricard@groundbits.com>
Require a cryptodev backend for FSUTILS_PASSWD and tie NSH console/telnet
login to ROMFS passwd generation when ETC_ROMFS is enabled.
Fixes#19573
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Install a minimal passwd file at CONFIG_LIBC_PASSWD_FILEPATH before
getpwnam() checks so sim:ostest does not require a pre-built /etc/passwd.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Add getresuid/setreuid coverage plus ownership and permission checks
for message queues, named semaphores, shared memory, and FIFOs.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Use getresuid() and getresgid() for Linux-style id output with name
resolution and a groups= list based on the effective GID.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
The blit assumed a 32-bit frame buffer: it wrote a uint32_t per pixel
and converted the palette with ARGBTO32 as it went, so the image came
out wrong anywhere else. It also drew at the origin, leaving the image
in a corner of a display it does not fill, and indexed the source by the
output column, which costs a division for every pixel of every frame.
Convert the palette once per palette change into the format the frame
buffer actually uses, map output columns to source columns through a
table built at startup, and centre the result. Output rows that come
from the same source row are copied rather than converted again.
Four options are added, all off by default, so that a board can trade
memory for speed where it pays:
GAMES_NXDOOM_FB_CMAP blits palette indices and lets a frame buffer
that has a colour map do the conversion in hardware.
GAMES_NXDOOM_FILLSCREEN stretches the image over the whole display
rather than scaling it by a whole number.
GAMES_NXDOOM_ROWSTAGE builds each row in a staging buffer so that the
frame buffer only sees burst-friendly copies.
GAMES_NXDOOM_STATIC_SCRNBUF places the render target in .bss, which
keeps it out of external memory on a board whose heap is mostly that.
On an STM32H753 driving a 1024x600 panel from SDRAM, the last two are
worth 2.7x together.
Also open the frame buffer with O_CLOEXEC.
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
Without this Make variable, Objects.rules does not add font_fnt.o
to the build, causing undefined reference to fnt_createfont at link time.
Signed-off-by: Acfboy <AcfboyU@outlook.com>
The point of a writable execute-in-place file system is that a module can
arrive after the firmware was built and still run without being copied into
RAM. This demonstrates exactly that, end to end: it writes an NXFLAT module
into xipfs the way a download would, declaring the size up front so the
extent is exact, checks the file system can hand out a real flash pointer
for it, and runs two instances concurrently.
Both instances report the address of their own text and of their stack. The
text address is the same in both and is inside the flash window -- it is the
address the file occupies on the media -- while the stacks differ. While
they run, the extent carries one pin per instance, which is what stops the
defragmenter relocating code that is executing.
Two subcommands cover the file system rather than the module. bench times a
bulk read out of the mapped flash before and after a write, which on the
RP2350 is the cost of whichever path the driver used to restore XIP. defrag
fills the volume, deletes every other file until an allocation genuinely
cannot be satisfied, compacts, retries the same allocation, then verifies
every relocated file byte for byte and again after a remount, printing a
block map at each step.
The module has neither static data nor string constants, and reports through
a callback into the firmware instead of formatting its own output. That is
not stylistic: the ldnxflat in circulation resolves the GOT entries for .bss
objects into the import table, and drops the addend when it resolves the
PC-relative references to .rodata, so a module using either quietly computes
wrong addresses. The comment in module/xipmod.c records both. The callback
also exercises the other direction of the interface, firmware code entered
with the module's data base still live in r10.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Twelve sections, selected by name on the command line because the power loss
sweeps run for minutes while everything else runs in seconds.
The routine part covers the VFS paths, the write-once rules (reopen for
write, append, seek during write, truncate of a written file are all refused)
and both mmap variants: that a plain mapping lands inside the media window
with no heap growth, that MAP_XIP_STRICT fails with ENXIO rather than
copying, and that N mappings of one file produce N pins on one extent.
The rest is aimed at the two properties that are easy to get wrong and quiet
when they are:
Pin release. A pin taken by one task and a task that dies with a mapping
still live both have to end with the extent movable again -- the second
without the task ever calling munmap, since a module that faults never will.
Both are checked by asking the defragmenter to move the extent afterwards.
Power-loss atomicity. With CONFIG_FS_XIPFS_FAULT_INJECT the suite fails the
Nth flash operation, remounts, and checks the volume is consistent and every
file that had been committed is byte-for-byte intact. It sweeps N across
create, unlink and defragmentation, and repeats the sweep with the failing
write torn -- a partial program rather than a clean refusal -- which is what
a real power loss mid-program leaves behind.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
xipfs has a defragmentation ioctl and no way to reach it from a shell. The
only caller was a demo in examples/nxflatxip, which built its own block map
to show what compaction had done.
xipfs [-n] [-t <ms>] [<mountpoint>]
-n surveys and reports without moving anything: where each file sits, a map
of the volume, and how much of the free space a single allocation can reach.
That last number is the one a caller facing -ENOSPC actually wants; at 0%
the largest possible file already fits however scattered the map looks.
The compaction is asked for through a descriptor for the mountpoint
directory, so no file inside the volume is open while it runs and a single
pass can reach every extent.
The walk descends into the directories xipfs synthesises from names, and
reports each file by its path relative to the mount, so a volume that uses
them is described in full rather than down to its first level.
Block totals come from statfs rather than XIPFSIOC_EXTENTINFO, because that
one does name a file and an empty volume has none, yet its geometry is still
worth reporting.
Assisted-by: Claude Code:claude-opus-4-8
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
This ports mwdemo.c from Microwindows as a standalone NuttX example
application. mwdemo is the primary Win32 API demo in the Microwindows
project, featuring 3D graphics, window controls, timer-driven
animation, and bitmap image rendering.
The demo runs on both qemu-intel64:mw and sim:mw configurations.
Signed-off-by: Acfboy <AcfboyU@outlook.com>
examples/microwindows: address review, clean up mwdemo.
- Replace minimal copyright notice with full Apache 2.0 license header
- Use angle brackets for system and microwindows includes
- Remove OS-specific dead code (DOS_TURBOC, RTEMS, EMSCRIPTEN/MULTIAPP)
- Drop unused demo-mode macros and their corresponding dead code paths
(IMAGE, CLIENT3D, CLIPDEMO, ARCDEMO). Keep a fixed GRAPH3D+CONTROLS
configuration as the single NuttX demo.
- Add g_ prefix to global variable (image -> g_image)
- Move demoWndData typedef from mid-file to Private Types section
- Merge WinMain body into main() and remove the WinMain indirection
- Removed unused images.
Signed-off-by: Acfboy <AcfboyU@outlook.com>
This commit integrates the Microwindows core into the NuttX apps
build system:
- Downloads a pinned upstream commit during build and compiles the
engine, drivers and precompiled bitmap fonts via Microwindows'
Objects.rules files.
- Adds Kconfig options for framebuffer path, keyboard driver
selection (event-mode, raw byte-stream, none, custom), and
mouse/touchscreen driver selection (relative, touchscreen, none,
custom).
- Uses the MWCONFIG_FILE mechanism to inject NuttX-specific
configuration (mwconfig.nuttx) without modifying upstream headers.
- The NuttX screen, keyboard, mouse and touchscreen drivers are
pulled from upstream Microwindows. Driver selection is controlled
via ARCH=NUTTX and Kconfig-driven KEYBOARD/MOUSE variables in
the Makefile.
- Depends on VIDEO_FB for the framebuffer device.
- Builds the mwin library (Win32 API layer) when MICROWINDOWS_MWIN
is enabled.
Co-authored-by: Pavel Pisa <ppisa@pikron.com>
Signed-off-by: Pavel Pisa <ppisa@pikron.com>
Signed-off-by: Acfboy <AcfboyU@outlook.com>
Add a -p option to select the pattern to draw. The existing expanding
rectangles animation remains the default, and a new "smpte" pattern
fills the display with seven equal vertical bars (white, yellow, cyan,
green, magenta, red and blue), which is useful to verify color ordering
and channel wiring of a framebuffer display.
To support more than one palette, the draw_rect() helpers now receive
the color value to write instead of an index into the per-format color
tables. Monochrome displays pick black or white per bar using a BT.601
luma threshold.
The FBIO_UPDATE ioctl is moved out of draw_rect() into a new
present_area() helper, so the SMPTE pattern can draw every bar and
then update the display only once.
Assisted-by: Cursor:claude-opus-5
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This fixes all the warnings in the i_pcsound module caused when enabling
the sound feature Kconfig option. This warnings would prevent CI from
passing.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Do not define nx_priority for applications that use SCHED_PRIORITY_DEFAULT. The ELF loader already uses its scheduler default when the symbol is absent, avoiding the invalid priority-zero value previously encoded by Application.mk.
Keep emitting nx_priority, and retaining it through stripping, for explicit numeric priorities.
Assisted-by: Zed:GPT-5.6 Terra
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
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>
Extend the examples/sotest packaging path so the shared-library test
fixtures can also be prepared through nxpkg-style package artifacts.
Generate shared-index.json and pkgsotest.nsh from the built modprint
and sotest shared objects, recording the correct target arch/compat
metadata and SHA-256 digests for the packaged shared-library fixtures.
Allow sotest to run in either its existing builtin-ROMFS flow or from
explicit shared-library paths, with a --mount helper mode for
preparing the builtin test mount separately. Keep the paired fixture
outputs in one grouped make step so parallel builds do not re-enter
the generator independently.
This makes the sotest shared-library example usable as a
package-style fixture producer for the Dynamic ELF/nxpkg series,
useful for validating the shared-library side of the packaging flow
where the loader should consume installed artifacts rather than only
the default builtin test paths. The existing builtin-ROMFS path is
preserved with no regression to the normal sotest example flow.
Assisted-by: Claude:claude-sonnet-5
Assisted-by: OpenAI Codex:gpt-5.6-sol
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
Add the SSE2 and AVX2 vector implementation files to the CMake libmp3lame target for x86 simulator hosts. LAME's enabled runtime dispatch paths call these functions, so omitting them leaves sim:alsa with unresolved symbols at link time.
Non-x86 simulator hosts continue to use LAME's scalar implementation.
Assisted-by: Zed:GPT-5.6 Terra
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Replace the bundled libtomcrypt chacha20-poly1305 implementation with an
adapter that drives the NuttX crypto device: the SSH construction maps onto
CRYPTO_CHACHA20_DJB (the original 64-bit counter/nonce ChaCha20
parameterization used by chacha20-poly1305@openssh.com) for the packet
length and payload streams, and onto CRYPTO_POLY1305 for the authentication
tag (plain MACs are driven in two steps through /dev/crypto: COP_FLAG_UPDATE
feeds the data, a final call retrieves the tag).
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Add a du command to NSH that recursively summarizes the size of each
path argument in 1K-blocks, or human-readable form with -h.
Supports -s (summary only), -a (all files), -d N (max-depth), and -h,
matching GNU du semantics.
Testing:
Built and ran on sim:nsh with:
```bash
cmake -B out/nuttx_sim_nsh -S nuttx -DBOARD_CONFIG=sim:nsh -GNinja
ninja -C out/nuttx_sim_nsh
./out/nuttx_sim_nsh/nuttx
nsh> du
397449 /data/test/elf
71993 /data/test/coredump
5 /data/test/log2
3251 /data/test/log1
472700 /data/test
nsh> du -h
388.1M /data/test/elf
70.3M /data/test/coredump
4.1K /data/test/log2
3.1M /data/test/log1
461.6M /data/test
```
Host Ubuntu22.04 du on the same directory:
```bash
$ du
397456 ./elf
72000 ./coredump
8 ./log2
3252 ./log1
472720 .
$ du -h
389M ./elf
71M ./coredump
8.0K ./log2
3.2M ./log1
462M .
```
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
Extend the examples/elf ROMFS path so nxpkg validation can use
generated package fixtures instead of hand-managed metadata.
Generate index.json, bad-index.json, pkgtest.nsh, and pkgfail.nsh
from the built hello ELF, recording the correct target arch/compat
metadata and SHA-256 digest for the valid fixture. Keep mismatched-
target and missing-artifact cases alongside the valid fixture so
nxpkg target selection and failure handling can be exercised from
the same example tree. Group the paired fixture outputs in one make
step so parallel builds do not re-enter the generator independently.
This keeps the fixture metadata tied to the actual built hello
artifact instead of relying on manually maintained hashes or ad hoc
shell setup, making follow-up review and later test reruns more
predictable. There is no intended loader or board-behavior change;
this is limited to fixture generation inside examples/elf.
Assisted-by: Claude:claude-sonnet-5
Assisted-by: OpenAI Codex:gpt-5.6-sol
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
Replace the bundled libtomcrypt HMAC modules with an adapter that computes the hmac-sha2-256 packet MAC through the NuttX crypto device using CRYPTO_SHA2_256_HMAC sessions.
Require CRYPTO, CRYPTO_RANDOM_POOL, CRYPTO_CRYPTODEV and CRYPTO_CRYPTODEV_SOFTWARE_CRYPTO explicitly instead of selecting crypto support.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Replace fragile cursor compensation with full-line redraws where needed,
fix Ctrl+W buffer/screen corruption, properly consume unrecognized CSI
sequences, and always clean up leaked local-echo characters from buggy
serial drivers. These changes make line editing consistent across
terminals while preserving existing behavior.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Assisted-by: Claude Code (Sonnet 5)
readline cached the current prompt only when TAB completion was enabled,
even though line-editing redraws also depend on that cached prompt.
With TAB completion disabled, full-line redraws erased the prompt and
repainted only the command buffer. Make the prompt cache available
whenever line editing is enabled.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
The original readline_common.c file had some duplicated code that was
causing the nsh to be more than 1KB bigger. This clean up will allow
adding line editing without increasing the final firmware size too much.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Assisted-by: Claude Code
This commit adds support to nsh> command line editing. This is one
of the most missing feature of the NuttShell. If you typed a long
command line and make a mistake you need to press Backspace and
remove everything until reach that typo. Only the basic editing
feature is enabled by default (left/right keys movement, Home/End
to move to the beginning or ending of the command line).
More advanced features are available when CONFIG_READLINE_EDIT_EMACS
is selected. It enables the Emacs-style control keys (Ctrl+A/B/D/E/F/K/U/W)
that allow more flexible line editing.
Other more advanced feature is enabled when CONFIG_READLINE_CMD_HISTORY
and CONFIG_READLINE_EDIT_EMACS_REVERSE_SEARCH are enabled. It allows the
user to press Ctrl+R to do reverse search in the command line history.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Assisted-by: Claude Code
Then readline_write() was called with buflen == 0 it was causing a
debug assertion. Now it returns early for instead of asserting.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Tcl is added using The Jim Interpreter. Jim is an opensource small-footprint
implementation of the Tcl programming language. It implements a large subset
of Tcl and adds new features like references with garbage collection,
closures, built-in Object Oriented Programming system, Functional Programming
commands, first-class arrays and UTF-8 support.
Signed-off-by: Carlos Sánchez de La Lama <csanchezdll@gmail.com>
The Makefile build already forwards both values via PRIORITY /
STACKSIZE. Align the CMake build with the Makefile so that
CONFIG_NETUTILS_REXECD_PRIORITY and CONFIG_NETUTILS_REXECD_STACKSIZE
take effect under CMake as well.
Assisted-by: GitHubCopilot:claude-4.8-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
NUTTX_ROMFS_PASSWD_PASSWORD lacked a special character, so nuttx's
promptpasswd.sh rejects it and headless CI builds fail at etctmp.c when
sim/login is built.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Report password policy failures clearly from useradd and passwd when a
password does not meet complexity requirements.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Migrate passwd encrypt/verify to PBKDF2 modular crypt format using
kernel cryptodev (CRYPTO_PBKDF2_HMAC_SHA256 via /dev/crypto). Add
passwd_pbkdf2 wrapper, base64url helpers, complexity validation, and
pbkdf2_test for RFC 6070 vector coverage. FSUTILS_PASSWD selects
CRYPTO, ALLOW_BSD_COMPONENTS, and CRYPTO_CRYPTODEV so existing sim
defconfigs keep building. Change NSH_LOGIN_USERNAME default to root and
remove fixed-login password defaults.
BREAKING CHANGE: TEA-encoded /etc/passwd entries no longer verify.
Regenerate each entry after upgrading. Pair with the nuttx host mkpasswd
changes in apache/nuttx#19209. Boards must enable the appropriate
software or hardware crypto backend for PBKDF2 at runtime. When
CONFIG_NSH_LOGIN_FIXED=y, set CONFIG_NSH_LOGIN_PASSWORD in the board
defconfig or menuconfig; there is no default password.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Extend the watchdog drivertest with notifier ordering, duplicate registration, repeated delivery, unregister, NULL-data, and concurrent registration coverage.
Register the watchdog test when either reset-cause or timeout-notifier support is available. Keep hardware watchdog cases gated by reset-cause support and allow notifier-only simulator builds through both Make and CMake.
Keep test state in the watchdog fixture and notifier blocks so callbacks do not depend on shared notifier state.
Assisted-by: OpenAI Codex
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
Emit --defsym for nx_stacksize, nx_priority (and nx_uid/nx_gid/nx_mode
under CONFIG_SCHED_USER_IDENTITY) into MODLDFLAGS so the ELF binary
loader can recover the application's configured attributes at load time.
Also skip builtin registration for separately-built module ELFs
(BUILD_MODULE instead of DYNLIB).
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Adds an example application leveraging the Morsey library for
transmitting Morse code, either to the console (debug) or to GPIO
devices for now as the two supported sinks.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit adds the Morsey library (Apache 2.0 licensed) to be
downloaded from an external repository so it can be used in NuttX
applications.
This library parses ASCII text into Morse code marks to be played by a
user-implemented 'transmit' function (i.e. over an LED, buzzer, audio
sink, etc.).
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Rename base64_encode, base64_decode, and ecc_make_key in bundled
libtomcrypt to avoid duplicate symbol link errors when dropbear is built
alongside netutils/codecs and NuttX crypto (e.g. sim:dropbear).
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Add the "curl" NSH command: a command-line HTTP client built on top of
the netutils webclient library. It implements a subset of the real curl
options: GET and POST (and other methods via -X), custom request headers
(-H), a raw request body (-d, including -d @file), multipart/form-data
file uploads (-F name=@file), saving the response body to a file (-o)
and verbose output (-v). HTTP only (no HTTPS).
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
Program names containing '-' (e.g. renaming hello to hello-world via
PROGNAME) previously generated an invalid identifier <PROGNAME>_main
when constructing internal entry-point symbols. This caused build
failures for C/C++ applications due to invalid identifiers in compiler
definitions and generated builtin_proto.h.
Introduce PROGSYM, a sanitized copy of PROGNAME with '-' replaced by
'_', and use it wherever an internal C/Zig identifier is constructed
(the -Dmain= defines, the Zig RENAMEMAIN rule, and the REGISTER
call's entry-point argument). Preserve the original PROGNAME for the
registered NSH command name and builtin registry entry, where hyphens
are valid and expected.
The Zig RENAMEMAIN path is also updated to use PROGSYM for consistency.
The current hello_zig and leds_zig examples do not exercise this path,
since neither uses a literal 'fn main' entry point, but the change
keeps symbol generation consistent for future Zig applications.
Testing (WSL2 Ubuntu, x86_64, sim:nsh):
- CONFIG_EXAMPLES_HELLO_PROGNAME="hello-world": clean build,
'hello-world' runs and prints 'Hello, World!!'
- Reverted to default PROGNAME="hello": clean build, no regression
- Confirmed by inspection that RENAMEMAIN's sed substitution does not
fire on either current .zig source (generated _tmp.zig is
byte-identical to the source)
Fixes#19447
Signed-off-by: Ansh Rai <anshrai331@gmail.com>
The per-session NSH task is reaped with waitpid() in
dropbear_nshsession.c. Without CONFIG_SCHED_CHILD_STATUS the kernel does
not retain the child exit status, so waitpid() returns ECHILD right after
authentication and the interactive session never starts
("NSH session wait failed: Unknown error 10").
Depend on SCHED_HAVE_PARENT and SCHED_CHILD_STATUS (following the project's
depends-on-over-select convention) so the requirement is explicit; boards
enabling Dropbear must set these in their defconfig.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
This example is an LVGL application which reads pressure and temperature
data from a barometer and displays it on gauges. It is intended to
provide an idea of what LVGL on NuttX can practically be used for in an
application.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Adds options to support building when CONFIG_NET is not set.
This allows building Python for boards that do not have networking support.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
Parse the filedump path token into the existing PATH_MAX-sized buffer
before reading the optional offset and size arguments. This bounds the
write without constructing a scanf format string at runtime.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
The controller<->host ACL pool was hardcoded to 10 buffers (~6 KiB with
the 251-byte ACL size). Expose NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT and
NIMBLE_TRANSPORT_ACL_FROM_HS_COUNT (default 10) so RAM-constrained
single-connection peripherals can lower it.
Signed-off-by: raiden00pl <raiden00@railab.me>
The configured path size already includes its NUL terminator. Adding
another byte made the maximum address length exceed sockaddr_un, while
ustream could write at sun_path[UNIX_PATH_MAX].
Use the existing bounded copy length directly as the path portion of
the socket address and rely on strlcpy for termination.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This commit fixes the audio_rtttl example (which was undocumented and
previously used kernel-level functions) such that now it uses the RTTTL
parsing library. Contributors can implement 'players' for different
types of audio sinks. Currently, PWM is supported.
BREAKING: The previous version of this example only supported a single
board (Spresense) and uses public interfaces from the kernel code. Now
it only uses user-space interfaces and supports any board implementing
those interfaces. Users who relied on the old behaviour should submit a
patch to add a new player to this application which uses the desired
audio sink for the Spresense through user-space interfaces.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Implement the subscriber client that optionally integrates
the TLS layer and can reconnect to the broker if the
application is running in unstable network environments.
The client is compliant with all 3 levels of QoS.
Signed-off-by: Mihai Pacuraru <mpacuraru@protonmail.com>
Dropbear gathers its entropy from /dev/urandom (libtomcrypt's
rng_get_bytes tries /dev/urandom before /dev/random), so requiring
ARCH_HAVE_RNG and DEV_RANDOM shuts the port out of targets without a
hardware TRNG -- including the simulator, where a dropbear
configuration silently loses NETUTILS_DROPBEAR at configure time.
Keep only the DEV_URANDOM requirement.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Print a summary header before the task list in the style of the
Linux top command: uptime, task counts (total/running/sleeping),
CPU busy/idle and memory usage, all gathered via sysinfo().
Refresh the screen in place (cursor home + erase-line per row +
erase-below) instead of clearing the whole screen every cycle,
which removes the flicker.
Poll stdin during the update interval and exit on 'q', ESC or
Ctrl-C. Previously the only exit path was the SIGINT handler,
which requires both CONFIG_ENABLE_ALL_SIGNALS (handler) and
CONFIG_TTY_SIGINT (serial console converts Ctrl-C into SIGINT,
default n); on configurations missing either option top could
not be terminated at all.
Tested on linum-stm32h753bi:nsh.
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
Parse command filename tokens into PATH_MAX-sized buffers before
reading optional raw audio parameters. This bounds nxplayer and
nxrecorder input without runtime-built scanf formats.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
cur_cnt++ in the loop condition increments even when the loop body
doesn't run, so avg is divided by one more sample than was collected.
Signed-off-by: liang.huang <liang.huang@houmo.ai>
NuttX master now requires CONFIG_BOARD_ETC_ROMFS_PASSWD_PASSWORD for
sim/login builds. The nuttx-apps workflow mirrors nuttx CI but never
exported NUTTX_ROMFS_PASSWD_PASSWORD, so Linux sim-02 and macOS sim
jobs failed inside the Docker build container.
Set the documented test credential at the job and step level and
export it explicitly before cibuild.sh runs.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
Normal Crypto API usage is to call ioctl(CGCGSESSION) to initialize
the session, then one (or more) calls to ioctl(CIOCCRYPT) with flag
bit COP_FLAG_UPDATE set to append to the hash/xform calculation, then
a call to ioctl(CIOCCRYPT) with flag bit COP_FLAG_UPDATE cleared to
extract the result, and finally ioctl(CIOCFSESSION) to finish the
session. This follows the classic init / update* / finish data
processing model.
However crc32.c test case 8 precedes ioctl(CIOCCRYPT) with
COP_FLAG_UPDATE set with ioctl(CIOCGSESSION) and follows it with
ioctl(CIOCCRYPT) with COP_FLAG_UPDATE cleared to extract the CRC, and
then ioctl(CIOCFSESSION) to finish the session, all _within_ the loop
to CRC eight segments. This works with the software implementation
since the intermediate CRC-32 is carried forward out of one session to
seed the next session. Fix by moving the init and finish portions out
of the loop in test case 8.
Signed-off-by: Peter Barada <peter.barada@gmail.com>
fix warnings lte/lapi on sim:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
Signed-off-by: raiden00pl <raiden00@railab.me>
The lp503x shell command handlers receive the remaining input string as their argument. Treat empty colour arguments as the query case, document that query form in help text, and keep colour and brightness values signed until the existing range checks have run so invalid values are not silently truncated.
Guard the readline_stream() result before using it as a buffer index. readline_stream() returns EOF on end of file or failure, and writing buffer[len] before checking len can write before the stack buffer.
Use MAX_BRIGHTNESS consistently for brightness range checks.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
Several malloc() results in the wgetjson example were used before checking for allocation failure, which could crash low-memory paths before cleanup ran.
Return or propagate allocation errors before using the allocated buffers. Use explicit NULL comparisons for the new pointer checks to match review feedback.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
read_pkt() terminates the received payload with buff[ret], but a full-size read can leave no room for that trailing NUL byte.
Limit the read length to one byte less than the buffer size so the received payload remains safely terminated before it is printed.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
recv() returns zero when the peer closes the TCP connection cleanly. The SMTP response path only treated negative returns as errors, so EOF could leave stale or empty response data to be checked as if a server reply had arrived.
Return ERROR on zero-length receives at each SMTP response point and keep the SPDX copyright header within the project line length limit.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
nrf24_read() reads up to the nRF24L01 maximum payload length and then appends a NUL terminator for the receive buffer. A full 32-byte payload can therefore write one byte past the local rbuf[32].
Reserve one extra byte for the terminator while keeping the read length capped at NRF24L01_MAX_PAYLOAD_LEN. Dump the number of bytes actually received in the debug path.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
The RFB ServerInit message carries the desktop name as a length-prefixed field. vncviewer caps the copied name to fit conn->name, but it must still consume the remaining bytes from the socket when the advertised name is longer than the local buffer.
Drain the unused suffix so the next RFB message is read from the correct boundary. Reuse the same discard helper for other skipped RFB payloads.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
xmlrpc_handler() stores HTTP header values in a CONFIG_XMLRPC_STRINGSIZE + 1 byte buffer, but it passed CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE to xmlrpc_getheader(). With the defaults, that allows a 1024 byte copy into a 65 byte destination.
Make xmlrpc_getheader() treat size as the destination capacity, reserve one byte for the terminator, and pass sizeof(value) from the caller.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
The TCP nettest server receives up to TEST_BUFFER_SIZE bytes and then appends a NUL terminator before checking for the exit command. A full-size receive can therefore write one byte past the receive buffer.
Reserve one extra byte for the terminator while keeping the recv() limit and echo length capped at TEST_BUFFER_SIZE.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
The netloop and poll TCP echo examples receive up to IOBUFFER_SIZE bytes and then append a NUL terminator before logging the data. A full-size receive can therefore write one byte past the input buffer.
Reserve one extra byte in the buffers that are terminated after recv(). Keep the receive limit and echo length capped at IOBUFFER_SIZE so the data path is unchanged.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
The current distclean implementation has two issues:
1. Application.mk does not remove .kconfig on distclean, so stale
config fragments from earlier builds can pollute subsequent ones.
2. Several external-library Makefiles (lame, libshvc, libulut) run
"make -C <subdir> distclean" without checking whether the
subdirectory exists. When the library was never downloaded (common
in CI partial-build environments), distclean fails with "No such
file or directory".
Fix:
- Application.mk: add $(call DELFILE, .kconfig) to the distclean
target so that .kconfig is cleaned along with .built, .depend, etc.
- audioutils/lame/Makefile: guard the distclean recipe with
"if [ -d $(DST_PATH) ]; then ...; fi" and use $(MAKE) instead
of bare make.
- netutils/libshvc/Makefile, netutils/libulut/Makefile: same
directory-existence guard for their distclean recipes.
- crypto/wolfssl/Makefile: change "distclean:" to "distclean::"
(double-colon) so it does not override the distclean:: rule
inherited from Application.mk.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
NuttX has dirent, so the glob implementation can be used. This removes
the warning for no native glob implementation.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Rework the terminal input selection into an explicit three-way Kconfig
choice so the format each keyboard delivers is picked up front:
- On-screen keyboard (touch) - default, unchanged behaviour.
- Matrix / upper-half keyboard - reads struct keyboard_event_s events
(for example the M5Stack Cardputer matrix on /dev/kbd0).
- USB HID keyboard - reads a byte stream (for example /dev/kbda with
CONFIG_USBHOST_HIDKBD).
The physical-keyboard variant now polls the device non-blocking from the
LVGL thread (no dedicated task), mirroring the touch variant. The USB
path decodes the stream with the keyboard codec, so with a driver built
for CONFIG_HIDKBD_ENCODED the Up/Down cursor keys scroll the terminal;
a plain-ASCII stream still works as ordinary key presses.
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
Check the service argv array bound before reading the current entry in the debug dump loop. A full argument array may not have an in-array NULL terminator, so the old condition could read one entry past the array while CONFIG_SYSTEM_NXINIT_DEBUG is enabled.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
NSH error shouldn't be disabled by default, even when in SMALL
Memory because it will make difficult to discover why things are
not working. It should be disabled manually by experienced dev.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Rebuild from a clean tree in one recipe so a stale state no longer breaks the build.
This commit also simplify some build logic.
Signed-off-by: raiden00pl <raiden00@railab.me>
The GPS example appends serial input to a fixed-size NMEA line buffer until CR or LF without checking the buffer limit. A malformed or overlong input line can write past the end of line[], and the code also uses ch even when read() does not return a byte.
Read bytes only after a successful read(), stop storing at MINMEA_MAX_LENGTH - 1, drain overlong lines until the line ending, and skip parsing truncated sentences.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Run the bitmap converter through the Python formatter required by checkpatch so the Python 3 print syntax fix passes the project style checks.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Use Python 3 print function syntax so bitmap_converter.py can be parsed by current Python interpreters while preserving the existing usage message and exit path.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Keep the default zero CPU value when the procfs load file cannot be read, and trim only the newline that was actually present. This avoids parsing uninitialized stack data in fillcpu and avoids writing before the showinfo CPU buffer when fgets returns no data.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Use 0 as a Kconfig placeholder. The nuttx build rejects unset keys
and can generate random values when configured.
BREAKING CHANGE: CONFIG_FSUTILS_PASSWD_KEY1..4 no longer default to
0x12345678 / 0x9abcdef0. Configs that relied on those defaults must
set keys manually or enable BOARD_ETC_ROMFS_PASSWD_RANDOMIZE_KEYS in
nuttx. Fix: set keys in menuconfig or enable random key generation.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
This commit disables the `no-maybe-uninitialized` warning because
it's wrongly evaluated after increasing the optimization level of
the Python's library.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Refactor the LVGL terminal into a shared core (lvglterm.c) plus two
selectable input variants: the existing on-screen touch keyboard
(lvglterm_touch.c) and a new physical keyboard variant (lvglterm_kbd.c) that
reads key events from a /dev/kbdN device and streams them to the shell.
The input source is chosen with a Kconfig choice (touch by default, keeping
the previous behaviour). The keyboard variant reads its device from
CONFIG_EXAMPLES_LVGLTERM_KBD_DEV (default /dev/kbd0), overridable by the first
command-line argument, and scrolls the output with the Fn cursor keys. A font
choice (UNSCII 8 or 16) is added for low-resolution displays.
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
This commit resolves all of the build warnings that were preventing
NXDoom from compiling in CI runs.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
The pinned Berry source emits -Wshadow diagnostics in a couple of files. NuttX CI passes -Werror, so sim:berry fails when those third-party warnings are promoted to errors.\n\nAdd -Wno-shadow to Berry-specific compiler flags in both Make and CMake paths, keeping the local source patch limited to the NuttX port changes.
Signed-off-by: Frederick Blais <fred_blais5@hotmail.com>
This commit includes a (highly) modified version of Chocolate DOOM which
can run on NuttX. The majority of the modifications were made to pass
the NuttX style check. Some small modifications have been added to
support keyboard input, render graphics to frame buffers and directly
use the POSIX interfaces NuttX supplies, stripping out Windows/Mac stuff
and any references to SDL.
NOTE: Sound is currently not supported in any capacity, nor is the
networking stuff. A lot of Chocolate DOOM code was stripped out since it
was unused. If there is a need/desire to add it back later, the original
Chocolate DOOM source can be used as a reference.
WARNING: The NuttX keyboard codec is incredibly non-standard and so
there are problems translating from X11 keys to NuttX ones to play DOOM.
Right now, the CTRL key for firing doesn't work because the NuttX codec
has no concept of it. The NuttX codec should be modified (and other
input devices supported), but at the time of this port I am not
sufficiently comfortable doing so since I am afraid of breaking other
things in the kernel.
NOTE: This port (and likely the original DOOM) seems to be written with
32-bit computers in mind. As such, most things are given the type of
natural `int`, even when a single byte might do. There are significant
size optimizations that could be made to make this more suited to
embedded devices that NuttX typically runs on.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit adds the original Chocolate DOOM source which forms a basis
for the NuttX port of DOOM.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Berry's downloaded default/berry.c uses CRLF line endings, while the local NuttX patch was LF. Fresh Linux and CMake builds failed when patch saw the line-ending mismatch.
Regenerate the local Berry patch against the pinned upstream CRLF source and apply it directly in both Make and CMake fetch paths. This keeps the integration working until the Berry-side change is merged upstream and the pinned commit can be updated.
Signed-off-by: Frederick Blais <fred_blais5@hotmail.com>
Fix two potential NULL pointer dereferences in nsh_fscmds.c:
1. fdinfo_callback: asprintf() failure left filepath potentially
NULL, which was then passed to nsh_catfile(). Add early return
on asprintf failure.
2. cmd_cat: malloc(BUFSIZ) for stdin reading was used without
checking the return value. Add NULL check with -ENOMEM return.
Also fix a typo in error message: 'nsh_catfaile' -> 'nsh_catfile'.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
Fixes#17063
Add modification time display to ls -l long format output.
The timestamp is shown as 'YYYY-MM-DD HH:MM' between the permission
string and the file size, following the ISO long-iso format.
Files with st_mtime == 0 (e.g., procfs, tmpfs pseudo-entries) skip
the timestamp display to avoid showing a meaningless epoch time.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
By default rexecd spawns a detached worker thread per accepted connection
to allow concurrent sessions. Add a "-t" runtime option to instead handle
each connection inline in the main task, avoiding the per-connection
worker stack (CONFIG_NETUTILS_REXECD_STACKSIZE) allocation from the heap.
This matters on low-memory targets with limited free heap.
With "-t", connections are served strictly one at a time: a long-running
or interactive command blocks the accept loop until it finishes. Without
it, the existing thread-per-connection behaviour is unchanged.
Assisted-by: GitHubCopilot:claude-4.8-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
The O_RDOK/O_WROK aliases have been removed from fcntl.h. Replace
all remaining O_RDOK usage with O_RDONLY in the apps repository.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
The O_RDOK/O_WROK aliases have been removed from fcntl.h. Replace
all remaining O_RDOK usage with O_RDONLY in the apps repository.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Add an optional Berry interpreter under apps/interpreters.
Fetch the pinned upstream source and apply the NuttX default-port patch.
Generate Berry constant objects and build the NSH command through Kconfig.
Make and CMake build paths are included for normal app integration.
Signed-off-by: Frederick Blais <fred_blais5@hotmail.com>
popen() now returns a fopencookie-backed FILE* whose fileno() yields the
cookie pointer rather than a real descriptor, so poll() silently ignores
the negative fd and the relay loop blocks forever waiting for command
completion. See https://github.com/apache/nuttx-apps/pull/3511
Use dpopen()/dpclose() to obtain the raw bidirectional socket descriptor
directly, restoring the EOF/POLLHUP command-completion signal.
Assisted-by: GitHubCopilot:claude-4.8-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
When the relay loop exits early without entering any branch, ret would be
returned uninitialized, tripping -Werror=maybe-uninitialized. Initialize
it to 0.
Assisted-by: GitHubCopilot:claude-4.8-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit fixes the previous behavior where an echo with a
single string and its default new line is send as single write().
This issue came from: https://github.com/apache/nuttx-apps/pull/1559
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Integrated SSH daemon authenticating against FSUTILS_PASSWD, with an
ECDSA P-256 host key and an NSH session over a PTY per connection. Built
from the upstream Dropbear tarball (pinned commit) and patched for
NuttX, using Dropbear's bundled libtomcrypt for all crypto. setsid()
(apache/nuttx#19184) and link() now come from NuttX, not local stubs.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Expose scpi-parser unit support through explicit Kconfig options instead of raw CFLAGS.
Map each option to the corresponding upstream USE_UNITS_* compile-time define, preserving the existing default unit set while allowing users to enable groups such as USE_UNITS_TIME.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add the missing module metadata for the executable ELF helpers used by the package fixture flow so the generated artifacts describe their target and type consistently.
Also fix the existing embedlog spelling issue that is picked up by the current apps check, keeping this branch clean under CI.
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
Add a test that verifies modifying SP (REG_R13) in the saved register
context is honored on signal return. The test pushes values onto the
stack, triggers SIGALRM, and in the handler advances SP to skip a
value, then verifies the correct value is popped after signal return.
This exercises the SP relocation fix in arm_sigdeliver.c for ARMv7-M
and ARMv8-M architectures.
Signed-off-by: Andrew Au <cshung@gmail.com>
The g_rootdir[] table initialized each entry's struct dirent member
positionally as { DTYPE_FILE, "FileN" }, which assumes d_type is the
first field. This breaks when struct dirent gains the POSIX d_ino field
as its first member (see apache/nuttx: "fs/dirent: add d_ino member to
struct dirent"): the file-name string would be assigned to d_type,
producing -Wint-conversion warnings and an "initializer element is not
computable at load time" error.
Use designated initializers (.d_type / .d_name) so the table is robust
against the field order of struct dirent.
Also fix a 'Initiallly' typo in a nearby comment flagged by codespell.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Add the initial nxpkg command, metadata and store handling, the local install/list path, and the repository export helper.
Keep the current flow scoped to local artifacts and target-qualified repository entries so it remains usable as an incremental MVP while follow-up features land separately.
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
Move GPS example units after the printed values to match the requested output style.
Wrap long printf format strings for checkpatch.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
The GPS example prints parsed measurements without explicit units. The RMC
floating-point speed path also used minmea_tocoord(), even though speed is
not a coordinate.
Add units to the output labels, print speed with minmea_tofloat(), and print
GGA altitude as a scaled value with the sentence-provided unit.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Print each argument passed from nsh with its index, and report when
the example is running on the simulator target. This makes the Rust
example demonstrate both C argv handling and target-specific output.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
On the sim target (Windows/macOS/Linux), hello_rust_cargo_main() ended
with an infinite `loop {}` that never returned control to NSH, so the
example could not exit and the shell prompt hung.
Introduce a Cargo `sim` feature that is enabled only when CONFIG_ARCH_SIM
is set, and use it to compile out the trailing infinite loop and return 0
instead. Other embedded targets keep the original looping behavior.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Initial development of the NuttX's Web Panel application. This is
a self-hosted web page application that enables retrieving system
info, provides a simple NSH terminal and enables uploading files.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
This commit adds a simple websocket server example that echoes data
back to the client using libwebsockets.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Prior to this change, if an empty folder existed instead of the
actual libwebsockets source, the build would fail. This commit
checks for an actual file instead, avoid such kind of errors.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
libwebsockets can be built without TLS support. To allow this, it
was necessary to create a specific Kconfig option that enables TLS
support if OPENSSL_MBEDTLS_WRAPPER is enabled. Otherwise, TLS is
not supported (but libwebsockets can still be used with plain ws://
connections).
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Start the mDNS daemon based on the event of getting a new IP
address for any of the system's network interfaces. This allows
DHCP client to trigger the mDNS daemon after getting a new IP
address, for instance.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
POSIX timers test doesn't really need signal actions, so we can change it
to synchronously wait for the signal in sigwaitinfo, instead of registering
a signal handler.
Also exclude the test from compilation with CONFIG_DISABLE_ALL_SIGNALS;
the test does require at least partial signal support.
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
The tasks CGI used nxsched_foreach() to walk scheduler internals and read
fields directly from struct tcb_s. That exposes an application example to
non-standard OS internals.
Read task information from /proc/<pid>/status instead, matching the public
procfs interface used by other task listing tools.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Adds support for installing nuttx-periphery Python package by default
on Python support. This package provides API for accessing Nuttx
character drivers.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
One of the four values emitted by this interactive tools uses the
hexadecimal presentation. The other values are decimal numbers.
Now the confusion is avoided: all numbers use the decimal
representation.
In addition the suffix "size" is added to the "Erase block" label
in order to clarify its meaning.
Signed-off-by: Lars Kruse <devel@sumpfralle.de>
Add hash testing of unaligned buffer sizes via multiple call to
ioctl(CIOCCRYPT) in a single session with buffer sizes incrementally
increasing from zero size to 255 (with monotoncially increasing
byte value data) to force all sizes to be handled by cryptodev
implementations.
Signed-off-by: Peter Barada <peter.barada@gmail.com>
Use fopencookie() to attach the popen fd and shell pid to the returned FILE stream instead of copying FILE into the popen container.
Keep the upstream dpopen()/dpclose() implementation as the process and descriptor backend, and make pclose() close the cookie-backed stream directly.
Fixes#2937.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Introduce a new CONFIG_UORB_FORMAT Kconfig option to control whether
uORB format strings are compiled in. UORB_LISTENER, UORB_GENERATOR,
and DEBUG_UORB all select UORB_FORMAT automatically, so format strings
are included when any of these features are enabled.
This replaces the previous approach of guarding format strings with
CONFIG_DEBUG_UORB, which prevented uorb_listener from displaying
sensor data when debug output was disabled.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
Add a new RNG90 example application that opens the RNG90 character device, reads random bytes, and prints them in hexadecimal format.
The example supports optional command-line arguments for device path and byte count and integrates with Kconfig, Make, and CMake build flows.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Select the Mach-O Rust target (x86_64-unknown-nuttx-macho.json) when
building Rust apps for the simulator on x86_64 macOS.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
listener_update() only prints topic data when delta_generation is
non-zero (i.e., new data arrived since last check). In listener_top,
the first call adds objects to the list, and subsequent calls only
print if new data was published between iterations. This results in
listener_top -T showing only the header with no topic rows.
Fix by always printing the current topic state in listener_update,
setting frequency to 0 when no new data arrives. This ensures
listener_top displays all topics every iteration.
Fixesapache/nuttx-apps#3202
Signed-off-by: hanzj <hanzhijian@zepp.com>
Guard the daemon path (and is_daemon_running()) with CONFIG_MODEM_ALT1250 and
return OK from lte_initialize() when it is not set, so lapi builds and works
for kernel-resident LTE modems.
Signed-off-by: raiden00pl <raiden00@railab.me>
Fix
====================================================================================
Cmake in present: sim\windows
Configuration/Tool: sim\windows
2026-06-05 16:01:37
------------------------------------------------------------------------------------
Cleaning...
Skipping: sim\windows
------------------------------------------------------------------------------------
End: 2026-06-05 16:01:37
====================================================================================
The "windows-latest" and “windows-2025” labels in GitHub Actions will be migrated to use Visual Studio 2026 by default. Customers needing Visual Studio 2022 must migrate to the windows-2022 image.
https://github.com/actions/runner-images/issues/14017
Signed-off-by: simbit18 <simbit18@gmail.com>
Fix argument parsing in init_parse_arguments() to properly handle
multiple quoted arguments like 'echo "arg1" "arg2"' by skipping
quote characters after processing them.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
The init process has blocked all signals, spawned services would
inherit that mask. This could cause services to miss important
signals like SIGTERM during graceful shutdown.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Pending all signals(SIGCHLD) when ppoll() is not invoked to
avoid race conditions.
Case reproduction
Set examples/hello as a service that exits immediately after startup.
```init.rc
on boot
start hello
service hello hello
restart_period 0
```
Log - without this patch:
# Service hello only restarts about 100 times, ppoll is not woken up
# after the hello process with PID 119 exits.
[ 4.391274] [ 2] [ 0] init_main: service 'hello' pid 118 exited status 0
[ 4.401423] [ 2] [ 0] init_main: started service 'hello' pid 119
Log - with this patch:
# ppoll() can still be woken up normally after tens of thousands of
# restarts of service hello in stress test.
[ 268.447747] [ 2] [ 0] init_main: service 'hello' pid 34503 exited status 0
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Any string ending with whitespace passed to init_parse_arguments()
could cause the parser to advance past the string boundary and read
unintended memory content.
- " echo "A" \0& echo "B" should be parsed
as a command with two argvs instand of five.
- "command arg " may lead to uncertain results.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
reap_process() referenced an undeclared identifier 'wtatus' on
the WIFSIGNALED branch (typo of 'wstatus'). Some toolchains then
flagged a -Wmaybe-uninitialized on the surrounding wstatus use.
Correct the typo so WIFSIGNALED/WTERMSIG operate on the actual
wstatus value returned by waitpid().
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
action.c uses clock_gettime(CLOCK_MONOTONIC, ...) but did not
pull in <nuttx/clock.h> directly, which fails to build on
configurations where the header is not transitively included.
Add the missing #include.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
When ETC_ROMFS is disabled to reduce the bin size, we can provide the init.rc
file via a pseudo-file in the boards/vendor directory. For example:
- CONFIG_ETC_ROMFS=n
- CONFIG_PSEUDOFS_FILE=y
- CONFIG_DISABLE_PSEUDOFS_OPERATIONS=n
```C
FAR const char *init_rc =
"on init\n"
" start console\n";
"service console sh\n"
" restart_period 100\n";
int fd = open("/etc/init.d/init.rc", O_WRONLY | O_CREAT);
/* ... */
ssize_t n = write(fd, init_rc, strlen(init_rc) + 1);
/* ... */
close(fd);
```
The last character '\0' in the file content will be treated as a new line,
and the number of parsed parameters will be zero (abnormal, there should be
at least one keyword).
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Empty lines in init.rc caused parsing to fail with -EINVAL because init_parse_arguments() returns 0 for empty strings, triggering the 'argc < 1' error path in init_action_parse() and accessing uninitialized argv[0] in init_service_parse().
Fix by skipping empty lines and lines containing only whitespace before attempting to match section keywords or calling parser callbacks.
Fixesapache/nuttx-apps#3513
Signed-off-by: hanzj <hanzhijian@zepp.com>
Add a Rust make helper that collects crate input files, and use it for
the Rust hello and slint examples.
This makes the generated Rust static libraries depend on the crate
sources, manifests, build scripts. Hook the libraries into both context
and all, so re-running make after editing Rust inputs rebuilds the crate.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Mirror of microros_pub for the receive direction. Creates a node,
subscribes to /nuttx_sub with std_msgs/Int32, drives an rclc_executor
spin loop, and prints each received value. Exercises the new
rclc_executor + subscription callback path on top of the
microros_transport library shipped in apps/system/microros.
Validates the NuttX-native transport in the agent->client direction
end-to-end against a micro-ROS agent + ros2 topic pub on the host.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add tests for popen()/pclose() and dpopen()/dpclose() that work in
both shell (NSH) and no-shell (direct posix_spawnp) modes. The test
binary doubles as its own target via the --echo sub-command.
Tests:
1-4: popen - basic read, multi-arg, pclose, invalid mode
5-7: dpopen - basic read, multi-arg, dpclose
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
When NSH_LIBRARY is not available, dpopen()/popen() can still execute
commands by splitting the command string by whitespace and calling
posix_spawnp() directly. Shell syntax (pipes, redirects, globbing)
is not supported in this mode.
Add CONFIG_SYSTEM_POPEN_MAXARGUMENTS (default 7) to control the
argv array size for the no-shell path.
Remove the hard dependency on NSH_LIBRARY from SYSTEM_POPEN so the
feature can be used in minimal configurations without a shell.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Add dpopen()/dpclose() as the descriptor-based counterpart of
popen()/pclose(), analogous to how dprintf() relates to fprintf().
dpopen() returns a raw file descriptor instead of a FILE stream,
avoiding the stdio.h dependency for callers that only need an fd.
Refactor popen() as a thin wrapper: dpopen() + fdopen() + FILE
container. All pipe creation and process spawning logic now lives
in dpopen.c.
Also remove the hard dependency on NSH_LIBRARY from SYSTEM_POPEN.
When NSH is available, commands are executed through sh -c with full
shell syntax support. When NSH is not available, commands are split
by whitespace and executed directly via posix_spawnp().
Add CONFIG_SYSTEM_POPEN_MAXARGUMENTS (default 7) to control the
argv array size for the no-shell path.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Add aarch64 Rust target specs for NuttX, including a Mach-O variant
for macOS sim builds. Use the NuttX custom targets instead of
aarch64-apple-darwin so Rust std is built with target_os=nuttx while
still producing link-compatible objects for sim.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
End-to-end exercise of the micro-ROS stack on NuttX: calls
microros_transport_init() to register the configured backend,
brings up rclc_support / node / publisher, publishes 30
std_msgs/Int32 messages on /nuttx_pub at 1 Hz, then tears the
stack down cleanly.
The example's Make.defs adds $(APPDIR)/system/microros/transport
to its own CFLAGS rather than the system/microros Make.defs, so
the transport-glue header path is not pushed into the global
search path for unrelated apps.
Serves as the smoke test for the transport layer and as a template
for downstream publisher apps.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Micro XRCE-DDS expects the application to supply open/close/write/read
callbacks for the wire transport. Add a single dispatcher that
registers the selected backend via rmw_uros_set_custom_transport(),
plus two backends:
transport/microros_transport_udp.c
BSD-socket UDP backend. Opens an AF_INET/SOCK_DGRAM socket,
resolves CONFIG_MICROROS_AGENT_IP/PORT, connect()s it, and uses
send/recv. The socket fd is stashed in uxrCustomTransport->args
so no module-level state is needed.
transport/microros_transport_serial.c
termios serial backend. Opens CONFIG_MICROROS_SERIAL_DEVICE with
O_RDWR|O_NOCTTY|O_CLOEXEC, switches to raw 8N1 at
CONFIG_MICROROS_SERIAL_BAUD, and uses poll/read/write. Fd is
again stashed in uxrCustomTransport->args.
Both backends are mutually exclusive at compile time via Kconfig;
the dispatcher selects which set of callbacks to register. Wired
into both the legacy Make build (CSRCS in system/microros/Makefile)
and the CMake build (separate microros_transport static library
with the transport directory only exposed to its INTERFACE).
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
libmicroros is installed by colcon under include/<pkg>/<pkg>/file.h
for ament-packaged headers (e.g. rcl, rmw, rosidl) and the flat
include/<pkg>/file.h for a few others (e.g. rclc). A single
-I include/ therefore resolves <rclc/rclc.h> but not <rcl/rcl.h>.
Enumerate every immediate subdirectory of include/ in addition to
include/ itself so both layouts resolve.
Switch the library hand-off from LDLIBS to EXTRA_LIBS. The sim
target's final link pulls EXTRA_LIBS, not LDLIBS, so the previous
form left rcl/rclc/rcutils symbols unresolved.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
micro_ros_lib/toolchain.cmake.in initialised C and CXX flags with
-D'__attribute__(x)=' to silence GCC attributes the upstream ament
build is not aware of. The strip also removed __gnu_inline__ and
__always_inline__ from NuttX's libc string.h inlines, so each
micro-ROS translation unit emitted external definitions of strcmp,
strcpy, strlen and friends. Sim final link then failed with ~50
multiple-definition errors.
Drop the define from both flag init lines so the attributes survive
and the inlines collapse as intended.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add SHA224 hash test using results generated from sha224sum.
Modify "huge block" testing since allocating 600KB to hash all
at once fails on most microcontrollers. Instead allocate a
smaller block and pass into syshash_update() enough times to
hash 600KB of data.
Signed-off-by: Peter Barada <peter.barada@gmail.com>
Fix a missing space in the Kconfig help text for SYSTEM_LZF:
'Enable theLZF' → 'Enable the LZF'.
Signed-off-by: Zepp-Hanzj <Zepp-Hanzj@users.noreply.github.com>
Signed-off-by: hanzj <hanzjian@zepp.com>
Use configured key, value, and filename limits while loading and saving settings storage data.
The text backend now builds backup filenames with a sized buffer and bounded formatting, and both text and binary loading reject keys or string values that are not terminated within their configured field sizes. This completes #3109 without changing the storage formats.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Use strnlen() for public key, value, and storage path length checks so user-provided settings strings are validated against the configured maximum sizes before they are scanned.
Use bounded key comparisons and strlcpy() for fixed-size settings fields. This addresses part of #3109 without changing the settings API or storage formats.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Fix spelling errors in QuickJS Kconfig and nettest source:
* "distable" -> "disable" in INTERPRETERS_QUICKJS_NONE description
* "destory" -> "destroy" in INTERPRETERS_QUICKJS_EXT_HOOK option
and help text (2 occurrences)
* "err_destory" -> "err_destroy" label in nettest_tcpserver.c
(3 occurrences: 2 goto targets and 1 label definition)
These are cosmetic fixes with no functional change.
Signed-off-by: hanzj <hanzjian@zepp.com>
Without debug enabled, the code would not compile due to checking
`WIFEXITED(wstatus)` when `wstatus` was uninitialized.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
The init.rc file path is now configurable to allow users to choose where
to put the startup script. This is useful for devices that mount
external media to a special directory like `/sd`.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Would not compile due to typo in macro describing service name length.
Change ensures that:
* We do not malloc an extra `len` bytes since this is already allocated
as part of the struct
* The name string always has a null terminating byte
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
FIx
Add support for the reboot_on_failure option to the service.
When the execution of a command within a certain action fails (returning
a non-zero status code), NxInit will continue to execute subsequent commands or
actions and will not proactively terminate the startup process. To implement
the functionality of "terminating the startup process after a command
execution fails", there are two methods:
a. Execute conditional statements (if/then/else/fi) via exec command,
but this depends on sh:
```
on init
exec -- set +e; \
mount -t fatfs /dev/data /data ; \
if [ $? -ne 0 ] ; \
then \
echo "failed" ; \
reboot ; \
else \
echo "succeed" ; \
fi;
```
b. Via service's oneshot + reboot_on_failure:
/* Although the example uses sh, it does not depend on it and can be
* replaced with any other Builtin Apps.
*/
```
on init
exec_start mkdir_tmp
ls /tmp
service mkdir_tmp sh -c "mkdir /tmp"
reboot_on_failure 0
oneshot
```
Test
- RC
service console sh
class core
override
> reboot_on_failure 0
restart_period 10000
- Runtime
[ 0.150000] [ 3] [ 0] init_main: == Dump Services ==
...
[ 0.170000] [ 3] [ 0] init_main: Service 0x40486ea0 name 'console' path 'sh'
[ 0.170000] [ 3] [ 0] init_main: pid: 0
[ 0.170000] [ 3] [ 0] init_main: arguments:
[ 0.170000] [ 3] [ 0] init_main: [0] 'service'
[ 0.170000] [ 3] [ 0] init_main: [1] 'console'
[ 0.170000] [ 3] [ 0] init_main: [2] 'sh'
[ 0.170000] [ 3] [ 0] init_main: classes:
[ 0.170000] [ 3] [ 0] init_main: 'core'
[ 0.170000] [ 3] [ 0] init_main: restart_period: 10000
> [ 0.170000] [ 3] [ 0] init_main: reboot_on_failure: 0
[ 0.170000] [ 3] [ 0] init_main: flags:
[ 0.170000] [ 3] [ 0] init_main: 'override'
...
[ 0.380000] [ 3] [ 0] init_main: started service 'console' pid 4
...
nsh> kill -9 4
[ 8.060000] [ 3] [ 0] init_main: service 'console' flag 0x20000004 add 0x4
[ 8.060000] [ 3] [ 0] init_main: -flag 'running'
[ 8.060000] [ 3] [ 0] init_main: service 'console' flag 0x20000000 add 0x8
[ 8.060000] [ 3] [ 0] init_main: +flag 'restarting'
> [ 8.060000] [ 3] [ 0] init_main: Error reboot on failure of service 'console' reason 0
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Format: exec_start <service>
Start the specified service and pause the processing of any additional
initialization commands until the service completes its execution. This
command operates similarly to the `exec` command; the key difference is
that it utilizes an existing service definition rather than requiring
the `exec` argument vector.
This feature is particularly intended for use with the `reboot_on_failure`
built-in command to perform all types of essential checks during system boot.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This component (abbreviated as "NxInit") is specifically developed
for NuttX and intended for system initialization. While we have
adopted the Android Init Language among various syntax options,
this is a brand-new implementation—it is not a port or variant of
Android Init.
Refer to the implementation of Android Init Language, consists of five broad
classes of statements: Actions, Commands, Services, Options, and Imports.
Actions support two types of triggers: event and action. Action triggers also
support runtime triggering. Services support lifecycle management, including
automatic restart (at specified intervals), and starting/stopping
individually or by class. Import supports files or directories, and we may
add a static method in the future. The following are some differences:
1. The Android Init Language treats lines starting with `#` as comments,
while we use a preprocessor to handle comments.
2. For action commands, we can omit "exec" and directly execute
built-in apps or nsh builtins.
3. Regarding the property service, users can either adapt it by self or
directly use the preset NVS-based properties.
4. Only part of standard action commands and service options are
implemented currlently.
To enable system/nxinit:
```diff
-CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INIT_ENTRYPOINT="init_main"
+CONFIG_SYSTEM_NXINIT=y
```
For format and additional details, refer to:
https://android.googlesource.com/platform/system/core/+/
master/init/README.md
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
When stdout is broken (e.g. PTY master closed), nsh_catfile could spin
forever: write() fails, error logging generates syslog output to
/dev/log, next read() picks it up, write() fails again, ad infinitum.
Two fixes:
- nsh_console: drop the _err() in nsh_consolewrite entirely. The risk
is errno-agnostic (EPIPE / EIO / ENOSPC / ...): any failure logged
here can be re-injected by the syslog backend when OUTFD is bound to
/dev/log. Callers already see the failure via the negative return
value and errno, so on-failure logging at this layer is redundant.
- nsh_fsutils: jump straight from the inner write-failure path to a
single errout: cleanup label instead of using a two-level break +
flag check, so a failed write cannot fall through to another read().
Assisted-by: GitHubCopilot:claude-4.7-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
POSIX specifies strcasecmp/strncasecmp in <strings.h>, not <string.h>.
On NuttX (and other strict POSIX environments) rcutils/src/strcasecmp.c
only includes <string.h>, causing an implicit-declaration error for
strcasecmp when cross-compiling.
Patch 0003 adds #include <strings.h> guarded by !_WIN32, matching the
existing Windows/POSIX split in the file.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add -D__NuttX__ to CMAKE_C_FLAGS_INIT and CMAKE_CXX_FLAGS_INIT in
toolchain.cmake.in so that all cross-compiled micro-ROS packages see the
NuttX target macro. Without this, rcutils/src/process.c follows the
__linux__ branch and references program_invocation_name, a glibc-only
extension absent from the NuttX C library.
Pair with 0002-rcutils-process-nuttx-compat.patch which additionally
guards the linux branch with !defined(__NuttX__), ensuring the embedded
fallback path is taken on NuttX even if the host compiler defines any
linux-flavoured macros.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Mirror the Makefile build pipeline into CMakeLists.txt using
ExternalProject_Add so that CMake-based NuttX builds (cmake --build)
can also produce libmicroros.a. The external project delegates to the
existing Makefile targets, then exposes the result via an IMPORTED
STATIC library target with correct INTERFACE_INCLUDE_DIRECTORIES.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
NuttX defines DIR as a struct type in dirent.h. The rcutils filesystem
source has a bare typedef int DIR that triggers a redefinition error when
NuttX system headers are on the include path. Guard it with #ifndef DIR
so the typedef is skipped when the type is already defined.
Applied automatically during the micro_ros_src/src fetch step with
patch -p1 --forward --ignore-whitespace ... || true
so the build is idempotent if the upstream ever merges a fix.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
When CONFIG_SYSTEM_MICROROS=y, add the prebuilt libmicroros.a to LDLIBS
and the colcon-installed include/ tree to CFLAGS/CXXFLAGS so that any
application in nuttx-apps can include micro-ROS headers and link against
the library without extra flags.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add toolchain.cmake.in and include_override/assert.h for the colcon
cross-build. Key differences from the old robertobucher port:
- Drop -DCLOCK_MONOTONIC=0: NuttX defines CLOCK_MONOTONIC=1 and
the override broke nanosleep() on newer kernels.
- CMAKE_SYSTEM_PROCESSOR is a placeholder substituted per-arch.
- include_override/assert.h works around the rosidl NDEBUG issue
(https://github.com/ros2/rosidl/pull/739).
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add a colcon.meta.in template that is substituted at build time with
Kconfig values. Key settings:
- Custom transport only (UCLIENT_PROFILE_CUSTOM_TRANSPORT=ON,
UCLIENT_PROFILE_STREAM_FRAMING=ON) -- actual UDP/serial callbacks
are wired in Phase 4.
- RCL_MICROROS=ON (Jazzy/Kilted renamed flag replacing the old
RCL_COMMAND_LINE_ENABLED/RCL_LOGGING_ENABLED pair).
- RCUTILS_NO_FILESYSTEM=OFF -- NuttX provides POSIX filesystem.
- Resource limits use @MAX_NODES@/@MAX_PUBLISHERS@ etc. placeholders
substituted from CONFIG_MICROROS_MAX_* Kconfig values.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add micro_ros_lib/ subdirectory with a .keep sentinel so the directory
is tracked by git before any generated build artifacts appear. All
colcon/fetch outputs land here and are gitignored by the parent .gitignore.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
The settings save path no longer re-enters g_settings.mtx, so the mutex does not need to be initialized as PTHREAD_MUTEX_RECURSIVE.
This keeps the #3105 fix independent of CONFIG_PTHREAD_MUTEX_TYPES and destroys the temporary mutex attribute object after initialization.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Fix#3105 by making the immediate save path write pending settings while the caller still owns g_settings.mtx instead of calling the timer callback, which locks the same mutex again.
The cached-save timer callback still takes the mutex before using the same locked helper, so asynchronous saves keep their existing synchronization while non-cached saves no longer depend on a recursive mutex.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Close the temporary file descriptor when create_files() fails after open(), and release the read buffer before returning from the path-length failure branch.
This is logically separable from the #3205 stale-directory fix: it does not change how existing /sd/stress is handled, but keeps the same failure paths from leaking resources while the stress test exits after an error.
The scope intentionally stays within sd_stress failure cleanup and does not touch SD/MMC transfer behavior or other testing drivers.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Fix#3205 by removing stale sdstress work directories left by previous interrupted or failed runs before starting a new test.
The cleanup only removes entries matching the generated tmpNNN file pattern. If the directory contains any unexpected entry, the test fails instead of deleting user data.
Also make create_dir() and remove_dir() use their path argument instead of the fixed temporary directory names.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Extend the allocation-failure check to httpd_strdup(), the thttpd-local wrapper that has the same failure contract as strdup().
This is logically separable from the direct strdup()/asprintf() fixes: it prevents using hs->hostname before checking whether the wrapped string allocation succeeded, and releases the partially allocated server state on failure.
The scope intentionally does not extend to malloc(), calloc(), or other raw allocators because #1727 specifically calls out strdup()/asprintf(), and covering all allocation APIs would make this PR much broader.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add missing failure handling for direct strdup() and asprintf() calls where the allocated result is consumed locally before any NULL/error check.
This keeps the scope to the functions named in #1727 and avoids changing pass-through return sites where callers already receive NULL on allocation failure.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add Kconfig, build rules, and ignore entries required to build and
package libffi as a standalone system component.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Use the hello_rust_cargo-specific Kconfig symbols for the built-in
application stack size and priority.
Previously, CMake referenced the generic hello example symbols, so the
configured hello_rust_cargo stack size could be ignored.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Remove refenrences to PULSECOUNT from PWM example.
Pulse count driver will be handled by separate application.
Signed-off-by: raiden00pl <raiden00@railab.me>
Fix the reported typo warnings and ignore the V4L2 parm field name in apps codespell configuration, matching the main NuttX repository.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Open the LP503X device with O_WRONLY because the driver registers the device node with write-only permissions and the example controls it through ioctl().
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add missing mode arguments to direct open() calls that use O_CREAT.
Also open the lp503x device with explicit read-only flags instead of O_CREAT, matching the device-node usage.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Pass explicit open flags for the NSH script redirect file so the mode argument is used as file creation permissions.
Add the missing mode argument to AIO ostest open() calls that create the test file.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Now that time_t is unconditionally 64-bit (signed int64_t) and the
struct timespec fields tv_sec / tv_nsec are wide enough on their own,
the explicit (uint64_t)/(int64_t)/(int) casts that used to guard the
multiplications and subtractions in *_us / *_ms / *_ns helpers are no
longer needed. Drop them to keep the timekeeping math readable.
In the same spirit, this commit also normalises the printf-style format
specifiers and casts used to print tv_sec / tv_nsec / tv_usec values.
The prior code was a mix of "%d"/"%u"/"%ld"/"%lu"/"%lld" with matching
(int)/(unsigned long)/(long long) casts; some formats truncated time_t
on 32-bit hosts, others mismatched signedness or width. Replace all
such cases with the portable POSIX-recommended forms:
- tv_sec (time_t, signed, impl-defined width) -> %jd + (intmax_t)
- tv_nsec (long, signed) -> %ld (no cast)
- tv_usec (suseconds_t / long) -> %ld (no cast)
Also drop two stale `(FAR const time_t *)&ts.tv_sec` casts that are
unnecessary now that ts.tv_sec is plain time_t.
Arithmetic-cleanup files (existing scope):
- benchmarks/cyclictest/cyclictest.c: timediff_us()
- benchmarks/sd_bench/sd_bench_main.c: get_time_delta_us()
- examples/oneshot/oneshot_main.c: maxus computation
- examples/watchdog/watchdog_main.c: current_time_ms (x2)
- industry/nxmodbus/nxmb_internal.h: nxmb_util_clock_ms()
- netutils/ntpclient/ntpclient.c: timespec2ntp()
- netutils/ptpd/ptpd.c: ptp_adjtime()
- system/dd/dd_main.c: elapsed accounting
- testing/drivers/drivertest/drivertest_posix_timer.c:
get_timestamp()
- testing/drivers/sd_stress/sd_stress_main.c:get_time_delta()
- testing/sched/getprime/getprime_main.c: elapsed accounting
- testing/sched/pthread_mutex_perf/pthread_mutex_perf.c:
timespec_avg()
Printf-format-fix files (new in this revision):
- examples/adjtime/adjtime_main.c
- examples/charger/charger_main.c
- examples/netpkt/netpkt_ethercat.c
- fsutils/mkfatfs/mkfatfs.c
- graphics/tiff/tiff_initialize.c
- netutils/ptpd/ptpd.c
- nshlib/nsh_timcmds.c
- system/coredump/coredump.c
- system/ptpd/ptpd_main.c
- testing/drivers/drivertest/drivertest_oneshot.c
- testing/mm/kasantest/kasantest.c
- testing/ostest/semtimed.c
- testing/sched/pthread_mutex_perf/pthread_mutex_perf.c
- testing/sched/timerjitter/timerjitter.c
- testing/testsuites/kernel/time/cases/clock_test_clock01.c
- testing/testsuites/kernel/time/cases/clock_test_smoke.c
No behavioural change.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Add CMakeLists.txt file for CMake build system integration.
Enables the micro-ROS library module to be built using NuttX CMake
build system alongside traditional Make-based builds.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add Makefile with standard NuttX build system integration. Follows
the MENUDESC + Directory.mk pattern used throughout nuttx-apps.
Enables the system/microros module to be built as part of the apps
directory build process.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add Make.defs with copyright header for the micro-ROS library
build system. This establishes the directory structure for Phase 2,
with actual build logic to follow in subsequent steps.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
When ping only receives an IPv6 DNS response, the current command
reports "ping_gethostip" and exits even though ping6 can still
handle the target.
Keep the existing ping and ping6 netutils interfaces unchanged and
add a one-way fallback in the ping command. If IPv4 name resolution
fails, ping will spawn ping6 with the same arguments and let ping6
report the final result.
Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
Add minimal chmod/chown support to NSH using the
existing libc/VFS syscall interfaces.
Supported forms:
- chmod <octal-mode> <path>
- chown <uid>[:gid] <path>
The chown implementation supports the numeric
ownership forms already handled by the underlying
NuttX chown() implementation, including unchanged
uid/gid semantics via omitted fields.
Only numeric permission modes and numeric uid/gid
forms are supported in this initial implementation.
This adds interactive filesystem permission and
ownership management support to NSH and aligns the
shell more closely with standard POSIX environments.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
This commit enables using `pip` as a pre-compiled (pyc) built-in
distributed along with cpython.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
* Add Rust target conversion support for `aarch64` on acOS/Linux (and Linux `arm`).
* When a Rust target is unsupported and results in an empty configuration, trigger a CMake `FATAL_ERROR`.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
The LTP open_posix_testsuite header timespec.h has, since 2019:
#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
When time_t is 64 bits (the default after sched/remove-system-time64),
the shift reaches the sign bit of the underlying type and toolchains
emit -Wshift-count-overflow, which the LTP build promotes to a hard
error via -Werror. This breaks rv-virt/citest and rv-virt/citest64
on CI.
The diagnostic is benign here (TIME_T_MAX itself is correct) and the
defect is in upstream LTP, so disable the warning alongside the other
'should be removed in the future' relaxations until upstream is fixed.
Signed-off-by: xiaoxiang781216 <xiaoxiang781216@gmail.com>
Refactor netlib_check_ipconnectivity() to use gateway/router ping instead
of DNS server ping for network connectivity checks. Add IPv6 support.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Update the column ruler and field labels in route_ipv6_entry comment
to match the actual output: lowercase to uppercase, remove colons.
Consistent with Nuttx definition
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
github infra is not stable so even "git clone" from github repos can fail with error: 500.
With this commit we try to clone repo few more times.
Signed-off-by: raiden00pl <raiden00@railab.me>
Align with the upstream nuttx change that drops the sclock_t alias now
that clock_t is itself a signed 64-bit type (int64_t). Beyond the pure
sclock_t -> clock_t rename, this commit also removes the
now-unnecessary (time_t)-1 / (time_t)0 / (off_t)-1 casts that were
papering over the previously-unsigned time_t.
Files touched:
- examples/alarm/alarm_main.c: sclock_t -> clock_t
- netutils/dhcpd/dhcpd.c: sclock_t -> clock_t
- netutils/ftpd/ftpd.c: sclock_t -> clock_t
- netutils/thttpd/libhttpd.c,
netutils/thttpd/tdate_parse.c: drop (time_t)-1 / (time_t)0 /
(off_t)-1 sentinel casts
- system/resmonitor/filldisk.c,
system/zmodem/zm_receive.c: sclock_t -> clock_t
- testing/ostest/wdog.c: sclock_t -> clock_t (the bulk
of the rename, 30 sites)
- testing/testsuites/kernel/syscall/cases/{clock_nanosleep_test,
fsync_test,time_test}.c: drop (time_t)-1 casts in the
new signed-time_t world
No behavioural change.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
NuttX always uses a 64-bit system clock now (time_t/clock_t are
always 64-bit). Remove the obsolete CONFIG_SYSTEM_TIME64 #ifdef
branches and Kconfig dependency.
- examples/dronecan: drop SYSTEM_TIME64 dependency
- examples/netlink_route: always use PRIx64
- netutils/netinit: always use the 1-hour LONG_TIME_SEC
- netutils/ptpd: always pack the 48-bit seconds field and apply
the 64-bit overflow guard in timespec_delta_ns()
- testing/ostest/semtimed: always validate tv_sec >= 0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
The matching nuttx commit removes CONFIG_HAVE_LONG_LONG; clean up the
remaining users in nuttx-apps so that "long long" is always assumed:
- examples/noteprintf, examples/nxscope:
unconditionally exercise the %lld / long long branch.
- fsutils/mkfatfs/configfat.c:
drop the 32-bit fall-back paths in mkfatfs_nfatsect12/16/32;
always use uint64_t for the FAT-size arithmetic.
- logging/nxscope/nxscope_chan.c:
drop the CONFIG_HAVE_LONG_LONG guard around the 64-bit
sample helpers.
- netutils/ftpd, netutils/ntpclient:
always emit the 64-bit format strings.
- testing/fs/fstest/fstest_main.c:
drop the parallel 32-bit verification path; keep only the
64-bit (long long) random pattern generator.
- system/zmodem/host/nuttx/compiler.h:
remove the host-side CONFIG_HAVE_LONG_LONG stub macro.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
BREAKING: In an effort to simplify board initialization logic for NuttX,
NSH will no longer support architecture initialization. This will happen
during boot via the BOARD_LATE_INITIALIZE option. The boardctl command
BOARDIOC_INIT is also no longer available from user-space.
Quick fix:
Any application relying on BOARDIOC_INIT should now enable
BOARD_LATE_INITIALIZE to have initialization performed by the kernel in
advance of the application running. If control over initialization is
still necessary, BOARDIOC_FINALINIT should be implemented and used.
Boards relying on NSH for initialization should also enable
BOARD_LATE_INITIALIZE instead.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
it's not needed and cause warnings for C++ builds:
cc1plus: warning: command-line option '-Wno-pointer-to-int-cast' is valid for C/ObjC but not for C++
Signed-off-by: raiden00pl <raiden00@railab.me>
Update lvlg version to 9.2.2, includes fix for nuttx lcd release
Get version from config in Makefile
Get version from config in cmake file
Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
Use the DHCP-learned NTP server list as the default ntpc server source when DHCP option 42 is available.
Fall back to CONFIG_NETUTILS_NTPCLIENT_SERVER only when DHCP does not provide any NTP servers, and restart ntpc when the DHCP-provided server list changes.
Signed-off-by: Jerry Ma <masc2008@gmail.com>
Request DHCP option 42 and store the returned IPv4 NTP server
addresses in struct dhcpc_state for later consumers.
Signed-off-by: Jerry Ma <masc2008@gmail.com>
Add a minimal VNC viewer application that connects to a VNC server
and renders the remote desktop on a local LCD.
Features:
- RFB 3.8 protocol with VNC Authentication (DES, pure software)
- Raw encoding with pixel format auto-detected from LCD driver
- Row-by-row rendering via LCDDEVIO_PUTAREA (minimal RAM usage)
- LCD resolution and format queried at runtime via LCDDEVIO_GETVIDEOINFO
- Auto-reconnect on connection loss with 2-second retry
Usage:
vncviewer <host> [port]
vncviewer -p <password> <host> [port]
vncviewer -p <password> -d <lcd_devno> <host> [port]
Assisted-by: GitHubCopilot:claude-4.6-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Let `irtest` command line size be equal to CONFIG_LINE_MAX so that
bigger (or smaller) commands can be set.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Long write_data commands can be truncated without any check due to
the maximum size of CONFIG_SYSTEM_IRTEST_MAX_SIRDATA. This commit
adds a check to avoid a silent fail.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
This commit fixes issues regarding portability by using variables
with fixed width (and their format macro constants).
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
The upper-half RMT driver is no longer available on NuttX. Instead,
Espressif's RMT peripheral was bound directly to the lirc driver.
For testing purposes, use the `irtest` application. NuttX OS PR
https://github.com/apache/nuttx/pull/18654 removed the upper-half
driver interface used by this application, so removing it does not
break any existing feature on NuttX.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
NxModbus is a lightweight Modbus protocol stack implementation for NuttX RTOS.
This commit adds:
- nxmodbus stack
- nxmbserver - Modbus Server (Slave) example
- nxmbclient - Modbus Client (Master) tool
Supported Modbus transports:
- ASCII
- RTU over serial port
- TCP
- RAW (ADU) for custom transport implementations
Signed-off-by: raiden00pl <raiden00@railab.me>
Modbus is a protocol mostly used on industries and since it is a
protocol it is not a category to be at root of apps/
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Modbus is a protocol mostly used on industries and since it is a
protocol it is not a category to be at root of apps/
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Value zero in tm_isdst means daylight saving time (or summer
time) is not in effect. This is obviously not true for half of the year
in most timezones and keeping it at zero leads to incorrect time
being set. This commit sets tm_isdst to -1, which means the information
is not available and it should be handled according to timezone rules.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Use "Hello, language" scheme to keep the naming consistency with other
Hello World applications for different languages.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Clean up style issues in the files touched by the <nuttx/debug.h> include
migration so the full apps-side PR passes checkpatch.
Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
Replace app-side includes of <debug.h> with <nuttx/debug.h> to use the
header from the NuttX tree explicitly after the header move.
Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
Add -m command line option to enable horizontal mirror on the
camera sensor via VIDIOC_S_CTRL + V4L2_CID_HFLIP. This uses
the sensor hardware mirror (e.g. GC0308 register 0x14 bit[0])
with zero CPU overhead.
Also refactor parse_arguments to use a loop-based parser so
options can appear in any order.
Usage: camera 0 -m (mirror preview)
camera -jpg -m (mirror still capture)
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Some image sensors on 8-bit DVP buses (e.g. GC0308) produce RGB565X
(big-endian) pixel data — the high byte is clocked out first and
stored first in PSRAM by the ESP32-S3 CAM controller.
The V4L2 framework does not negotiate formats automatically, so try
RGB565 first and fall back to RGB565X if S_FMT fails.
When the sensor reports RGB565X:
- Invalidate D-Cache after DQBUF so the CPU reads fresh DMA data
- Byte-swap each pixel in place from BE to LE RGB565 for display
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Use MMAP buffer allocation by default so the driver can manage
DMA-capable memory with proper alignment and cache attributes.
Fall back to USERPTR if the driver does not support MMAP.
Also fix NX framebuffer stride calculation to use the actual
display width instead of hardcoded values.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
The patch step currently uses a phony target, so it is executed
again when the build is repeated in the same source tree. In that
case `patch -N` detects previously applied patches and returns 1,
which make treats as a failure.
Replace the phony patch target with a stamped `.patched` file so
the patch step is not re-run unnecessarily.
Fixes#3188
Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
This is necessary because new defconfig were recently added to
Xtensa-based Espressif SoCs and the build job may exceed 2 hours.
In order to avoid increasing job timeout, a specific job for each
supported SoC (ESP32, ESP32-S2 and ESP32-S3) was created instead.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
This adds support for testing PBKDF2 implementation. Test
vectors for SHA1 are taken from RFC6070. SHA256 vectors
were extrapolated using an online PBKDF2 generator which
was checked against RFC6070.
Signed-off-by: Vlad Pruteanu <pruteanuvlad1611@yahoo.com>
Fix mismatch on apps directory naming when it is cloned under 'nuttx-apps' instead of 'apps'.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
When a command has no arguments (e.g., 'q', 'quit', 'stop'), the strtok_r()
function returns NULL for the arg parameter. The argument trimming loop was
dereferencing this NULL pointer without checking, causing undefined behavior
and system hang on ESP32-S3.
This commit adds a null check before dereferencing the arg pointer in the
leading space trimming loop.
Tested on ESP32-S3 (lckfb-szpi-esp32s3) - quit command now works correctly.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
SOCK_CLOEXEC and SOCK_NONBLOCK were incorrectly passed as the
third argument (protocol) instead of being OR'd into the second
argument (type). This caused socket() to fail with EPROTONOSUPPORT
(errno 93) on NuttX.
Move SOCK_CLOEXEC | SOCK_NONBLOCK to the type parameter and set
protocol to 0.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
fix compilation error:
sensorscope_main.c:314:3: error: implicit declaration of function 'list_initialize'; did you mean 'fs_initialize'? [-Wimplicit-function-declaration]
Signed-off-by: raiden00pl <raiden00@railab.me>
The header variable in nxboot_perform_update() is no longer
used after validate_image() was changed to take only the fd.
Signed-off-by: Neil Berkman <neil@xuku.com>
The comment previously stated CRC was not calculated before
boot. This is no longer accurate after adding full image CRC
validation in validate_image().
Signed-off-by: Neil Berkman <neil@xuku.com>
Two hardening fixes for nxboot power-loss resilience:
1. Add flash_partition_flush() calls between critical partition
operations in perform_update(). Without explicit flush barriers,
writes may remain buffered in RAM (e.g. via FTL rwbuffer) when
nxboot proceeds to the next phase. A power loss between phases
can leave the recovery image uncommitted while the staging
partition has already been consumed.
Flush points added:
- After copy_partition(primary, recovery) completes
- After copy_partition(update, primary) completes, before
erasing the staging first sector
2. Replace validate_image_header() with validate_image() in the
final primary validation path of nxboot_perform_update(). The
header-only check validates magic and platform identifier but
does not CRC-check the image body. After an interrupted update,
a corrupt primary with an intact header would pass this check
and be booted, resulting in a persistent boot failure.
Signed-off-by: Neil Berkman <neil@xuku.com>
Add missing #include <sys/boardctl.h> in camera_bkgd.c to fix
implicit declaration of boardctl() and undeclared BOARDIOC_NX_START.
Also fix capture_num check in camera_main.c to only apply still
capture size enumeration when capture_type is STILL_CAPTURE.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
rmtchar_main.c is coming after rmtchar_common.c, which causes an
undefined reference error. This change fixes the problem.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
Remove quotes around target-pointer-width values in i486 and x86_64
target configuration files to change from string to numeric type.
This change is required due to recent rustc JSON format modifications
that expect numeric values instead of strings for target-pointer-width.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
X86 support for Rust needs more test and verification, and not
upstreamed to Rust side yet.
It's better to use custom target triples for x86 by json files for now,
and it can be upstreamed to Rust side if stable enough.
Changed the Rust target triples in the CMake configuration to reference JSON files for x86_64 and i486 architectures. This improves the build process by providing more detailed target specifications.
* Added JSON files for i486 and x86_64 targets
* Updated CMake functions to use the new target triples
* Enhanced build directory structure for Rust crates
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
ARCHTYPE is a valid abbreviation for 'architecture type' used
consistently across the codebase. This matches the nuttx repo's
.codespellrc configuration.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Replace deprecated -Zbuild-std-features=panic_immediate_abort with
-Cpanic=immediate-abort compiler flag via RUSTFLAGS.
The panic_immediate_abort feature has been stabilized as a real panic
strategy in recent Rust nightly versions. The old method of enabling
it via -Zbuild-std-features is no longer supported and triggers a
compile error in core/src/panicking.rs.
Changes:
* cmake/nuttx_add_rust.cmake: Use RUSTFLAGS with -Cpanic=immediate-abort
* tools/Rust.mk: Use RUSTFLAGS with -Cpanic=immediate-abort
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Use PRIdOFF instead of %ld for off_t arguments in flash.c syslog
calls, fixing -Wformat errors when off_t is not long.
Change nxboot_progress parameter from enum progress_type_e to int
to avoid undefined behavior from va_start on a parameter that
undergoes default argument promotion (-Wvarargs).
Signed-off-by: Neil Berkman <neil@xuku.com>
Modify the switch cases in parsearg function for QOS levels definition.
The comparison was made between a long value and a char.
Signed-off-by: Mihai Pacuraru <mpacuraru@protonmail.com>
This commit refactored the hrtimer_test and provided significantly
improved test-cases for both SMP and non-SMP.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
For QEMU, virtual CPUs can be preempted by any high priority thread in
test environments. This can cause the timer to be triggered later than
expected. This commit increased the tolerant latency to avoid the test
failures.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit fixed the hrtimer test.
In a QEMU environment, the hrtimer latency can be arbitrary because vCPUs can be preempted. We can not assert the latency. we can only issue alerts for excessively high latency.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
When NSH_ARCHINIT is not enabled, initialization is to be performed by
boardctl(BOARDIOC_INIT). However, the boardctl header is not included so
this causes compilation to fail. This commit corrects that issue.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This PR replicates the new PR Labeling Workflow from NuttX Repo to NuttX Apps Repo. For Future Syncing:
- Copy from NuttX Repo to NuttX Apps: `.github/workflows/labeler.yml` and `.github/workflows/pr_labeler.yml`
- Edit `.github/workflows/labeler.yml` and change `repository: apache/nuttx` to `repository: apache/nuttx-apps`
- Don't overwrite `.github/labeler.yml` by NuttX Repo
The new workflow reimplements PR Labeling with two triggers: pull_request and workflow_run. We no longer need pull_request_target, which is an unsafe trigger and may introduce security vulnerabilities.
The New PR Labeler is explained here:
- https://lupyuen.org/articles/prtarget
- https://github.com/apache/nuttx/issues/18359
Modified Files:
`.github/workflows/labeler.yml`: Changed the (read-write) pull_request_target trigger to (read-only) pull_request trigger. Compute the Size Label (e.g. Size: XS) and Arch Labels (e.g. Area: Examples). Save the PR Labels into a PR Artifact.
`.github/labeler.yml`: Added comment to clarify that NuttX PR Labeler only supports a subset of the `actions/labeler` syntax: `changed-files` and `any-glob-to-any-file`. Note: Don't overwrite this file by NuttX Repo.
New Files:
`.github/workflows/pr_labeler.yml`: Contains the workflow_run trigger, which is executed upon completion of the pull_request trigger. Download the PR Labels from the PR Artifact. Write the PR Labels into the PR.
Signed-off-by: Lup Yuen Lee <luppy@appkaki.com>
Aligns `CONFIG_INTERPRETER_*` options to `CONFIG_INTERPRETERS_*` options
to be consistent with other interpreters.
BREAKING CHANGE: All configurations using `CONFIG_INTERPRETER_PYTHON_*`
options will no longer compile due to missing symbol errors. The fix is
very quick: any configurations using this options should add a trailing
S following INTERPRETER in the affected Kconfig variables. I believe
`./tools/refresh.sh` should also be capable of doing this automatically.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Aligns `CONFIG_INTERPRETER_*` options to `CONFIG_INTERPRETERS_*` options
to be consistent with other interpreters.
BREAKING CHANGE: All configurations using `CONFIG_INTERPRETER_MINIBASIC_*`
options will no longer compile due to missing symbol errors. The fix is
very quick: any configurations using this options should add a trailing
S following INTERPRETER in the affected Kconfig variables. I believe
`./tools/refresh.sh` should also be capable of doing this automatically.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Aligns `CONFIG_INTERPRETER_*` options to `CONFIG_INTERPRETERS_*` options
to be consistent with other interpreters.
BREAKING CHANGE: All configurations using `CONFIG_INTERPRETER_LUA_*`
options will no longer compile due to missing symbol errors. The fix is
very quick: any configurations using this options should add a trailing
S following INTERPRETER in the affected Kconfig variables. I believe
`./tools/refresh.sh` should also be capable of doing this automatically.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Aligns `CONFIG_INTERPRETER_*` options to `CONFIG_INTERPRETERS_*` options
to be consistent with other interpreters.
BREAKING CHANGE: All configurations using `CONFIG_INTERPRETER_BAS_*`
options will no longer compile due to missing symbol errors. The fix is
very quick: any configurations using this options should add a trailing
S following INTERPRETER in the affected Kconfig variables. I believe
`./tools/refresh.sh` should also be capable of doing this automatically.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Modified CMakeLists.txt, Kconfig, and Makefile to change the cJSON download URL to include 'refs/tags/' for proper version fetching. This ensures compatibility with GitHub's archive download requirements.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Modified the CMakeLists.txt and Makefile to ensure the correct format for downloading the cJSON tarball from GitHub by including 'refs/tags/' in the URL. This change addresses issues with fetching the correct version of the library.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
In an effort to avoid unexpected behaviour from users not calibrating
BOARD_LOOPSPERMSEC, a compilation error occurs when it is undefined. On
some systems, this is allowed (those that use timer implementations
instead of busy-looping for delays). In these cases, we should busy-loop
using the clock time instead of relying on a possibly
undefined/uncalibrated macro.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
removes redundant type casts in ARP-related network library functions.
The casts from req.arp_dev (already a char array) to (FAR char *)
are unnecessary and can be safely removed.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
When using AF_RPMSG (-r option), rexecd was setting the rp_name
to the raw port number, while rexec was using htons(port). This
caused a mismatch where rexec couldn't connect to rexecd.
This commit fixes the issue by applying htons() to REXECD_PORT
when setting rp_name in the AF_RPMSG case, making it consistent
with the rexec client implementation.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Integrate up_perf_gettime() test into ostest suite with comprehensive
test coverage including monotonicity verification, interval statistics,
and frequency validation. The test verifies performance event counter
functionality across 5 independent test cases with proper error handling.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
change nvs module testcase name TESTING_MTD_CONFIG_FAIL_SAFE
to TESTING_MTD_CONFIG_NVS and modify the configuration names
related to mtdconfig testing.
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
If device automatically enters the ymodem rb mode when it starts up,
the PC tool does not need to send rb command anymore. Here, when a
specified number of consecutive 'C' are received, the subsequent
ymodem protocol content will continue.
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
Move NIST Statistical Test Suite (nist-sts) testing module from testing/drivers/
into testing/drivers/rng/ directory to better organize RNG (random number generator)
related tests that utilize /dev/random device.
Changes:
- Create testing/drivers/rng/ directory structure
- Move nist-sts from testing/drivers/ to testing/drivers/rng/nist-sts
- Update build configuration file paths:
- CMakeLists.txt
- Makefile
- Make.defs
- Maintain all test patches and Kconfig settings
Signed-off-by: makejian <makejian@xiaomi.com>
Reduce TEST_NUM from 1000 to 100 in fs_opendir_test.c
Reduce loop count from 100 to 30 in fs_stream_test.c
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
Remove unnecessary usleep(1000) in the read thread of eventfd test.
The eventfd read operation will block and wait for data naturally via semaphore, no additional delay is needed.
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
Replace sleep() with pthread_join() to properly wait for the child thread to finish, avoiding orphan threads.
Change sleep(1) to usleep(1000) to reduce test time while maintaining synchronization.
Fix loop iteration count mismatch between reader thread (6 iterations) and writer (5 iterations).
Signed-off-by: ligd <liguiding1@xiaomi.com>
Fix file descriptor leak issue where fd was stored in test_state for deferred close, but could fail when CONFIG_FDCHECK is enabled because fd cannot be closed in a different thread.
Signed-off-by: guohao15 <guohao15@xiaomi.com>
Since the kernel spinlocks can only work in flat mode, this commit
allowed spinlock_test only in flat mode.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit refactored the spinlock test for better accuracy and
minimized jitters introduced by scheduling.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
When expanding the macro VERIY, (0 == pthread_barrier_wait(¶m->pub->barrier)) < 0 always false.
Regardless of the value of its operands.
Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
If we updated `callback_cnt` before the `triggered_tick` in the wdog timer callback, the `wdtest_rand` might failed randomly. This commit fixed the synchronizing bug by swapping the execution order of updating.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit increased the default interval of the timerjitter to avoid errors with large USEC_PER_TICK setting.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit fixed the wrong-test case where the time is acquired after
the timer being set, leading to the assertion failure.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
On SIM and QEMU, it is inevitable that the simulating vCPU got preempted
by other threads, causing large timing delay. This commit relax the timing
constraints to reduce the CT error.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Since sim and qemu are not cycle accurate simulators, if the vCPU thread is preempted by other high priority tasks, it may cause timing issues. This is easy to happen when the test machine is busy. This commit modifies the condition of timing error and prints out the latency as a warning.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Introduce CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC configuration option to enable
critical section protection in the FOC (Field-Oriented Control) motor control
examples. This adds irq-safe critical sections around the main control loop
processing to prevent race conditions and ensure atomic updates of motor
control state and parameters during interrupt handling.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit implements stderr redirection in HSN, support
Bash-like syntax for redirecting standard error output.
Support both foreground and background commands.
example:
- nsh> ls noexists 2> err.log
- nsh> ls noexists 2> err.log &
- nsh> ls noexists 2>> err.log
- nsh> sh < /dev/ttyS0 > /dev/ttyS0 2> /dev/ttyS1 &
- nsh> sh < /dev/ttyS0 > /dev/ttyS0 2>&1 &
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Initialize the flags variable to 0 to fix compiler warning about
potential use of uninitialized variable. The flags variable is
conditionally assigned in wdtest_rand() based on callback count.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
remove test_state of fs test cases
Removes unnecessary test_state structure usage for tracking file descriptors
Adds missing close(newfd) call in fs_dup_test.c to prevent file descriptor leaks
Simplifies test code by eliminating redundant fd tracking that could lead to incorrect resource management
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
This patch adds support for dumping binary contents from noteram via the
`trace dump -b <file>` command. Changes include:
- Add a `binary` parameter to `trace_dump()` and the public header
`system/trace/trace.h` to indicate binary output mode.
- Update `trace_dump()` to set the noteram read mode to binary using
`NOTERAM_SETREADMODE` when requested.
- Update `trace dump` CLI parsing in `system/trace/trace.c` to accept
the `-b` flag and pass it through to `trace_dump()`.
- Update usage/help text to include the new `-b` option.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
Fix cast from pointer to integer of different size to ensure
proper type conversion and avoid compilation warnings.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Add unistd.h header file to drivertest_touchpanel.c to fix missing
sleep/usleep function declarations in touchpanel driver tests.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Add unistd.h and pthread.h for memorystress_main.c, unistd.h for
dhm.c and cachetest_main.c, and pthread.h for kv_test_019.c to fix
missing declarations.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Add missing header files in netutils and lsan modules to fix
implicit function declarations and improve compilation compatibility.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Add malloc.h header file to fstest.h to fix missing malloc/free
function declarations in filesystem test suites.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Inline enter_critical_section function calls in performance-critical
paths to reduce function call overhead while maintaining consistent
semantics, improving overall system latency and responsiveness in
real-time scenarios.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
BARE is a simple binary representation for structured application data.
cbare, the BARE implementation ported by this commit, is an I/O agnostic
C implementation of the BARE message encoding.
Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
- crypto/mbedtls: Add -Wno-cpp flag to suppress warnings
- interpreters/quickjs: Add flags to suppress warnings
- lte/alt1250: Fix spelling issues in comments
- system/dd: Add missing includes for modern compilers
- system/zlib: Add -Wno-cpp flag
- testing/cxx: Include missing algorithm header
Signed-off-by: Bartosz <bartol2205@gmail.com>
Fix buffer offset calculation in ymodem_send_buffer() to correctly
handle partial writes by advancing the buffer pointer and adjusting
the remaining size on each retry.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
To replace the large lock with smaller ones and reduce the large locks related to the TCB,
in many scenarios, we only need to ensure that the TCB won't be released
instead of locking, thus reducing the possibility of lock recursion.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Fixes a bug where newfd is not properly closed when newfd[0] equals newfd[1].
This can cause file descriptor leaks in certain edge cases where the read
and write sides of the pipe are duplicated.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
There are three bug in fifo testcase.
1. line 211 and line 295 should be nbytes not ret.
2. coverity report error:
CID 1667262: (#4 of 11): Double close (USE_AFTER_FREE)
11. double_close: Calling close(int) will close the handle fd that has already been closed. [Note: The source code implementation of this function has been overwritten by the built-in model.]
Double close will ocurr when line 234 is true and goto line 341, close again!
Now, Using the previous code logic, Use a tid and an errout_with_null_thread to avoid uninitialized problems.
3. since line 295 is used ret not nbytes, error not expose before.
When the end of read and write are opened, end of write will write successfully even if end of read not read.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
This test depends on !DISABLE_POSIX_TIMERS.
arm-none-eabi/bin/ld:
apps/examples/popen/libapps_popen.a(popen_main.c.obj):
in function `popen_main':
apps/examples/popen/popen_main.c:62:(.text.popen_main+0x1c):
undefined reference to `timer_create'
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
Skip UDP listen test when CONFIG_NET_UDP is disabled to prevent
test failures on configurations without UDP support.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Handle fdcheck path for badfd test to prevent unexpected dumps when
fdcheck is enabled, allowing proper testing of bad file descriptor
error cases.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Guard fdcheck-sensitive paths in setsocketopt, dup2, and fsync tests
to avoid assertion failures when fdcheck is enabled, ensuring tests
can properly verify error handling behavior.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Drop unnecessary casts in driver_audio_test to silence compiler
warnings and improve code clarity.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Adjust net socket test expectations for correct behavior to prevent
false test failures in network socket test cases.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Fix timerjitter output formatting for date/time fields to match
expected format and improve test result readability.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Correct date formatting in cache_test and arch_lib_test outputs to
ensure consistent date/time display format across test results.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Specify architecture format in Kconfig to ensure proper configuration
handling for different architectures in testing modules.
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
Remove the extra rngctx parameter from SSL_CTX_new() to match
the standard OpenSSL API signature:
SSL_CTX *SSL_CTX_new(const SSL_METHOD *method)
This improves compatibility with code written for OpenSSL.
Signed-off-by: makejian <makejian@xiaomi.com>
Map mbedtls error codes to OpenSSL standard return codes in
SSL_connect/SSL_do_handshake:
- Return 1 on success
- Return 0 on controlled shutdown
- Return -1 on fatal error (was returning mbedtls error codes)
This aligns the return values with OpenSSL specification where
SSL_get_error() should be called to get the actual error reason.
Signed-off-by: makejian <makejian@xiaomi.com>
Export SSL_CTX_load_verify_file() and SSL_CTX_load_verify_dir()
interfaces to allow loading CA certificates from file or directory.
Signed-off-by: makejian <makejian@xiaomi.com>
Change FPU benchmark timing from seconds to milliseconds for better accuracy.
This allows for more precise measurement of test cycles, especially for
shorter test runs that previously completed within a single second.
Signed-off-by: makejian <makejian@xiaomi.com>
Add the Whetstone floating-point benchmark to NuttX applications.
The Whetstone benchmark is a widely-used tool for evaluating FPU
(floating-point unit) performance.
This benchmark is ported from netlib.org whetstone.c which has a
custom permissive license requiring attribution. Therefore it
depends on ALLOW_CUSTOM_PERMISSIVE_COMPONENTS.
Usage: whetstone [loops]
Signed-off-by: makejian <makejian@xiaomi.com>
NNG depends on options that, if not enabled, makes compilation or
runtime crashes. Noting these options in help helps to find out which
are such options.
Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
fix:
Building NuttX...
/d/a/nuttx-apps/nuttx-apps/sources/apps/Application.mk:238: target 'signest.c.d.a.nuttx-apps.nuttx- apps.sources.apps.testing.ostest.o' given more than once in the same rule
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Merge the cu.h header file contents into cu_main.c to simplify the
code structure. The cu_globals_s structure and related definitions
are now directly in cu_main.c.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
The sigint() function uses siginfo->si_user but was declared with
only one parameter (int sig). This causes compilation error because
siginfo is undeclared.
Fix by:
1. Rename sigint to cu_exit with proper sigaction signature
2. Use sa_sigaction instead of sa_handler to receive siginfo_t
3. Pass cu pointer via sa.sa_user for signal handler access
Signed-off-by: makejian <makejian@xiaomi.com>
standardize the implementation of ping6 to better comply with socket
permissions on certain systems.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This assertion should be removed because the POLLIN event is now only
raised when there is data pending to be received. Previously, POLLIN
was incorrectly set as soon as the connection was established, even
when no data was available, which was not consistent with the expected
behavior.
Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
When we support the watchdog interrupt on the Armv7-A platform with
the TEE enabled, the watchdog interrupt needs to be configured as
a FIQ to avoid the impact of interrupt disabling in the AP.
In this case, the drivertest_watchdog_api testcase cannot pass the
test in such a scenario.
This is because the drivertest_watchdog_api itself requires
calling a specified callback after the watchdog interrupt is
triggered, instead of directly dumping the AP's context and
then asserting the system.
Therefore, when both CONFIG_ARCH_ARMV7A and CONFIG_ARCH_HAVE_TRUSTZONE
are enabled, we need to skip the current drivertest_watchdog_api
testcase.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
Add UNIX platform flag to tinycrypto build configuration to enable access to /dev/random for secure random number generation.
Signed-off-by: makejian <makejian@xiaomi.com>
tests only supports tests in non-encrypted mode. when we open tests
compilation in other modes, there will be many compilation warning
with mismatched parameter types, and it will not run correctly.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
In some scenarios, dynamic memory allocation is not allowed, so it is modified to a static allocation method.
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
Update the libuv NuttX port patch to change sendmsg() parameter from
"struct msghdr *msg" to "const struct msghdr *msg" in the NuttX-specific
implementation stub. This maintains compatibility after NuttX's socket API
was made POSIX-compliant with const-correct parameters.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
Add CMakeLists.txt for the RAMSpeed benchmark application, enabling it to
be built with the CMake build system alongside the existing Makefile-based
build. This ensures consistent build behavior across build systems.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
Improve the behavior of the ARP table so that the manually configured
ARP table has the highest priority, can only be manually modified to
other values, otherwise will never change again, and will not time out.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
if defined CONFIG_EXAMPLES_ELF and CONFIG_EXAMPLES_MODLUE,
elf will generated BINDIR, so generated symtab will interference.
It supports inputting multiple specified files in mksymtab.sh to
avoid interference.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
the kernel can only prevent the concurrency of s/getsockopt, but
iptables will call these interfaces multiple times at a time. We
need to wait for one iptables to complete before executing the second
one, otherwise the data will be overwritten.
iptables flow:
get current iptables entries [1] -> add new entry 2 [1,2] -> set to kernel [1,2]
get current iptables entries [1] -> add new entry 3 [1,3] -> set to kernel [1,3]
entry 2 is lost
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
The ping socket creation method is changed from SOCK_DGRAM to SOCK_RAW,
because SOCK_DGRAM may not have permission in some environments (e.g. Docker).
Also add checksum calculation when send, and perform IP header processing when receive.
Signed-off-by: daichuan <daichuan@xiaomi.com>
the configured mask should be in network byte order, but the logic here
calculates it as host byte order.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Fix dependency issue when signals are partially or fully enabled
Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Add netlib_check_httpconnectivity() to verify HTTP service connectivity by sending GET request and validating status code.
Signed-off-by: meijian <meijian@xiaomi.com>
BREAKING CHANGE
This commit introduces a Kconfig switch to include the cmocka binary
built from cmocka_main.c. The default behaviour is now changed so that
cmocka is built as a library only, which would be the desired behaviour
for users creating their own cmocka projects.
To restore the old behaviour (where the cmocka program is compiled), add
CONFIG_TESTING_CMOCKA_PROG=y to your legacy configuration.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Fix a issue of vlan pcp config.
`vconfig add eth0 10` will create eth0.10 with VID=10 and no PCP(0)
`vconfig add eth0 10 3` will create eth0.10 with VID=10 and PCP=3
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
Fix various coding style issues including:
- Case statement formatting
- Include placement and ordering
- Whitespace issues
- Long line formatting
- Bracket alignment
Affected modules:
- audioutils, examples, include
- netutils, system
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Before attempting to sample via NTP, network connectivity should be checked to avoid frequent sampling that could cause network error logs to overflow.
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
The `netlib_check_ipconnectivity` and `netlib_check_ifconnectivity` functions depend on the `NETUTILS PING` configuration item. When `NETUTILS PING` is not enabled, a compilation error will occur; therefore, an empty macro definition is added.
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
Now we allow setting a default PCP when creating VLAN like:
`vconfig add iface-name vlan-id [pcp]`
e.g.
`vconfig add eth0 10` will create eth0.10 with VID=10 and no PCP(0)
`vconfig add eth0 10 3` will create eth0.10 with VID=10 and PCP=3
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
We add devname in ping_info_s, but not initializeed, cause
data abort as value in stack possible not NULL.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Add complete integration for the MicroQuickJS JavaScript interpreter,
supporting both CMake and Make build systems with automatic source
acquisition.
Key features:
* FetchContent downloads mquickjs from bellard/mquickjs if local
git repository is not available in interpreters/mquickjs/mquickjs/
* Builds mqjs_stdlib host tool to generate mqjs_stdlib.h and
mquickjs_atom.h headers during build
* Creates libmquickjs library with proper header generation dependencies
to prevent parallel build failures
* Provides mqjs NSH application for interactive JavaScript execution
* Configurable task priority and stack size via Kconfig options
(INTERPRETERS_MQJS_PRIORITY, INTERPRETERS_MQJS_STACKSIZE)
* Supports both 32-bit and 64-bit architectures with appropriate build flags
Files added:
* CMakeLists.txt - CMake build configuration with FetchContent support
* Kconfig - Configuration options for interpreter features
* Make.defs - Make build definitions
* Makefile - Alternative Make-based build support
* .gitignore - Ignores generated files and local mquickjs source directory
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit add state machine framework lib to the NuttX project. Also an example is added to help users understand and use this feature.
Changes: Added some files. No impact in other features are expected.
Adjust SMF macro names
Fix issues requested during MR review
update kconfig
fix ci-cd issue
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Ref: https://man7.org/linux/man-pages/man7/packet.7.html
We should either set protocal when creating socket or binding, otherwise
we cannot capture any packet.
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
We possible want to use iperf to test rpmsg socket etc.
Fix error when enable iperf and no IPv4
```
arm-none-eabi-ld: warning: ~/nuttx/nuttx has a LOAD segment with RWX permissions
arm-none-eabi-ld: ~/nuttx/staging/libapps.a(iperf_main.c.~.apps.netutils.iperf_1.o): in function `iperf_main':
~/apps/netutils/iperf/iperf_main.c:248:(.text.iperf_main+0x330): undefined reference to `inet_ntoa_r'
arm-none-eabi-ld: ~/apps/netutils/iperf/iperf_main.c:240:(.text.iperf_main+0x354): undefined reference to `netlib_get_ipv4addr'
arm-none-eabi-ld: ~/nuttx/staging/libapps.a(iperf.c.~.apps.netutils.iperf_1.o): in function `iperf_print_addr':
~/apps/netutils/iperf/iperf.c:226:(.text.iperf_print_addr+0x3c): undefined reference to `inet_ntoa'
```
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
The system checks connectivity with the input IP address; if no IP address is provided, it defaults to checking DNS server connectivity.
Signed-off-by: meijian <meijian@xiaomi.com>
The previous method of terminating the dhcp daemon via a global variable has been removed; instead, the `kill pid` command is used. Also, because the original `dhcp_start` method creates tasks via `task_create`, which is not supported in kernel mode, `dhcp_start` is not compiled in kernel mode. The daemon can be started in kernel mode using `dhcpd xxx &`.
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
CONFIG_NETDB_DNSSERVER_NAMESERVERS
Provide a default value for CONFIG_NETDB_DNSSERVER_NAMESERVERS if
CONFIG_NETDB_DNSCLIENT is not enabled
Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
Add support for NTFC testing framework.
At the moment NTFC is downloaded from a private repo,
and installed with pip and venv. In the future NTFC repositories
will be migrated to Apache organization.
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Replace floating-point arithmetic with fixed-point integer math to avoid
linking soft-float library (~2-3KB Flash) when displaying human-readable
file sizes (ls -lh command).
Changes:
- Use integer division and modulo to calculate size components
- Calculate decimal part: (remainder * 10) / unit for one decimal place
- Refactor duplicated code: consolidate GB/MB/KB logic into single path
- Remove CONFIG_HAVE_FLOAT dependency
This eliminates calls to __aeabi_f2d, __aeabi_fmul, __aeabi_i2f and other
ARM EABI floating-point helpers, reducing Flash footprint for systems
compiled with -mfloat-abi=soft.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
The current gPTP stack does not support path delay correction of the Switch.
This patch adds the path delay correction field in the Header.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
fix compile warning when only enable PTPD_CLIENT or PTPD_SERVER
ptpd.c:493:38: error: 'CONFIG_NETUTILS_PTPD_PRIORITY1' undeclared (first
use in this function); did you mean 'CONFIG_NETUTILS_PTPD_CLIENT'?
ptpd.c:494:39: error: 'CONFIG_NETUTILS_PTPD_CLASS' undeclared (first use
in this function); did you mean 'CONFIG_NETUTILS_PTPD_CLIENT'?
ptpd.c:495:39: error: 'CONFIG_NETUTILS_PTPD_ACCURACY' undeclared (first
use in this function); did you mean 'CONFIG_NETUTILS_PTPD_DEBUG'?
ptpd.c:498:38: error: 'CONFIG_NETUTILS_PTPD_PRIORITY2' undeclared (first
use in this function); did you mean 'CONFIG_NETUTILS_PTPD_CLIENT'?
ptpd.c:502:36: error: 'CONFIG_NETUTILS_PTPD_CLOCKSOURCE' undeclared
(first use in this function); did you mean
'CONFIG_NETUTILS_PTPD_STACKSIZE'?
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
The original implementation only checked if each field was less than,
but didn't check for greater than before proceeding to the next field.
This caused incorrect clock selection behavior in the PTP Best Master
Clock Algorithm (BMCA).
The fix expands each comparison to explicitly check both < and >
conditions, returning the appropriate result immediately. This ensures
proper precedence evaluation according to IEEE 1588 specification:
- gm_priority1
- gm_quality (class, accuracy, variance)
- gm_priority2
- gm_identity
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Introduces a collection of unit tests for NuttX, built on top of the
cmocka framework. Tests are organized into suites/groups which can be
individually included/excluded from the build using Kconfig. Output is
easily legible and separated with headers including the test group name.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
The current code incorrectly used the CONFIG_SCHED_EVENTS
macro in ostest.h for hrtimer_test(). This has been corrected to use CONFIG_HRTIMER.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
Initialize info.devname to NULL to solve the problem of the SO-BINDTODEVICE property being set incorrectly in the icmp_ping function
Signed-off-by: wangchen <wangchen41@xiaomi.com>
Add -I option to specify the network device to use for sending ICMP
echo requests. This allows users to explicitly bind ping to a
specific network interface, which is particularly useful in
multi-homed systems with multiple network interfaces.
Signed-off-by: meijian <meijian@xiaomi.com>
It provides the necessary compilation files and configuration management files, and offers a publish demo and a subscribe demo
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
Add functional tests for the newly added hrtimer APIs,
including hrtimer_init(), hrtimer_start(), and hrtimer_cancel().
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Due to DMA-based transfers, the rx buffer can receive a large amount
of data at once. The previous character-by-character processing approach
was inefficient.
Modify character-by-character read to block read of the entire buffer.
This improves throughput and reduces CPU overhead, especially for high-speed
serial communication or other DMA-based transfers.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
During the discussion about the impact of adding counter to TCB
Mr anchao created a pthread mutex performance example:
https://github.com/apache/nuttx/pull/17468#issuecomment-3660925314
Because this example can exercise (not ideally) the pthread mutex
I decided to add it to apps/testing/sched, the program name will
be called "pmutexp" (because "pmp" is not a good name).
Signed-off-by: Alan C. Assis <acassis@gmail.com>
For TCP-based adb, if the current CPU contains TCP protocol stack,
then NET_TCPBACKLOG needs to be enabled.
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
Without this configuration, when executing exit in adb shell,
adb will not be able to exit because it cannot receive the
close packet.
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
getTimeofday_test.c:68:22: error: variable 'cnt' set but not used [-Werror,-Wunused-but-set-variable]
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
when use cmd 'spi exch -b 1 -f 3000000 -m 1 -n 0 -w 32 -x 1 1f',
the last character '1f' can not be trans out.
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
If we set CONFIG_SMP_DEFAULT_CPUSET=1
This will cause the value of cpuset to be 0x1,
((1 << CONFIG_SMP_NCPUS) - 1) will result in the cpuset being 0x11,
leading to test case errors.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
apps/system/fastboot/fastboot.c:351:43: error: '%s' directive output may be truncated writing up to 63 bytes into a region of size 60 [-Werror=format-truncation=] ...... apps/system/fastboot/fastboot.c:351:3: note: 'snprintf' output between 5 and 68 bytes into a destination of size 64 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ apps/system/fastboot/fastboot.c:351:43: error: '%s' directive output may be truncated writing up to 63 bytes into a region of size 60 [-Werror=format-truncation=] ...... apps/system/fastboot/fastboot.c:351:3: note: 'snprintf' output between 5 and 68 bytes into a destination of size 64 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
Fixed error verified in this PR https://github.com/apache/nuttx/pull/17423
added to the workflow:
- Show Disk Space
- Free Disk Space (Ubuntu)
Only Android runtime removed
- Post-build Disk Space
We can now monitor disk space.
Signed-off-by: simbit18 <simbit18@gmail.com>
2025-12-05 11:44:11 +08:00
1659 changed files with 181828 additions and 7731 deletions
Subject: [PATCH] tacle-bench: add makefile and all-in-one main file
The original taclebench is used for WCET analysis. This commit allows most taclebench test cases (except parallel test cases) to be compiled and executed.