Commit graph

9126 commits

Author SHA1 Message Date
Aviral Garg
2cab69aee0
Merge 9372de597b into 6ca1272b99 2026-07-26 01:08:40 -07:00
aviralgarg05
6ca1272b99 examples/elf: extend nxpkg validation coverage.
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>
2026-07-25 12:06:28 -03:00
Felipe Moura
690ec808e5 netutils/dropbear: back hmac-sha2-256 with NuttX /dev/crypto
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>
2026-07-24 18:34:35 -03:00
Alan C. Assis
ae237624ee readline: Improve robustness of editing and escape-sequence handling
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)
2026-07-24 14:12:38 -03:00
Alan C. Assis
48eb95998b readline: Make prompt-caching available
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>
2026-07-24 14:12:38 -03:00
Alan C. Assis
893f0c31ee readline: remove 5x duplicated in redraw code
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
2026-07-24 14:12:38 -03:00
Alan C. Assis
51bfd48e78 system/readline: Add support for line movements and editing
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
2026-07-24 14:12:38 -03:00
Alan C. Assis
0304721c85 readline: Don't assert on a zero-length RL_WRITE
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>
2026-07-24 14:12:38 -03:00
aviralgarg05
9372de597b examples/calculator: Add an LVGL touchscreen calculator.
Add a calculator example that can run as either a built-in application or loadable module. It uses configurable framebuffer and touchscreen paths, reserves the nxstore supervisor bar, and exits cooperatively on SIGTERM.

Validate display, touchscreen, and signal-handler setup before entering the LVGL loop. Reset static state on every invocation so built-in relaunches behave like fresh module loads.

Assisted-by: OpenAI Codex:gpt-5.6-sol
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:26:00 +05:30
aviralgarg05
79daf2c5a9 system/nxstore: Harden package icon caching.
Read cached icons completely, validate the RGB565 format and exact payload size, and discard corrupt cache entries so a later launch can retry acquisition.

Key the local cache by package name and version so a catalog update cannot silently reuse an older icon.

Assisted-by: OpenAI Codex:gpt-5.6-sol
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
63c540cbbb system/nxstore: Correct the scroll threshold comment.
Keep the list behavior documentation consistent with the 20-pixel threshold used by the tested implementation.

Assisted-by: OpenAI Codex:gpt-5.6-sol
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
ab5036fcab system/nxstore: Honor installed launch metadata.
Use nxstore-owned framebuffer and input configuration symbols instead of relying on an unrelated LVGL demo configuration.

Load the manifest for the installed version before launching it, validate that it matches the installed database entry, and pass its recorded arguments to posix_spawn(). Check spawn-attribute setup errors as well.

Add the shared supervisor-bar height header to the nxstore change itself so the branch builds independently and framebuffer applications can follow the required reserved-strip contract.

Assisted-by: Codex:gpt-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
7fb624df4c system/nxstore: Retry synchronization on network readiness.
Remove the dependency on an ESP-specific DHCP global. Retry catalog synchronization for a bounded period only while the network stack reports readiness-related errors, allowing the same frontend to work with Wi-Fi, Ethernet, and other boards.

Keep the LVGL timer serviced between attempts so the interface remains responsive while the network comes up.

Assisted-by: Codex:gpt-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
3d8bbb8630 system/nxstore: address review findings and fix hardware-found bugs.
Review/hardening findings from the companion nxpkg PRs:

- Own framebuffer/input device paths instead of borrowing
  CONFIG_EXAMPLES_LVGLDEMO_FBDEVPATH/INPUT_DEVPATH from an unrelated
  example app: new CONFIG_SYSTEM_NXSTORE_FBDEVPATH/INPUT_DEVPATH
  Kconfig string options (defaulting to /dev/fb0 and /dev/input0).

- g_index moves from a static struct to a heap-allocated
  FAR struct pkg_index_s * (pkg_zalloc()), with a "Not enough memory to
  load the catalog." UI fallback if the allocation fails.

- nxstore_launch() now loads the specific installed version's manifest
  via pkg_metadata_load_manifest_path() instead of combining a
  rollback-selected version with whatever the current catalog entry
  happens to describe for that name - those can disagree after a
  rollback if the catalog has since moved on. Also passes through the
  installed manifest's launch_args/launch_argc (previously always
  argv[1] = NULL).

