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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
- 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>