Commit graph

61778 commits

Author SHA1 Message Date
Abhishek Mishra
702fd85acc fs/vfs: enforce pseudoFS permissions on open()
Add inode_checkperm() and integrate it into file_vopen()
to enforce UNIX-style read/write permission checks for
pseudoFS inodes using effective uid/gid credentials.

Skip permission enforcement for mountpoint inodes and
allow kernel threads to bypass checks.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-05-17 15:48:29 -03:00
Jiri Vlasak
3c05605079 kinetis/pit: Update Kconfig, implement oneshot PIT
Implementation of the Kinetis' Periodic Interrupt Timer (PIT). The lower
half driver is oneshot.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-05-17 11:47:06 +08:00
wangjianyu3
eb0834cd27 boards/esp32p4: Remove unnecessary CONFIG_ESPRESSIF_MERGE_BINS
ESP32-P4 uses simple boot mode without a separate bootloader,
so merging binaries into a single 16MB file is unnecessary.
Removing this option allows 'make flash' to write only the
actual firmware (~380KB) instead of a padded 16MB image,
reducing flash time from ~55s to ~4.5s.

Assisted-by: GitHubCopilot:claude-4.7-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-05-17 11:46:43 +08:00
simbit18
6f46d0e932 ci/platform: Fix the “Repository not found” error for kconfig-frontends
MSYS2
Fix
Repository not found
https://bitbucket.org/nuttx/tools.git

Now use URL https://github.com/patacongo/tools

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-05-17 07:44:48 +08:00
Jinji Cui
8302295dd0 arch/arm/src/stm32/stm32_spi: chunk DMA exchanges to honor 16-bit NDTR
The STM32 DMA NDTR/CNDTR transfer-count register is 16 bits wide on
every STM32 series the in-tree driver supports (IPv1 CNDTR, IPv2
SxNDTR).  spi_exchange()'s DMA path forwarded the caller's full
nwords to stm32_dmasetup(), so a single SPI_EXCHANGE() of >= 65536
words silently programmed NDTR to (nwords & 0xffff).  When the
truncated count was zero - the typical case for an exact 64 KiB
transfer (flash erase block, FAT cluster, common DMA staging
buffer) - the stream completed instantly with no transfer-complete
interrupt and the caller deadlocked in spi_dmarxwait().

Walk the request in chunks of at most 65535 words inside the
existing DMA branch, reusing the same spi_dma{rx,tx}{setup,start,
wait}() sequence per chunk.  Single-descriptor transfers (every
in-tree caller today) are byte-for-byte identical.  CONFIG_SPI_TRIGGER
is honored for the first chunk only; subsequent chunks must run
unconditionally because re-arming between chunks of one logical
exchange was never part of the SPI_TRIGGER contract.

Drive-by: rescale priv->buflen-clamped nwords so the DMA
descriptor matches the actually-copied byte count, promote the
spiinfo() format specifier from %d to %zu, and fix two adjacent
comment typos.

See the PR description for reproduction, NSH log and benchmark
numbers (5.12 MB/s, 97.5% of SCK/8 @ 42 MHz on STM32F407 + W25Q128).

Signed-off-by: Jinji Cui <113000688+cjj66619@users.noreply.github.com>
2026-05-15 10:10:46 +08:00
Abhishek Mishra
24b245a2f9 fs/Kconfig: add CONFIG_FS_PERMISSION option
Add a CONFIG_FS_PERMISSION Kconfig option for future
filesystem permission support infrastructure.

The option depends on CONFIG_SCHED_USER_IDENTITY and
CONFIG_PSEUDOFS_ATTRIBUTES to ensure task credential
tracking and pseudo-filesystem inode ownership/mode
metadata are available before enabling the feature.

The symbol defaults to n to preserve existing behavior
for current configurations.

No runtime permission enforcement is introduced by
this commit.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-05-14 09:35:36 -03:00
Tomasz 'CeDeROM' CEDRO
76b31b04a3 doc/esp32p4: ESP32-P4 chip revisions, ESP32-P4-Nano board note.
* NuttX supports ESP32-P4 >= v3.0 by default.
* In order to run on older chips configuration tuning is required.
* Without configutation tune boot loop happens on older chips.
* Added note on WaveShare ESP32-P4-Nano board that is almost identical
  to existing ESP32-P4-Function-EV-Board board, so configs are compatible,
  but it has v1.3 chip, thus config tune is required as documented above.