- title_text buffer sized PKG_NAME_MAX + PKG_VERSION_MAX + 5 instead of
  a fixed 96, fixing a real compiler truncation warning.

- README.txt moved to the companion NuttX documentation PR rather than
  shipping user-facing documentation as an in-tree README.

Bugs found bringing this up on real hardware:

- LV_EVENT_LONG_PRESSED could fire for a touch that was actually
  driving a scroll of the app list: if a drag starts slowly enough
  that the long-press timer (400ms) elapses before the finger crosses
  the scroll-lock distance, LVGL hasn't committed the gesture to
  scrolling yet and still delivers the long-press event, silently
  uninstalling whatever card the touch happened to land on. Ignore the
  long-press if this input device is currently attributed to scrolling
  any object (lv_indev_get_scroll_obj()).

- Tapping an installed-app card to launch it, while a different
  install was in progress elsewhere in the list (or another app was
  already running), was allowed through unconditionally - install_worker()
  auto-launches its own package once done, and letting a second launch
  through independently meant whichever one finished last silently
  overwrote g_running, leaving the other process alive, unsupervised,
  and drawing into the same shared framebuffer with no way to close it
  from this UI again. Both the direct-launch and fresh-install paths in
  install_btn_event_cb() now refuse (with a toast) if g_running.active
  or g_active.manifest indicate another app is already running or about
  to be.

