Commit Graph

61663 Commits

Author SHA1 Message Date
Michal Lenc 7dc6be8f08 clock_settime: don't block when up_rtc_settime is called
Setting the current time in RTC may be a blocking operation (driver
needs to wait for oscillator stabilization after reset and so on).
This may cause the unwanted effect of clock_settime blocking the
code execution for a considerable amount of time.

The solution is to plan a low priority work that takes care
of setting the time in RTC and let clock_settime continue. We don't
have to check if the work is available, just cancel it if there
is a new time set request.

This is used only if CONFIG_SCHED_LPWORK is enabled.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-04-28 15:15:05 -04:00
Alexey Matveev 369755d00b drivers/can: Fix close drain, write-only reader lifecycle, and STM32 RX header
Always allocate per-file can_reader on open so write-only descriptors get msgalign / ioctl state; free that context on close when it was never linked into cd_readers (fixes leak).

Cap each drain loop (20×500 ms) so close() cannot block forever when bxCAN retries without ACK or dev_txempty never clears.

Fix stm32can_vputreg debug log to print the written value (correct parameter name).

Signed-off-by: Alexey Matveev <tippet@yandex.ru>
2026-04-28 10:32:56 -03:00
zhanxiaoqi 786b315947 fs/inode: add optional manual FD backtrace control via task group flag
When CONFIG_FS_BACKTRACE is enabled, collecting a stack trace for every
new file descriptor adds overhead to fast path operations like open(),
dup(), and socket().

This patch adds a new configuration option CONFIG_FS_BACKTRACE_DEFAULT.
When enabled (default behavior), the GROUP_FLAG_FD_BACKTRACE flag is
automatically set during group allocation, causing backtrace to be
captured for all tasks globally, preserving the original diagnostic
capability.

When disabled, backtrace capture is zero-cost by default and must be
explicitly enabled per task group using GROUP_FLAG_FD_BACKTRACE.

Signed-off-by: zhanxiaoqi <zhanxiaoqi@bytedance.com>
2026-04-28 09:53:27 +02:00
Jari Nippula 62b71c3b30 fs/vfs/fs_lock.c: Close stale locks unconditionally
Allow to close the lock even the dying task is in
signal handler context. Also the file type check can
be ignored as they are already validated in create phase.

Signed-off-by: Jari Nippula <jari.nippula@tii.ae>
2026-04-28 11:51:35 +08:00
Shunchao Hu d619ee6541 net/nat: Let ICMP echo id zero be a valid NAT id.
Make nat_port_select() return an error code and report the selected
external port through an output parameter.

This separates selection failure from the valid ICMP echo identifier
value zero, so outbound NAT entry creation no longer rejects ICMP echo
requests that use id zero.

Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
2026-04-28 00:38:34 -03:00
wangjianyu3 f97b29c4c4 boards/lckfb-szpi-esp32s3: add vncviewer defconfig and documentation
Build Documentation / build-html (push) Has been cancelled
Add vncviewer board configuration and documentation:
- boards: add lckfb-szpi-esp32s3:vncviewer defconfig
- Documentation: add system/vncviewer application doc with host
  VNC server setup examples (Xvfb, clip, scale modes) and images