* Added cross-file reference label to esp32p4-function-ev-board.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2026-05-14 02:55:45 -04:00
Abhishek Mishra
9451848de3 Documentation/nsh: add chmod and chown command docs
Document the new NSH chmod and chown builtins,
including supported numeric permission and
ownership forms.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-05-14 02:44:26 -04:00
Abhishek Mishra
08dded1f22 fs/vfs: fix pseudoFS mode reporting
Preserve only the existing file type bits (S_IFMT) and
replace permission bits from inode->i_mode instead of
merging them with |= semantics.

This fixes pseudoFS stat()/ls mode reporting after
chmod() updates.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-05-14 02:43:41 -04:00
Tiago Medicci Serrano
e05292f9da [arch|board]/risc-v: Allow BSS segments on PSRAM for ESP32-P4
This commits enables moving BSS data segments to the external PSRAM
on ESP32-P4. This is controlled by a Kconfig option.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-14 09:20:03 +08:00
bijunda
1076cb933d fix(compiler-rt): avoid duplicate builtins dir on sim
compiler-rt/Make.defs:45: target `bin/compiler-rt/compiler-rt/lib/builtins' given more than once in the same rule.
compiler-rt/Make.defs:45: target `kbin/compiler-rt/compiler-rt/lib/builtins' given more than once in the same rule.

Signed-off-by: bijunda <bijunda@bytedance.com>
2026-05-13 10:01:26 -03:00
bijunda
31c7409d80 fix(sim): fix compiler-rt build on macOS
Added the missing __APPLE__ which was undefined by sim globally.
Added missing linker flags.

Signed-off-by: bijunda <bijunda@bytedance.com>
2026-05-13 10:01:26 -03:00
bijunda
d701340cb6 fix(sim): fix cmake build on macOS
macOS /usr/bin/ar does not understand the @rsp syntax used in CMake.
Using LLVM binutils instead.

Signed-off-by: bijunda <bijunda@bytedance.com>
2026-05-13 10:01:26 -03:00
raiden00pl
d9f6216f30 ci: retry git clone for nuttx-ntfc-testing
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>
2026-05-12 08:45:30 -03:00
daniellizewski
4711abcf93 net/icmpv6/icmpv6_input.c: Dont increase d_pktsize from router advertise
An IPV6 Router advertisement can have an MTU max option.
This option should not increase the d_pktsize for a given interface
since that max size might have been set based on CONFIG or buffer size.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-12 16:35:06 +08:00
Daniel Fanache
8b988e8bd9 tools/Config.mk: eval compiler include-prefix detection only once
Three `export VAR ?= $(shell ...)` assignments cause GNU make to
re-run the embedded ${shell ...} every time the variable is exported
to a recipe's environment.  That spawns `tools/incdir` and
`tools/define` once per recipe, serialised through the master make
thread, which adds per recipe overhead to multi-job builds.

Wrap each with `ifeq ($(origin VAR),undefined)` + `:=` so the shell
call runs once at parse time while preserving the override semantics
of `?=`.

Measured impact on a 20-core build host is a ~26% speedup of wall
time.

Signed-off-by: Daniel Fanache <dan@rts.ro>
2026-05-12 16:34:52 +08:00
Daniel Fanache
614cdcd93f arch/arm/src/rp23xx: place PendSV at the lowest NVIC priority
PendSV is the deferred half of the Cortex-M context-switch path: a
higher-priority ISR that wakes a task sets PendSV pending and returns,
and PendSV then performs the register save/restore. This pattern is
only safe when PendSV runs at the lowest priority - otherwise a
peripheral ISR can preempt the context switch mid-update and corrupt
thread state.

The previous write of DEFPRIORITY32 to NVIC_SYSH12_15_PRIORITY in
up_irqinitialize() leaves PendSV at NVIC_SYSH_PRIORITY_DEFAULT (0x80),
the same priority as peripheral IRQs. Read-modify-write the SHPR3 to
lower only the PendSV byte to NVIC_SYSH_PRIORITY_MIN.