- nxstore_is_installed() only checked the package *name*, not which
  version was actually on disk - an older installed version showed as
  plain "Installed" identically to a current one, and tapping it
  silently launched the stale payload with no update indication or
  action. Add nxstore_is_up_to_date() (compares the installed version
  against the catalog's latest manifest) and a third status_bar color
  (in addition to not-installed/up-to-date) plus a "Update available -
  tap to update" subtitle for the mismatch case; tapping such a card
  now goes through the install path (which fetches and auto-launches
  the newly installed version) instead of the direct-launch path.

- lv_indev_set_scroll_limit() was set to 255 (copied from examples/
  lvgldemo/lvgldemo.c, whose own touch-drift mitigation this file
  reused), requiring a nearly-full-screen drag before a touch was even
  recognized as a scroll gesture. Unlike that demo, this screen's app
  list is scrolled constantly, and a threshold that large read as
  broken/laggy scrolling rather than drift protection. Lowered to 20,
  enough to reject typical touch-driver jitter while still recognizing
  a real scroll almost immediately; momentum stays off (scroll_throw
  0), which is what the dual-launch/scroll-lock fixes above actually
  depend on, not the gesture-start threshold.

Also adds nxstore_load_icon(): best-effort loads and caches a
package's optional icon (manifest->icon) as a raw RGB565 image LVGL
can render with no decoder (this board has no PNG/JPEG decode
capability), falling back to the existing colored-circle-plus-glyph
rendering on any failure (no icon set, download failed, corrupt/
oversized file) so a bad icon never blocks a package from being
listed or installed.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
778bc0e64c system/nxstore: add LVGL app-store UI.
Add nxstore, an LVGL-based frontend for nxpkg (system/nxpkg): lists
packages from the local index, installs/launches the selected one,
and supervises whatever it hands the screen to.

Card-based app list (populate_app_list()): each row shows name,
version, and description/status, install/launch state reflected via
icon glyph and color (LV_SYMBOL_DOWNLOAD/PLAY, accent/success color),
and a sliding-segment progress bar during install (no real byte-level
progress is available from pkg_install(), so this reads as
'actively working' without fabricating a percentage). Explicit
LV_STATE_PRESSED styling on every tappable row/button, since no LVGL
theme is loaded and a tap would otherwise give no visual feedback at
all.

Supervisor screen (build_run_screen()/nxstore_enter_running_screen()):
a launched app (e.g. a game that owns /dev/fb0 directly, not just
another LVGL client) gets a dedicated screen with a name label and a
Close button, confined to the border region the launched app's own
scaled/centered framebuffer output never draws into, so switching
back to it doesn't fight over pixels with whatever the app already
put in the framebuffer.

Close/reap handling (close_running_app_event_cb()/
nxstore_poll_running_app()): sends SIGTERM and polls waitpid(WNOHANG)
for the launched pid, but explicitly also treats waitpid() returning
ECHILD as 'already gone' rather than 'still running' - both the
close-button handler and the passive per-loop poll independently race
to reap the same child, so whichever one loses that race must not
spin forever waiting for a wait() that can now never succeed. Requires
the target app to install its own SIGTERM handler to exit cleanly
(this is why there is no generic force-kill fallback here: an
earlier version of this code called task_delete() when SIGTERM wasn't
reaped quickly enough, which was found on real hardware to hang the
entire board - not just the one task - when it landed mid
framebuffer/heap access on this flat-memory build).

Toast notifications (nxstore_toast()) provide a transient, unmissable
confirmation for install/uninstall/launch outcomes and app-closed
events, additive to the durable per-row subtitle text rather than a
replacement for it.

nxstore's own boot-time catalog sync waits (bounded, 15s) on
g_wifi_dhcp_ret before attempting a network fetch, since Wi-Fi
association completing doesn't imply DHCP has - an HTTP fetch
attempted in that window fails with -ENETUNREACH even though the
link itself is already up, indistinguishable from being genuinely
offline without this wait.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
f363a8f444 system/nxpkg: Protect live locks from filesystem clock skew.
Record a per-boot token and owner PID in every package, installed-database, and synchronization lock. A contender now keeps a lock held while its recorded owner task is alive, regardless of unreliable FAT modification timestamps.

Reclaim locks from exited owners or earlier boots immediately, while retaining timestamp-based migration handling for legacy empty lock files. This prevents a just-created live lock from being mistaken for a decades-old stale file on targets whose mounted filesystem clock does not match CLOCK_REALTIME.

Assisted-by: OpenAI Codex:gpt-5.6-sol
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
38c608326a system/nxpkg: Address follow-up review findings.
Shorten the installed-database lock description and centralize pkg_sync() cleanup, as requested in review. Replace repeated protocol literals with named constants and preserve errno before cleanup calls can overwrite it.

Store the synchronized catalog source in the catalog itself so the catalog and its relative-artifact base are committed atomically. Continue reading the former sidecar format for upgrade compatibility, and normalize array-form catalogs before adding the private source field.

Compare numeric version prefixes without strtol() overflow and retain lexical comparison of suffixes.

Assisted-by: Codex:gpt-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
8571175bb9 system/nxpkg: fix concurrency and versioning bugs found in review.
- pkg_sync(): index.jsn and repo.url were updated as two independent
  atomic writes with nothing serializing the pair against a second,
  concurrent pkg_sync() call - each write stayed internally
  consistent, but the pair didn't, so one sync's index could end up on
  disk next to a different sync's source URL. Add a dedicated sync
  lock (pkg_repo_acquire_sync_lock(), mirroring the existing installed-
  db lock's blocking-retry-with-stale-reclaim pattern) around the
  whole read-fetch-write sequence. Also renew the lock's mtime as data
  actually arrives (pkg_repo_sink(), via a new renew_lock_path field
  threaded through pkg_acquire_source()) rather than only stamping it
  once at acquire time - a lock acquired once and then measured
  against a fixed 10-minute staleness window could otherwise be
  reclaimed mid-download on a large-enough file over a slow-enough
  link, even though the download was still genuinely in progress.
  pkg_reclaim_stale_lock() (renamed from pkg_install_reclaim_stale_lock,
  made public) is shared between both lock kinds rather than
  duplicated.

- pkg_install_prune_oldest_version(): deleted the pruned version's
  on-disk payload directory before the updated installed database was
  even durably saved. If pkg_metadata_save_installed() subsequently
  failed, the payload was already gone but the last successfully-saved
  instpkg.jsn could still list that version as installed. The victim
  version is now handed back to the caller (threaded through
  pkg_install_add_version()/pkg_install_update_installed()) so
  pkg_install() can defer the actual directory removal until after the
  save succeeds.

- pkg_metadata_version_token_cmp(): two version tokens with equal
  numeric prefixes (e.g. "1a" and "1b", both parsing as 1) compared as
  equal instead of falling back to a lexical comparison of what
  follows the number, contradicting this function's own documented
  behavior and silently treating genuinely different versions as the
  same one. Compare the non-numeric remainder lexically when the
  numeric prefixes match instead of falling through.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
455af497ca system/nxpkg: address lifecycle review findings.
Fix real correctness/security gaps found during review, on top of the
network sync and CLI completion work:

- pkg_install(): commit the installed database before writing the
  current/previous pointer files, and before advancing transaction
  state past ACTIVATED. Those are recovery bookkeeping and convenience
  mirrors respectively - once the installed database itself is
  durably committed, a failure to refresh either one must not trigger
  the failure-cleanup path, which could otherwise delete a payload the
  database now legitimately points at. Also stop treating an existing
  version directory as newly created when reinstalling an
  already-installed version, so a failed reinstall can't delete a
  working install.

- pkg_uninstall()/pkg_rollback(): acquire the per-package install lock
  in addition to the installed-db lock, drop the entry from the
  authoritative database first, and only then remove payload files -
  a crash between those two steps can leave orphaned files, which are
  reclaimable, but never leaves the database pointing at a payload
  that's already gone.

- pkg_sync(): stage each sync to a PID-qualified temp filename instead
  of a single fixed name, so concurrent sync calls can no longer race
  on the same staging file. Return real negative errno codes instead
  of EXIT_SUCCESS/EXIT_FAILURE, matching the rest of this API; pkg_main.c
  maps that back to a process exit code at the CLI boundary.

- pkg_metadata_parse_installed_entry(): validate that name/current/
  previous/every entry in versions[] are safe path components, and that
  current (and previous, if set) actually appear in versions[] - a
  corrupted or tampered installed-packages database can no longer
  reference a nonexistent version or smuggle a path-traversal sequence
  through a field this code already trusted implicitly.

- pkg_store_write_all()/pkg_repo_sink(): treat a zero-byte write() as
  -EIO instead of looping on it silently.

- Removed the malloc()-falls-back-to-kmm_malloc() logic in pkg_malloc/
  pkg_zalloc/pkg_realloc/pkg_free entirely - it required tracking which
  allocator owned a given pointer via kmm_heapmember(), which is
  specific to this target's flat, single-heap memory model and not a
  sound general application API. These are now plain wrappers around
  malloc/calloc/realloc/free.

- Added pkg_metadata_load_manifest_path(), so a caller (e.g. the
  nxstore GUI frontend, launching an installed package) can load the
  manifest actually recorded for a specific installed version, instead
  of combining a rollback-selected version with whatever the current
  catalog happens to describe for that package name - those can
  disagree after a rollback if the catalog has since moved on.

- Storage root default changed from /tmp/nxpkg to /var/lib/nxpkg,
  following the conventional persistent application-data location
  instead of a path whose own name suggests non-persistent storage. A
  board without persistent storage mounted at /var, or that wants a
  different location (e.g. an SD card), still overrides this via
  CONFIG_SYSTEM_NXPKG_ROOT as before.

- Moved system/nxpkg/README.txt into the companion NuttX documentation
  PR rather than shipping user-facing documentation as an in-tree
  README.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
aviralgarg05
81b88922f7 system/nxpkg: network sync, install hardening, and CLI completion.
Fill in most of what the initial nxpkg slice deferred: network sync
and artifact acquisition over plain HTTP (verified via SHA-256), an
install rewrite that supports network sources and reclaims state left
by an interrupted previous install, and wiring update/remove/rollback/
available into the CLI.

Harden the package path against untrusted input along the way: bounded
memory-safety helpers and explicit size limits throughout, storage
read/write hardened against partially-written files, path-traversal
rejection in manifest name/version before they reach the filesystem,
and a fix for a lost-update race on the shared installed-packages
database (two concurrent installs of different packages could
otherwise silently clobber each other's recorded state).

Add an optional manifest icon field for the nxstore GUI frontend to
consume, raise PKG_INDEX_MAX now that the in-memory index is
heap-allocated, and document the repository layout and local server
setup in system/nxpkg/README.txt.

Also fixes a real build break: pkg_runtime_compat() unconditionally
referenced CONFIG_ARCH_BOARD, a Kconfig string symbol with no default
clause under ARCH_BOARD_CUSTOM, so it is left entirely undefined
rather than defined-but-empty on a custom board - falls back to
CONFIG_ARCH_BOARD_CUSTOM_NAME instead. Routes pkg_error()/pkg_info()
through syslog rather than stdio, since neither is visible to a
supervisor with no attached console.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:57 +05:30
Carlos Sánchez de La Lama
094b988be3 interpreters: add Tcl support
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>
2026-07-24 17:15:49 +08:00
wangjianyu3
86afa6d182 netutils/rexecd: forward PRIORITY/STACKSIZE config in CMake build
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>
2026-07-23 17:18:08 -03:00
Matteo Golin
d273af4834 applications/audioutils/morsey: Update Morsey version
Use newer version without compile time warnings that prevent CI from
building.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-07-23 09:31:29 +02:00
Abhishek Mishra
e751331ecb ci: fix sim/login ROMFS passwd credential for promptpasswd.sh
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>
2026-07-22 17:21:22 +08:00
Abhishek Mishra
c02683e282 !nshlib: Remove fixed login; require FSUTILS_PASSWD
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>
2026-07-22 17:21:22 +08:00
Abhishek Mishra
608f13fd4b !fsutils/passwd: Replace TEA with PBKDF2-HMAC-SHA256
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>
2026-07-22 17:21:22 +08:00
hanzhijian
01c6a60581 testing/drivers: add watchdog notifier cmocka coverage
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>
2026-07-21 15:37:01 -03:00
anjiahao
067b0ccf28 Application.mk:define application attribute in elf symbol
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>
2026-07-21 05:47:25 -03:00
dependabot[bot]
593bfca047 build(deps): bump actions/setup-python from 6 to 7
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-21 16:47:02 +08:00
Matteo Golin
c814059f6c examples/txmorse: Example application for transmitting Morse code
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>
2026-07-21 05:46:11 -03:00
Matteo Golin
4d3bb6e7c9 audioutils/morsey: Add the Morsey library
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>
2026-07-21 05:46:11 -03:00
Abhishek Mishra
1e490d3fbe dropbear: rename libtomcrypt symbols to avoid NuttX collisions
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>
2026-07-20 12:45:48 -04:00
Jorge Guzman
865393d419 system/curl: add a small curl-like HTTP client command
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>
2026-07-20 10:21:57 +02:00
Ansh Rai
98f683dea8 apps: Sanitize PROGNAME for _main symbol generation
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>
2026-07-20 10:21:26 +02:00
Felipe Moura
7469e88bfa netutils/dropbear: retain child exit status for NSH PTY session
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>
2026-07-20 10:04:50 +02:00
Matteo Golin
5114ddd6c0 examples/baromonitor: New LVGL example which integrates with barometer
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>
2026-07-20 09:40:04 +08:00
Filipe Cavalcanti
09682dad05 interpreters/python: support build without network
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>
2026-07-17 08:37:30 +08:00
Old-Ding
62d04ed484 system: fastboot: bound filedump path parsing
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>
2026-07-16 15:59:21 +08:00
raiden00pl
eceb30e59c codespell: ignore ANS error
ignore ANS codespell error. ANS -> Alert Notification Service in bLE

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-07-15 08:40:55 +02:00
raiden00pl
f5b2c354ca wireless/bluetooth/nimble: make transport ACL buffer count configurable
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>
2026-07-15 08:40:55 +02:00
Old-Ding
850f481344 examples: fix local socket address lengths
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>
2026-07-13 12:28:07 +02:00
Matteo Golin
b39228cd41 !examples/audio_rtttl: Implement example using RTTTL library
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>
2026-07-13 10:02:37 +08:00
Mihai Pacuraru
3762a64bc6 examples/mqttc: add a subscriber client implementation example
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>
2026-07-13 10:02:05 +08:00
Felipe Moura
9b540556a1 netutils/dropbear: don't require a hardware TRNG
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>
2026-07-12 15:56:25 -03:00
Jorge Guzman
62b7e95530 nshlib: top: add Linux-like summary and flicker-free refresh
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>
2026-07-12 10:00:40 +08:00
Old-Ding
1d5f816874 system: audio: parse command filenames with PATH_MAX
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>
2026-07-11 12:40:07 -03:00
liang.huang
2bcc6b96ea testing/sched: fix off-by-one sample count in timerjitter
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>
2026-07-11 12:31:24 -03:00
Abhishek Mishra
1d15c81f69 ci: supply sim/login ROMFS passwd credential in build jobs
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>
2026-07-11 07:31:04 -03:00
Peter Barada
27c466a429 crypto: Fix CRC-32 test case 8
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>
2026-07-10 13:02:44 +08:00
orbisai0security
d071a0b585 fix: V-001 security vulnerability
Automated security fix generated by OrbisAI Security

Signed-off-by: OrbisAI Security <mediratta01.pally@gmail.com>
2026-07-10 13:01:42 +08:00