Commit graph

60945 commits

Author SHA1 Message Date
Bowen Wang
bb5eaec973 Documentation/rpmsg: add rpmsg_ping documentation
Add comprehensive documentation for the RPMsg Ping diagnostic tool,
which is used for testing inter-processor communication and measuring
latency/throughput metrics.

The documentation includes:
- Overview and use cases
- Configuration instructions
- Command syntax and parameters
- Usage examples with sample output
- Architecture workflow diagram
- Best practices for latency and throughput testing

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 07:50:11 -03:00
Bowen Wang
41e46333a8 openamp/virtqueue: change the virtqueue dump log level to emergency
To avoid the dump log can't be output.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 07:50:11 -03:00
yukangzhi
31b0d79b44 libs/crc: implement AUTOSAR-compatible CRC algorithm
This patch adds an AUTOSAR-style CRC library used by E2E functionality.
It introduces multiple CRC variants (CRC8, CRC16, CRC32, CRC64) and the
corresponding public headers and implementation files.

Key changes:
- Public headers: `include/nuttx/crc8.h`, `include/nuttx/crc16.h`,
  `include/nuttx/crc32.h`, `include/nuttx/crc64.h` with new APIs for
  specific polynomial variants and incremental (part) helpers.
- Implementations added under `libs/libc/misc/` for several polynomials:
  - `lib_crc16h1021.c` (CRC-16 CCITT-FALSE)
  - `lib_crc16h8005.c`
  - `lib_crc32h04c11db7.c`
  - `lib_crc32hf4acfb13.c`
  - `lib_crc64emac.c`
  - `lib_crc8h1d.c`
  - `lib_crc8h2f.c`
- Build files updated to include the new sources.

This addition provides low-level CRC primitives required by higher-level
protocols and test suites.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-30 17:32:15 +08:00
dongjiuzhu1
3c486b98dd fs/timerfd: implement TFD_TIMER_CANCEL_ON_SET to detect clock changes
Implement Linux-compatible TFD_TIMER_CANCEL_ON_SET flag for timerfd to
allow applications to detect discontinuous changes to CLOCK_REALTIME.

Background:
According to Linux timerfd_create(2) man page, when a timerfd is created
with CLOCK_REALTIME and TFD_TIMER_CANCEL_ON_SET flag is specified, the
read() operation should fail with ECANCELED if the real-time clock
undergoes a discontinuous change. This allows applications to detect
and respond to system time changes.

Implementation:
1. Add clock notifier infrastructure (clock_notifier.h/c) to notify
   interested parties when system time changes
2. Implement TFD_TIMER_CANCEL_ON_SET flag support in timerfd
3. Register timerfd with clock notifier when flag is set
4. Cancel timer and return ECANCELED when clock change is detected
5. Notify clock changes in:
   - clock_settime()
   - clock_initialize()
   - clock_timekeeping_set_wall_time()
   - rpmsg_rtc time synchronization

Changes include:
- New files: include/nuttx/clock_notifier.h, sched/clock/clock_notifier.c
- Modified: fs/vfs/fs_timerfd.c to handle TFD_TIMER_CANCEL_ON_SET
- Modified: clock subsystem to call notifier chain on time changes
- Modified: rpmsg_rtc to notify time changes during sync

Use case example:
Applications using timerfd with absolute time can now detect when
system time is adjusted (e.g., NTP sync, manual time change) and
take appropriate action such as recalculating timeouts or updating
scheduled events.

Reference: https://man7.org/linux/man-pages/man2/timerfd_create.2.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-30 17:20:24 +08:00
lipengfei28
edd86a5b59 drivers/pci:fix pci_disable_irq/pci_enable_irq parameter
fix pci_disable_irq/pci_enable_irq parameter

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-30 12:50:42 +08:00
lipengfei28
6526f2371a drivers/pci:write legacy num to config space when enable legacy irq
write legacy num to config sapce when enable legacy irq

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-30 12:50:42 +08:00
buxiasen
b68876d75d Documentation/arm/qemu: add qemu-armv7r board documentation
Add documentation for qemu-armv7r board which emulates ARM Cortex-R5
processor using OpenVela's QEMU fork. The upstream QEMU does not
support ARM Cortex-R virt machine, so this board requires the
prebuilt QEMU from OpenVela.