This is the canonical ARM Cortex-M priority arrangement and it matches
e.g. this reference:
https://nuttx.apache.org/docs/latest/guides/zerolatencyinterrupts.html (although
worked with a three-bit priority system)

This patch hardens up_irqinitialize against future peripheral-IRQ
prioritisation.

Signed-off-by: Daniel Fanache <dan@rts.ro>
2026-05-12 16:34:16 +08:00
Daniel Fanache
ed5a661da8 arch/arm/src/rp23xx: fix NVIC priority init missing IRQs 12-51
At system startup, the NVIC was configured for proper default priority
only for the first three IPR registers, even though the loop was
executed 13 times - due to a gotcha on what the `NVIC_IRQ_PRIORITY(i)`
macro returns.

IRQs 12-51 stayed at the reset priority of 0 - highest in the system;
so any peripherals issuing those interrupts will shoot through
critical sections that rely on
BASEPRI = NVIC_SYSH_PRIORITY_DEFAULT (0x80).

This can corrupt the TCB ready-to-run list and semaphore wait queues;
this is hard to reproduce (e.g. in ostest) because it requires a
peripheral ISR to land inside a critical section, but the failure
modes range from hangs to wild pointer crashes once it does.

In my case I had SPI and I2C peripherals that were issuing IRQs and
were preempting scheduler and semaphore list operations, causing
corruption.

Step the loop by four and bound it with RP23XX_IRQ_NEXTINT so every
IPR covering IRQs 0..51 is written once with DEFPRIORITY32.

Signed-off-by: Daniel Fanache <dan@rts.ro>
2026-05-12 16:34:16 +08:00
dependabot[bot]
f5689656c6 build(deps): bump urllib3 from 2.6.3 to 2.7.0 in /Documentation
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.6.3 to 2.7.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.6.3...2.7.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.7.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-12 02:45:27 -04:00
yaojiaqi
b17e4488d6 openamp: fix CMake dcache option
OpenAMP 2025.10.0 removed the deprecated WITH_DCACHE_VRINGS, WITH_DCACHE_BUFFERS and WITH_DCACHE_RSC_TABLE CMake options. The replacement is WITH_DCACHE, which enables VIRTIO_USE_DCACHE for vrings, buffers and resource table cache operations.

Use WITH_DCACHE for CONFIG_OPENAMP_CACHE in the CMake integration so the CMake build matches the Makefile path, which already defines VIRTIO_USE_DCACHE directly.

Signed-off-by: yaojiaqi <yaojiaqi@lixiang.com>
2026-05-10 15:03:24 +02:00
Matteo Golin
382bb5e874 docs/risc-v: Remove mention of NSH_ARCHINIT
Removes mention of NSH_ARCHINIT since this configuration option no
longer exists.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-10 07:59:10 +08:00
Matteo Golin
e6b08b2a1e boards/esp32p4-function-ev-board: Normalize configuration
Normalize configuration following change to NuttX initialization
process.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-10 07:59:10 +08:00
Eren Terzioglu
b82b5d0ebc arch/xtensa: Update common layer version for esp32[-|-s2|-s3]
Update common layer version to sync for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-05-09 09:48:32 +08:00
Eren Terzioglu
a3f4d292ff Docs/platforms/esp32c3: Add BLE sleep
Add BLE sleep docs for esp32[-c3]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-05-09 09:48:32 +08:00
Eren Terzioglu
a18b7186a6 arch/risc-v/espressif: Add BLE sleep
Add BLE sleep for esp32[-c3]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-05-09 09:48:32 +08:00
yaojiaqi
131f7f75ed arm: memcpy: add NEON paths for aligned copies
Add dedicated NEON implementations for mutually aligned medium and long memcpy copies when building with __ARM_NEON__. These paths use NEON multi-register loads and stores while preserving the existing VFP implementation for non-NEON VFP configurations.

NEON builds also define USE_VFP, so select the NEON implementation explicitly before falling back to VFP. Apply the same aligned-copy optimization to the armv7-a, armv7-r, and armv8-r implementations.

Signed-off-by: yaojiaqi <yaojiaqi@lixiang.com>
2026-05-09 09:46:43 +08:00
Serg Podtynnyi
9c1b2e12ce tools:mksyscall fix compilation warning
mksyscall.c:145:19: warning: initialization discards ‘const’ qualifier
from pointer target type [-Wdiscarded-qualifiers]
  145 |   char *pactual = strchr(arg, '|');
      |                   ^~~~~~
