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>
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>
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>
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>
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>
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>
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>
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>
Add documentation for CONFIG_TIMER_WDOG, a software-based timer
implementation using the NuttX wdog subsystem.
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
Invalid data is cleared during garbage collection rather than
deleted during initialization, thus accelerating the
initialization speed.
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
When key string found corrupted during garbage collection,
then remove key-value pair from the flash.
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>