This documentation covers:
- NSH (flat build) configuration
- PNSH (protected build with MPU) configuration
- Prerequisites for downloading prebuilt QEMU
- Debugging instructions with GDB

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-01-30 12:07:18 +08:00
makejian
d9c6353b74 boards/sim/crypto: enable cmocka testing framework
Enable CMocka unit testing framework in the simulator crypto configuration.
This requires enabling the following dependencies:
- CONFIG_ALLOW_MIT_COMPONENTS: Allow MIT licensed components
- CONFIG_LIBC_REGEX: Regular expression support needed by CMocka
- CONFIG_TESTING_CMOCKA: CMocka unit testing framework
- CONFIG_TESTING_CRYPTO: Crypto testing support

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-29 22:44:24 +08:00
wangjianyu3
91e2ddf5b0 drivers/sensors/gnss: Add monitor logs for activation
Add sensor monitor logs to analyze issues related to driver activation.

This commit adds comprehensive sensor monitoring logs to the GNSS uORB driver
to facilitate debugging and analysis of driver activation issues.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-01-29 21:20:03 +08:00
Bowen Wang
16763e4c67 drivers/rpmsg_port: support release the rx buffer in ept->cb
Now we can release the rx buffer in ept->cb, ept->cb should copy
the rx buffer it's private buffer and then return
RPMSG_SUCCESS_BUFFER_RETURNED.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-29 09:26:50 -03:00
Bowen Wang
59259eb7f2 openamp/lib/rpmsg_virtio: release the name service messsage
early

To improve the share memory buffer utilization
1. Support release the rx buffer early, the ept->cb should return
   RPMSG_SUCCESS_BUFFER_RETURNED to tell the rpmsg virtio the
   rx buffer has been released;
2. Modifty name service callback to release the rx name service
   message early;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-29 09:26:50 -03:00
yangsong8
5effc98add Documentations/timer: add timer_wdog software timer documentation
Add documentation for CONFIG_TIMER_WDOG, a software-based timer
implementation using the NuttX wdog subsystem.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-29 09:25:07 -03:00
yangsong8
e49ca90589 timer_wdog: add timer wdog initialition in sim
add timer wdog initialition in sim

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-29 09:25:07 -03:00
yangsong8
e57e7008aa timers/timer_wdog: Remove the wd_start_period.
Replaced the periodical wdog APIs with wd_start_next.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-29 09:25:07 -03:00
xucheng5
500768c38b timer: add timer wdog
Add timer implemented by watchdog functionality.

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2026-01-29 09:25:07 -03:00
yintao
741324d73c net/rpmsg: add err handle when rpmsg_socket_unbind called
After waiting, it is necessary to check if the connection
has been disconnected

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-29 09:15:33 -03:00
yintao
3fa55fb72e net/rpmsg: support POLLHUP when unbind
rpmsg_socket_ns_unbind should notify pollhup when reconnect
Otherwise, uv_poll can't UV_DISCONNECT
eg:
if (revent & POLL_ERROR || revent & POLL_DISCONNECT)
           xxxx();

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-29 09:15:33 -03:00
chenzihan1
54cdd8c269 drivers/sensors: add sensor monitor log.
add flush sensor monitor log

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-29 18:30:38 +08:00
chenzihan1
18731b509e drivers/sensors: add sensor monitor log.
debug patch to monitor some sensor topic.

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-29 18:30:38 +08:00
zhaoxingyu1
2061ef5d2b mtdconfig/nvs: clean up block without valid data during GC
Invalid data is cleared during garbage collection rather than
deleted during initialization, thus accelerating the
initialization speed.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
dd60589895 mtdconfig/nvs: add key check when gc
When key string found corrupted during garbage collection,
then remove key-value pair from the flash.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
9a3f2003df mtdconfig/nvs: add dirty data clean ablility
Remove dirty data to ensure sufficient available
storage space in the flash memory.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
84a16e6842 mtdconfig/nvs: fix -Werror=unused-variable
when enable MTD_CONFIG_BUFFER_SIZE,
1669:10: error: unused variable 'ate_size' [-Werror=unused-variable]
1669 |   size_t ate_size = nvs_ate_size(fs);
2160:10: error: unused variable 'ate_size' [-Werror=unused-variable]
2160 |   size_t ate_size = nvs_ate_size(fs);

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
1b587db667 mtdconfig/nvs: use a fixed size buffer instead of vla
use a fixed size buffer on stack instead of vla,
When it needs to pass misra-c check

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
2e4ce22774 mtd_config/nvs: add data crc8
The purpose is to reduce the conflict rate of ate CRC and
verify the data

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
59f05be525 mtd_config/nvs: keep offset increasing during ate traversal
Enhance the robustness of ATE traversal.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
73de239ad2 mtdconfig/nvs: return 0 when delete a non-exist kv
Deleting a non-existent key-value pair is deemed a successful deletion.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
zhaoxingyu1
4b7b56a096 mtd/nvs: Fix the issue of compilation failure using the tasking compiler
the tasking compiler reports the error: expression must be constant
in line 510

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-29 14:56:19 +08:00
anjiahao
01a70e9daf Documentation:update abicheck.py
Add abicheck.py usage to documentation

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-28 18:32:39 +01:00
anjiahao
adddfc3bfd abi_check.py:Check ABI compatibility between different ELF versions.
1. The input consists of multiple static libraries and an ELF file. The tool searches
   for external APIs used by the static libraries, then locates these API function signatures
   in the ELF file, and outputs the results as a JSON file.