Change to use const char* on pointers

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2026-05-09 09:42:58 +08:00
bijunda
99d639b9fe Documentation: add nxcamera documentation
Document the nxcamera command usage, including device selection,
resolution, and pixel format options. Also mention recent support
for multi-instance camera mounting and the macOS AVFoundation
backend on the SIM platform.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
Peter Bee
7771cbd0d0 sim: fix mkallsyms for Objective-C symbols on macOS
/Library/Developer/CommandLineTools/usr/bin/c++filt: error: unknown argument '-['

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
Peter Bee
2a353fcc0c sim: adapt macos avfoundation backend for camera indexing and capture
Adapt the macOS AVFoundation backend for multi-device discovery,
camera index mapping and capture startup compatibility. This enables
reliable use of multiple cameras through the SIM camera framework.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
Peter Bee
ea05918799 sim: support camera framework multi-instance and dynamic mounting
Allow the SIM camera/V4L2 capture framework to manage multiple
imgdata instances with dynamic mounting. This avoids cross-talk
between camera streams when multiple devices are used.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
Peter Bee
601d77c180 video: ensure video library is non-empty
Add dummy.c so video can build an archive even when there are no other objects (e.g. on macOS).

Signed-off-by: bijunda <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
wangyongrong
f20f9ff19e sched/group: skip group_release for kernel thread group
When CONFIG_DISABLE_PTHREAD=y, HAVE_GROUP_MEMBERS is undefined and
group_leave() unconditionally calls group_release() for every exiting
thread. This destroys the shared g_kthread_group resources (mutex,
fdlist, task_info) while other kernel threads are still using them,
causing use-after-free crashes.

Fix by checking TCB_FLAG_TTYPE_KERNEL in group_leave() before calling
group_release(), so the entire release path is skipped for kernel
threads. This is safe because g_kthread_group is statically allocated
and its lifetime is the entire system.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2026-05-08 13:44:51 +08:00
raiden00pl
deb52b0855 !arch/arm/src/stm32: remove STM32_USE_LEGACY_PINMAP
BREAKING CHANGE: remove STM32_USE_LEGACY_PINMAP and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-07 11:45:23 +08:00
raiden00pl
cebdcdc692 boards/nucleo-h563zi/nshusbnet: normalize defconfig
boards/nucleo-h563zi/nshusbnet: normalize defconfig

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-06 08:33:06 -04:00
raiden00pl
7934a1c21c boards/stm32f3: migrate to new pinmap
migrate stm32f3 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-06 08:33:06 -04:00
Max Kriegleder
eb92f0f8c8 drivers/timers: avoid 32-bit overflow in arch_timer current_usec
current_usec() returns a uint64_t, but it used TICK2USEC(timebase)
to convert scheduler ticks to microseconds. On 32-bit clock_t builds,
TICK2USEC() performs the multiplication in 32-bit arithmetic before the
result is widened.

With CONFIG_USEC_PER_TICK=10000, this wraps after about 71.6 minutes:

  UINT32_MAX / 1000000 ~= 4294 seconds

After the wrap, up_timer_gettick() can report time near zero again. This
can leave absolute watchdog timeouts, such as those used by usleep() /
clock_nanosleep(), waiting for a tick value that will not be reached until
the 32-bit scheduler counter wraps.

Cast timebase to uint64_t before multiplying by USEC_PER_TICK so
current_usec() remains monotonic across the 32-bit microsecond boundary.

Signed-off-by: Max Kriegleder <max.kriegleder@gmail.com>
2026-05-06 08:49:52 +02:00
Stephen Fox
990ac856b2 net/bluetooth: fix BTPROTO_HCI socket device lookup
bluetooth_sendto() uses netdev_findbyindex(conn->bc_ldev + 1) to find
the Bluetooth network device for an HCI socket.  netdev_findbyindex
searches by global interface index, but bc_ldev is a 0-based count of
Bluetooth devices only — it bears no fixed relationship to the global
interface index.  If any netdev other than a Bluetooth device is
registered before it (e.g. loopback or Ethernet), the Bluetooth device
will not be at global index bc_ldev + 1 and the lookup will return NULL
or the wrong device.