Assisted-by: GitHubCopilot:claude-4.6-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-27 22:19:31 +02:00
Eren Terzioglu 64cf22628f Docs/platforms/risc-v: Add autopm docs
Add autopm docs for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-27 21:20:21 +02:00
Eren Terzioglu 435ff1d488 boards/risc-v/esp32p4: Add autopm defconfig
Add autopm defconfig for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-27 21:20:21 +02:00
Eren Terzioglu 170b04df01 arch/risc-v/espressif: Fix PM wakeup sources
Fix PM wakeup sources for esp32[-c6|-h2|-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-27 21:20:21 +02:00
Jari Nippula d167819d5b syscall: fcntl param3 type to uintptr_t
Fixing incorrect 32->64bit pointer conversion

Signed-off-by: Jari Nippula <jari.nippula@tii.ae>
2026-04-27 12:01:55 -03:00
Lingao Meng e7fd9b1d49 arch/sim: add host_set_timeratio stub for Windows
The simulated time ratio feature introduced a host_set_timeratio()
call in sim_head.c, but the Windows host time implementation was
missing this symbol, causing a link error. Add a no-op stub since
the time ratio feature is not implemented on Windows.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-04-27 15:04:33 +08:00
Sumit6307 b2b78d2f8a fs: Add Kernel-level VFS Performance Profiler
Build Documentation / build-html (push) Has been cancelled
This adds a kernel-level performance profiler for the VFS.
By enabling CONFIG_FS_PROFILER, the core VFS system calls
(file_read, file_write, file_open, and file_close) are
instrumented to track high-resolution execution times using
clock_systime_timespec() seamlessly.

The collected statistics are exposed dynamically via a new
procfs node at /proc/fs/profile, allowing CI regression
testing without needing external debugging tools.

Signed-off-by: Sumit6307 <sumitkesar6307@gmail.com>
2026-04-26 11:50:09 -03:00
Matteo Golin 727502ea9b boards/esp32c3-xiao: Add SMARTFS configuration
Adds a configuration that combines the `nimble` example with a SMARTFS
file system configured in the chip's flash.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-04-26 18:12:38 +08:00
Lingao Meng 62629d5efe arch/sim: fix host_settimer clock mismatch on macOS
dispatch_walltime() expects a delta in nanoseconds from now, but the
previous code subtracted CLOCK_REALTIME from a CLOCK_MONOTONIC absolute
timestamp, which have different epochs and produce a meaningless result.

Fix by subtracting the current CLOCK_MONOTONIC absolute time to get the
correct remaining duration.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-04-25 15:53:42 +08:00
Lingao Meng dfd735045c arch/sim: add simulated time ratio support
Add CONFIG_SIM_WALLTIME_RATIO Kconfig option and --sim-rt-ratio=
command-line argument to control the ratio of simulated time to
real time in percent. 100 means real-time (default), 200 means
simulated time advances twice as fast, 50 means half speed.

The implementation applies the ratio in host_gettime(), host_sleepuntil()
and host_settimer() so both SIM_WALLTIME_SLEEP and SIM_WALLTIME_SIGNAL
modes are supported.

This is inspired by the --rt-ratio feature in Zephyr's native_sim board.

Tested on sim:nsh with the following sleep test:

  $ echo -e "sleep 2\nexit" | time ./nuttx
  real    0m2.0xxs

  $ echo -e "sleep 2\nexit" | time ./nuttx --sim-rt-ratio=200
  real    0m1.0xxs

  $ echo -e "sleep 2\nexit" | time ./nuttx --sim-rt-ratio=50
  real    0m4.0xxs

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-04-25 15:53:42 +08:00
raiden00pl 0efe8c4f42 boards/stm32g4: migrate to new pinmap
migrate stm32g4 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-24 16:03:23 +02:00
raiden00pl 801bf3e9a4 boards/stm32l1: migrate to new pinmap
migrate stm32l1 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-24 10:39:04 -03:00
raiden00pl fe5c65649a .github: use ntfc test cases from Apache repo
use ntfc test cases from Apache repo

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-24 19:56:22 +08:00
Eren Terzioglu 61b0fd15fa Docs/platforms/risc-v: Add ULP wakeup modes docs for esp32[-c6|-p4]
Build Documentation / build-html (push) Has been cancelled
Add ULP wakeup modes docs for esp32[-c6|-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-24 12:38:04 +02:00
Eren Terzioglu 2eb686f72f board/risc-v/espressif: Add ULP wakeup modes board support
Add ULP wakeup modes board support for esp32[-c6|-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-24 12:38:04 +02:00
Eren Terzioglu ac26b63556 arch/risc-v/espressif: Add ULP wakeup modes
Add ULP wakeup modes for esp32[-c6|-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-24 12:38:04 +02:00
Eren Terzioglu 5e29129d97 Docs/platforms/esp32p4: Add LP_ADC docs
Add LP_ADC docs for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-24 12:37:11 +02:00
Eren Terzioglu 2da63a0679 arch/risc-v/espressif: Add LP_ADC support
Add LP_ADC support

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-24 12:37:11 +02:00
raiden00pl e2cc71f540 !arch/arm/src/stm32l5: remove STM32L5_USE_LEGACY_PINMAP
BREAKING CHANGE: remove STM32L5_USE_LEGACY_PINMAP and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-24 10:44:30 +02:00
raiden00pl 5eb4387a99 !arch/arm/src/stm32wb: remove STM32WB_USE_LEGACY_PINMAP
BREAKING CHANGE: remove STM32WB_USE_LEGACY_PINMAP and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-24 10:44:30 +02:00
raiden00pl 2d8c4baa09 !arch/arm/src/stm32l4: remove STM32L4_USE_LEGACY_PINMAP
BREAKING CHANGE: remove STM32L4_USE_LEGACY_PINMAP and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-24 10:44:30 +02:00
Tomasz 'CeDeROM' CEDRO 3efaf80d3d boards/xtensa/esp32s3: New board WaveShare ESP32-S3-Touch-LCD-1.28 (WIP).
* Initial experimental / work in progress implementation.
* New board name is esp32s3-ws-lcd128.
* Supports Kconfig delectable w/wo touch variants (lcd gpios difference).
* IMU QMI8658 bringups is put into esp32s3/common/src to share with other
  boards. Pin defines are located at <board>include/board.h and referenced
  with `#include <arch/board/board.h>`.
* Supported configurations: nsh, ostest, coremark, touch-lvgl, notouch-lvgl,
  imu-qmi8658, watchdog.
* Does not have touch panel driver yet.
* Created board documentation. Added sphinx inline cross-references.
* TODO: Fix SPI GC9A01A LCD pixel format colors.
* TODO: Create I2C CST816S touch panel driver.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2026-04-24 16:27:08 +08:00
Tiago Medicci Serrano 04c4269ef0 Documentation: Update rmt defconfig description
Updated the `rmt` defconfig description for the Espressif's SoCs.
Use the `irtest` testing app (instead of the deprecated `rmtchar`)
to test the RMT peripheral.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-04-24 11:09:41 +08:00
Tiago Medicci Serrano f6837da271 boards/[risc-v|xtensa]: Update `rmt defconfig for Espressif's SoCs
Adds the `CONFIG_SYSTEM_IRTEST` macro to enable building the
`irtest` application.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-04-24 11:09:41 +08:00
Alan Carvalho de Assis c476700583 doc/input: Add documention to MPR121 Capacitive Keypad
Build Documentation / build-html (push) Has been cancelled
This commit adds the Documentation to MPR121 Keypad and the board
profile documentation to STM32F4Discovery board.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-04-23 15:56:32 -03:00
Alan Carvalho de Assis f2219060c2 boards: Add support to MPR121 Capacitive Keypad
This commit adds support to MPR121 on stm32f4discovery board and a
board config example.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-04-23 15:56:32 -03:00
Alan Carvalho de Assis 90ab0a8ae1 drivers/mpr121: Add support to MPR121 Capacitive Keypad
This driver adds support to MPR121 Capacitive Keypad usually found
at Aliexpress. The MPR121 is a touch sensor chip from Freescale/NXP
that supports up to 12 sensor electrodes and 1 proximity electrode.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-04-23 15:56:32 -03:00
alexcekay 1446961c87 arch/arm/stm32h7: Fix SPI RX DMA returning stale DCACHE data
Build Documentation / build-html (push) Has been cancelled
In sporadic cases it is possible that a SPI exchange returns stale RX data from the DCACHE.

This occurs when:
- DCACHE is enabled
- DMA is used

The impact of this can be hard to debug and vanishes when the timing even changes minimally.

This is caused by the DCACHE being invalidated before the actual DMA transaction starts which violates
the recommendations from AN4839 and also does not match the implementation of other drivers on the STM32H7/STM32F7.

Fixed by invalidating the DCACHE right before the actual read, which matches the implementation
of the STM32F7 SPI driver.

Signed-off-by: alexcekay <alexander@auterion.com>
2026-04-23 16:28:36 +02:00
Julian Oes 2fd76ea150 drivers/mtd/w25n: address review comments
- Replace syslog() with finfo()/fwarn() to follow the NuttX subsystem
  debug convention.
- Merge adjacent early-continue `if` branches in w25n_pick_free_spare
  and w25n_scan_factory_bad.
- Add Input Parameters / Returned Value sections to the BBM helper
  headers.
- Clarify why only -EIO triggers a remap retry in w25n_erase and
  w25n_bwrite (block-level E-FAIL/P-FAIL vs. transient bus faults).

Signed-off-by: Julian Oes <julian@oes.ch>
2026-04-23 16:26:44 +02:00
Julian Oes 0c287d6f45 drivers/mtd/w25n: implement bad block management
Use the chip's built-in 20-entry non-volatile Bad Block Management
Look-Up Table (datasheet section 8.2.7) to transparently route around
bad blocks.

Init:
- Reserve the top 24 blocks of the array as a spare pool
- Clamp the MTD geometry to W25N_USER_BLOCKS = 1000 so upper layers
  never see the spare area (125 MB usable instead of 128 MB)
- Force BUF=1 alongside enabling ECC. The W25N01GVxxIT variant
  power-ups with BUF=0 (Continuous Read mode), in which Read Data
  ignores the column address and always starts at byte 0 - which
  silently broke any read targeting a non-zero column (OOB markers,
  sub-page reads in w25n_read).
- Scan all 1024 blocks for factory bad markers (non-FFh at byte 0 of
  the spare area of page 0) and remap any user-area bad blocks via the
  A1h BBM command. Idempotent across reboots: blocks already present
  in the LUT are skipped, so repeated scans don't consume LUT slots.

Runtime:
- On E-FAIL from w25n_block_erase or P-FAIL from w25n_program_execute,
  allocate a spare and issue A1h, then retry the operation once. The
  chip routes the retry to the spare PBA transparently. Data buffer is
  reloaded on program retry.
- Uncorrectable read ECC is left as -EIO (soft errors shouldn't trigger
  permanent remap, and remapping discards data we may still recover).

Safeguards against burning LUT slots on bogus bad blocks:
- w25n_pick_free_spare erases each candidate spare as an active proof
  of life before returning it - the factory OOB marker alone isn't
  trusted.
- w25n_bbm_swap rejects A1h with LBA outside the user area or PBA
  outside the spare pool.

Stack discipline for the logger-thread hot path:
- The 20-entry cached LUT lives in the device struct, not on the stack.
- w25n_read_bbm_lut decodes 4 bytes at a time instead of reading the
  full 80-byte LUT dump into a local buffer.

Boot diagnostics are emitted via syslog so they appear unconditionally:
- [w25n] BBM scan summary (new/remapped/unremapped/previously-remapped/
  LUT slots used)
- [w25n] W25N01GV ready line with user blocks, spare count, geometry,
  and actual SPI frequency
- [w25n] per-remap info and warnings on runtime E-FAIL/P-FAIL paths

Note: existing littlefs filesystems become unmountable because the
block count shrinks from 1024 to 1000; both PX4 board init.c paths
already mount with autoformat so they reformat on first boot after
this change.

Signed-off-by: Julian Oes <julian@oes.ch>
2026-04-23 16:26:44 +02:00
Arjav Patel f51052d780 sched/docs: Align ETC ROMFS text with tmpfs-first /tmp mount.
Update ETC_ROMFS help text and NSH/ROMFS guides to describe the
/tmp mount behavior as tmpfs-first with FAT RAMDISK fallback when
CONFIG_FS_TMPFS is not enabled.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-04-23 10:26:21 -03:00
Arjav Patel bf0848dbd6 boards/sim: Prefer tmpfs for /tmp in rc.sysinit.
Prefer mounting /tmp with tmpfs in the SIM default rc.sysinit when
CONFIG_FS_TMPFS is enabled, and keep the FAT RAMDISK path as a
fallback for configurations that only enable CONFIG_FS_FAT.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-04-23 10:26:21 -03:00
raiden00pl 94e5fb9d3e boards/stm32l4: migrate to new pinmap
migrate stm32l4 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-23 20:34:00 +08:00
raiden00pl 53c4574ebc boards/stm32l5: migrate to new pinmap
migrate stm32l5 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-23 20:31:50 +08:00
raiden00pl ec85c9a708 boards/stm32wb: migrate to new pinmap
migrate stm32wb to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-23 12:59:47 +02:00
Shunchao Hu 5428220062 net/devif: Reorder ipv4_input packet classification.
Rework ipv4_input() packet classification to make the control flow
clearer and keep the common local-unicast case first.

This change:
- handles local packets first
- keeps broadcast/multicast handling in dedicated branches

It also prevents broadcast and multicast packets from falling through
into the unicast forward path.

Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
2026-04-23 15:11:08 +08:00
Tiago Medicci Serrano 629d0fe356 arch/[risc-v|xtensa]: Re-add RMT_LOOP_TEST_MODE Kconfig entry
The PR #18654 removed the Kconfig option `RMT_LOOP_TEST_MODE` used
by Espressif's RMT peripheral. This commit reintroduces it as a
lower-half driver interface used to enable internal loopback tests.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-04-23 09:31:36 +08:00
raiden00pl 8b0f684a05 arch/arm/src/stm32f0l0g0: remove STM32F0G0L0_USE_LEGACY_PINMAP
remove STM32F0G0L0_USE_LEGACY_PINMAP and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-23 09:30:53 +08:00
raiden00pl 6ab27b3a8a arch/arm/src/stm32f7: remove STM32F7_USE_LEGACY_PINMAP
remove STM32F7_USE_LEGACY_PINMAP option and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-23 09:30:53 +08:00
raiden00pl c4586c0742 arch/arm/src/stm32h7: remove STM32H7_USE_LEGACY_PINMAP
remove STM32H7_USE_LEGACY_PINMAP option and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-23 09:30:53 +08:00
aviralgarg05 59d44c4997 boards/arm/stm32: switch nucleo-f412zg console to USART3 VCP
Build Documentation / build-html (push) Has been cancelled
Enable USART3 support for STM32F412 and use it as the default NUCLEO-F412ZG nsh console path.

The ST-LINK virtual COM port on this board is wired to USART3 on PD8/PD9. Restore USART2 to its header-pin routing, switch the nsh defconfig to USART3, and update the board documentation to match the shipped solder-bridge configuration described in issue #17722.

Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-04-22 01:14:39 +02:00
simbit18 3349a40e9a sensors/Make.defs: Aligned Make with Cmake
This sensor was not present in the Make.defs file

     AMG88xx Infrared Array Sensor
     https://github.com/apache/nuttx/pull/12829

Moved:
    These drivers can be used with sensor connected over SPI or I2C bus
         Bosch Sensortec BMI160
         Bosch Sensortec BMI088

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-04-22 06:22:55 +08:00
simbit18 b37b22eacd cmake: Moved the creation of the nxtmpdir folder to the root CMake file
- Moved the creation of the `nxtmpdir` folder for third-party packages to the root  `CMakeLists.txt` file.

cmake/nuttx_3rdparty.cmake

- Add the nuttx_remove_nxtmpdir function to remove the third-party cache directory under nuttx/../nxtmpdir

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-04-22 06:22:36 +08:00
simbit18 9035fba275 ci/testlist/risc-v-02.dat: Added boards build with CMake
-  Boards build by CMake

    esp32c3-xiao

    esp32-c3-zero

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-04-22 06:22:36 +08:00
simbit18 ce7326bf14 testbuild.sh: CMake Added -DNXTMPDIR
- It is now possible to create folder for third-party packages in CMake as well. (Aligned with Make)

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-04-22 06:22:36 +08:00