2. Using the first feature, with the static libraries unchanged,
   the tool can take a new ELF file and an old ELF file as input, output two JSON files,
   and compare the function signatures of functions with the same name in the two JSON files.
   The comparison includes return values, parameters, and if they are structures,
   it also compares the structure size, member offsets, member types, etc.
3.When the input is a single ELF file, the tool can check if structures with the same name have different members.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-28 18:32:39 +01:00
Vlad Pruteanu
17393df52a crypto/cryptosoft: Fix HMAC-SHA when a long key is used
When using a key that is longer than the block size of the hashing
algorithm used, the key must be hashed before it is used.

Signed-off-by: Vlad Pruteanu <pruteanuvlad1611@yahoo.com>
2026-01-28 13:14:05 -03:00
Bowen Wang
def2e89b6e qemu-armv8a/netnsh: enabel the virtio-pci transport
Use to verify the virtio pci transport, and update the qemu-armv8a
document.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
b65d2544d2 arm64/qemu-bringup: use common fdt function to register virtio and pci
Use common implementation is better.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
9f351523a7 Documentation/virtio: add VirtIO framework documentation
Add comprehensive VirtIO framework documentation including:
- VirtIO architecture overview (driver layer, framework layer, transport layer)
- Driver and device registration workflow
- Source code directory structure
- API reference for NuttX VirtIO interfaces and OpenAMP virtqueue interfaces

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
0a27aef078 virtio/virtio-pci-modern: support PCI_RESOURCE_MEM_64 capability
On 64-bit platforms, the capability flags use PCI_RESOURCE_MEM_64
instead of PCI_RESOURCE_MEM. Add support to find both flag types.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
4f591e19db virtio/virtio-pci: add PCI INTX interrupt fallback support
Fall back to INTX interrupt mode when MSI/MSI-X is not supported
or MSI-X IRQ connection fails. This improves compatibility with
more virtio-pci devices.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
63c147bfa4 virtio/virtio-pci: remove unused config change IRQ handler
The config change IRQ is not currently used. Remove it now and
add it back when actually needed.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
5c835881b2 virtio/virtio-pci: improve debug logging and fix comments
- Replace pciXXX() debug calls with vrtXXX() for consistency
- Add additional debug logging for better traceability
- Fix minor comment typos

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
hujun5
effdb88710 sched_getscheduler.c: coverity HIS_metric_violation: RETURN
Refactor nxsched_get_scheduler() to consolidate multiple return statements into a single
exit point by inverting the null check condition. This improves code structure and resolves
Coverity HIS_metric_violation defect for better MISRA HIS standards compliance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:07:20 -03:00
hujun5
a4d09a4e25 sched_sysinfo.c: misra_c_2012_rule_9_1_violation: uninit_use
Initialize the cpuload_s structure with zero values at declaration to eliminate
uninitialized variable usage. This resolves MISRA C 2012 Rule 9.1 violation and
ensures consistent, predictable system information retrieval behavior.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:05:04 -03:00
hujun5
e171f547fa sem_post.c: coverity HIS_metric_violation: RETURN
Refactor nxsem_post_slow() to consolidate multiple return statements into a single exit point
by introducing a result variable and wrapping semaphore operations in an error-check condition block.
This improves code structure and resolves Coverity HIS_metric_violation defect for MISRA HIS standards compliance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:04:11 -03:00
hujun5
dc6ddd8d4d sched: Fix scheduler CPU selection and ready-to-run list management
Fix critical issues in SMP scheduler: correct CPU selection logic by
removing redundant lock check and prioritizing eligible CPUs, simplify
ready-to-run list addition by removing unnecessary condition check and
early validation, and relocate switch_running() call for proper cleanup
sequencing in remove_self() operation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:02:58 -03:00
hujun5
2df1ecca3c semaphore.h: fix ubsan error
Replace left-shift of 1 by 31 bits with direct hexadecimal constant
to eliminate undefined behavior warning when left-shifting signed values
beyond their bit width on platforms with strict sanitizer checking.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 12:45:11 -03:00
hujun5
3a214b5808 sem_waitirq.c: coverity HIS_metric_violation: RETURN
Refactor nxsem_wait_irq() to consolidate multiple return statements into a single
exit point by inverting the mutex condition check. This improves code maintainability
and resolves Coverity HIS_metric_violation defect for better compliance with MISRA HIS standards.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 23:43:16 +08:00
dongjiuzhu1
afaaa7b8cb include/notifier: fix undefined reference to spin_lock_irqsave_nopreempt
Fix linker error caused by including spinlock_type.h instead of
spinlock.h in notifier.h header file.