Fix this by replacing netdev_findbyindex with a netdev_foreach walk
using a small callback (bluetooth_dev_byidx_callback) that counts only
NET_LL_BLUETOOTH devices and returns the bc_ldev-th one, regardless of
what else is registered or in what order.

Signed-off-by: Stephen Fox <stephenfox@geotab.com>
2026-05-06 14:45:46 +08:00
Matteo Golin
89b4815382 boards/xtensa: Normalize configurations
Normalizes configurations after removal of some app-related init config
options due to simplification of NuttX init.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-06 13:27:26 +08:00
daniellizewski
0b0769f8d9 arch/arm/src/stm32h5/stm32_usbdrdhost.c: Disable host channel when freed
The host interrupt callback was incorrectly using the wrong IRQ for
disconnected. In host mode the same IRQ is used for connect/disconnected
and it must check a status bit to know which one.

When a USB device was unplugged, the host channels were free'd,
but if they happen to be mid-transfer, that transfer was never cancelled
so the USB hardware might still be trying to perfrom a transfer after
was free'd. Fixed by cancelling any transfers on free.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
daniellizewski
fe67544d5f drivers/usbhost/usbhost_cdcecm.c: Converted CDC-ECM to lower half
Converted USB Host CDC-ECM to a lower half driver.
Removed existing full network driver callbacks and replaced with lower
half.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
daniellizewski
9b18160893 drivers/usbhost/usbhost_cdcecm.c: Added support for Host CDC-ECM
Added support for USB host to use an USB CDC-ECM device.
This class is used for usb-ethernet adapters as well as many modems.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
daniellizewski
761c17f1e0 drivers/usbhost/usbhost_enumerate.c: Allow selecting USB configuration
Added support for selecting a different USB configuration.
Certain USB devices offer different classes using different
configurations. This allows a board file to provide a callback
to select the proper configuration for a given USB device.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
Lwazi Dube
7e0f282718 fs/vfs: allow NULL iov_base in KERNEL build with zero-based text
This commit fixes a regression introduced by
89df084b0e. That commit
added a check to ensure iov_base is not NULL, assuming NULL
always represents an inaccessible address.

However, in CONFIG_BUILD_KERNEL mode where CONFIG_ARCH_TEXT_VBASE
is set to 0, address zero is a valid virtual address for the
user-space text segment. The previous check caused libelf to
fail with -EFAULT when attempting to load ELF program headers
into the base of the user address space.

This patch wraps the safety check in a conditional to ensure it is
only executed when address zero is not considered a valid
executable base.

Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
2026-05-06 01:37:53 +08:00
Tiago Medicci Serrano
20c38d050b Documentation: Describe ESP32-P4 Ethernet support
This commit describes ethernet support on ESP32-P4 SoC and its
ESP32-P4-Function-EV-Board v1.5.2.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-06 01:37:00 +08:00
Tiago Medicci Serrano
c63c061a52 boards/risc-v: Enable ethernet on ESP32-P4-Function-EV-Board
This commit simply enables the ethernet support for the ESP32-P4's
Function EV board.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-06 01:37:00 +08:00
Tiago Medicci Serrano
34bfa0d68d arch/xtensa: Update common-source base for ESP32[|S2|S3]
After recent changes on the event handler for the RISC-V-based
Espressif SoCs, the same set of changes were ported back to xtensa
devices.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-06 01:37:00 +08:00
Tiago Medicci Serrano
5c4c60f9d2 arch/risc-v: Support the ethernet driver on ESP32-P4
This commit enables the ethernet driver support on ESP32-P4 based
on a common-source implementation. This required a set of changes
regargind the event handler for the Wi-Fi driver (which is now
shared with the ethernet driver).

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-06 01:37:00 +08:00
raiden00pl
4b4ba522cb boards/stm32f4: migrate to new pinmap
migrate stm32f4 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-05 13:30:30 -04:00
shichunma
de5cc186e4 net/netdev/netdev_txnotify.c: add debug log with interface name
Add ninfo() in netdev_txnotify_dev() to log the network interface
name when TX notification is triggered, aiding network debugging.

Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
2026-05-06 01:16:40 +08:00