Error message:
  undefined reference to 'spin_lock_irqsave_nopreempt'
  in .text.clock_changed_notifier_call_chain

Root cause:
The notifier.h header was including <nuttx/spinlock_type.h> which only
provides type definitions, but the inline functions in notifier.h use
spinlock functions like spin_lock_irqsave_nopreempt(). These functions
are defined in <nuttx/spinlock.h>, not in spinlock_type.h.

Solution:
Change the include from <nuttx/spinlock_type.h> to <nuttx/spinlock.h>
to get both the type definitions and the function implementations.

This fixes the undefined reference error when using notifier chains
with spinlock protection.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 23:37:32 +08:00
dongjiuzhu1
1946bc4e44 drivers/serial: fix crash when buffer is full and only recvbuf is implemented
When the receive buffer is full and the driver only implements recvbuf
operation without receive operation, the code would crash due to calling
a NULL function pointer. This patch fixes the issue by:

1. Check if recvbuf is available before calling it
2. When buffer is full, use a temporary buffer to drain hardware FIFO
   to prevent data accumulation in hardware
3. Add proper NULL check for receive operation to avoid crash
4. Initialize pbuf to NULL to prevent uninitialized variable usage

This ensures the serial driver works correctly even when only recvbuf
is implemented and the receive buffer is full.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 22:19:21 +08:00
hujun5
c7bb7ece8e sched_profil.c: misra_c_2012_rule_8_9_violation
Move static g_prof variable declaration into block scope for the profil()
function when CONFIG_SMP is disabled, following MISRA C 2012 Rule 8.9 which
requires objects used by only one function to be declared within that function's scope.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 22:01:45 +08:00
hujun5
dde0d7405d sched_getfiles.c: coverity HIS_metric_violation: RETURN
This change consolidates multiple return statements in nxsched_get_fdlist_from_tcb()
into a single exit point to reduce cyclomatic complexity and comply with MISRA HIS
coding standards for safety-critical embedded systems.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 22:01:01 +08:00
Peter van der Perk
79ce1647da arch/arm: GPIO IMX9 Add support for IRQ line1 and GPIO5
Adds support to select irq line 1 to share the same GPIO with Linux
Also added GPIO5 definiton for IRQ

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-28 21:13:31 +08:00
Peter van der Perk
99501bba9a arch/arm: LPSPI imx9 add support for 2nd CS
If pinconfig are defined for CS1 then configure CS

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-28 21:13:19 +08:00