Commit graph

60977 commits

Author SHA1 Message Date
Jukka Laitinen
fdaeb00910 arch/imx9/enet: Move imx9_phy_boardinitialize to "ifup" phase
Move the board-specific phy initialization from early boot into ifup phase. The
board specific phy initialization may need to implement delays, or bus
communication, for example via i2c bus.

These OS services are not necessarily available yet in arm64_netinitialize, and
PHY initialization is not necessary until the driver actually starts using it.
In addition, this allows the board to reset the ethernet phy at every ifup,
if needed for error recover.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-02-01 09:41:50 -03:00
Jukka Laitinen
15fa005e5b arch/imx9/enet: Correct configuration flag IMX9_ENET1_PHYINIT
The function is for any ethernet interface, given as paramter to the function,
it is not for ENET1 only. The correct name is already used
in the code, but the Kconfig had it wrong.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-02-01 09:41:50 -03:00
liaoao
425a760799 drivers/rpmsg: implement timestamp support for rpmsg_port
Add TX/RX timestamp tracking for rpmsg_port to enable latency
measurement and debugging:

- Add rpmsg_port_get_timestamp() to retrieve buffer timestamps
- Add rpmsg_port_update_timestamp() to record timestamps at TX/RX time
- Integrate timestamp recording in rpmsg_port_spi and rpmsg_port_spi_slave
- Reserve space for rpmsg_timestamp_s in buffer size calculations

Signed-off-by: liaoao <liaoao@xiaomi.com>
2026-02-01 01:14:49 +08:00
liaoao
198a8fe108 drivers/rpmsg: add rpmsg_get_timestamp to retrieve buffer timestamps
Add rpmsg_get_timestamp() API to get the TX/RX timestamps of an rpmsg
buffer. This is useful for latency measurement and debugging purposes.

The new rpmsg_timestamp_s structure contains:
  - tx_nsec: timestamp when the buffer was transmitted
  - rx_nsec: timestamp when the buffer was received

Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-01 01:14:49 +08:00
hujun5
0d25df7663 sched: fix code style violations in clock conversion macros (MISRA C-2012)
Add explicit type casts to uint32_t for time conversion macro divisors to
comply with MISRA C-2012 Rules 10.1, 10.3, 11.1, 11.3, and 11.4. This fixes
Coverity warnings and improves type safety in clock_time2ticks_floor and related
time conversion operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-02-01 01:14:01 +08:00
Bowen Wang
fe5cf5b03e nuttx/clock.h: add USEC2MSEC macro for microsecond to millisecond conversion
Add USEC2MSEC macro to provide a convenient and consistent interface for
converting microseconds to milliseconds, complementing the existing SEC, USEC,
and NSEC conversion macros and improving code readability.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-01 01:14:01 +08:00
aviralgarg05
a4315fbb45 arch/arm/src: Fix Ethernet RUNNING status regression in IMXRT and STM32(F7/H7).
Add missing netdev_carrier_on() and netdev_carrier_off() calls to
imxrt_enet.c, stm32f7/stm32_ethernet.c, stm32h7/stm32_ethernet.c,
and stm32/stm32_eth.c. This ensures the interfaces correctly report
IFF_RUNNING status, as required by recent networking stack changes.

Verification:
- imxrt_enet.c pass ./tools/checkpatch.sh.
- stm32f7/stm32_ethernet.c pass ./tools/checkpatch.sh.
- stm32h7/stm32_ethernet.c pass ./tools/checkpatch.sh.
- stm32/stm32_eth.c pass ./tools/checkpatch.sh.
- Manual compilation verification for IMXRT1060 driver.
- Addresses CI failures in arm-13 job (STM32H7).

Signed-off-by: Aviral Garg <gargaviral99@gmail.com>
2026-02-01 01:12:18 +08:00
hujun5
7a5d333454 sched_waitid.c: HIS_metric_violation: CCM
Extract the core waitid logic into a separate waittcb() helper function to reduce the
cyclomatic complexity of the main waitid() function. This improves code maintainability,
reduces nested conditions, and enhances code clarity while preserving all functionality.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-31 13:11:34 -03:00
hujun5
5fca12c277 sched_waitid.c: HIS_metric_violation(HIS_GOTO)
Replace all goto statements with structured control flow using while loops and
conditional blocks. Consolidate early returns into a single error-handling path
for better code structure and MISRA HIS standards compliance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-31 13:11:34 -03:00
Bowen Wang
f1d06cbdcf drivers/virtio: fix the minor code style in virtio.c
Add empty line after `}`

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-31 13:09:30 -03:00
Adwait Godbole
16e2aa0922 docs: Update Signal Interfaces documentation
Update the Signal Interfaces documentation to include all
signals with configurable default actions and group them
by behavior for improved readability.

This reflects the current implementation in
sched/signal/sig_default.c.

Signed-off-by: Adwait Godbole <adwaitngodbole@gmail.com>
2026-01-31 10:07:36 -03:00
wangmingrong1
28026af824 arch/sim: Add sigdelset to nuttx-names.in
sigdelset is used in up_enable_irq: sigdelset(&act.sa_mask, SIGSTOP);

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-01-31 14:14:32 +08:00
Bowen Wang
3237e25d70 drivers/virtio: use virtqueue_nused() to check pending buffers
Replace direct virtqueue internal field access with virtqueue_nused()
API to check for pending buffers in interrupt handlers. This improves
code maintainability and handles cached memory scenarios correctly.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-31 14:14:25 +08:00
hujun5
1900d4c8fb sched_sysinfo.c: coverity HIS_metric_violation: RETURN
This change consolidates multiple return statements in the sysinfo() function
into a single exit point and inverts the error condition to improve code structure
and comply with MISRA HIS coding standards for safety-critical systems.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-31 02:53:58 +08:00
nope
f375093a25 arch/esp32s3/spi: make sure spi don't send wrong bytes when dma is enabled
SPI transmits incorrect bytes when DMA is enabled and `txbuffer` of
`esp32s3_spi_dma_exchange()` is NULL, causing mounted FAT32 SD cards
to fail with -ENODEV during read operations.

Signed-off-by: liu <liu334275@gmail.com>
2026-01-31 02:50:52 +08:00
hujun5
a3da45e1dc libc/tls: update preprocessor condition comment to match implementation
Update the closing preprocessor comment in tls_getinfo.c to accurately reflect
the simplified conditional compilation check. The comment now correctly represents
the actual guard condition used for the tls_get_info function implementation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-31 02:49:10 +08:00
hujun5
ceb23153c3 sem_rw.c: coverity HIS_metric_violation: RETURN
This change consolidates multiple return statements in down_write_trylock()
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-31 02:45:02 +08:00
paolo
c63b0510fb rp23xx/rp23xx-rv: Fix GPIO interrupt handler for RP2350B variant.
The GPIO interrupt handler had hardcoded values that only worked
correctly for RP2350A (30 GPIOs). For RP2350B (48 GPIOs):

- Loop count was hardcoded to 6 registers but should be computed
  based on RP23XX_GPIO_NUM (4 for RP2350A, 6 for RP2350B)
- Reserved bits mask was always applied at register index 3, but
  for RP2350B register 3 contains valid GPIOs 24-31. This caused
  interrupts for GPIOs 30-31 to be incorrectly discarded
- PWM port validation rejected valid ports 8-11 on RP2350B which
  has 12 PWM slices instead of 8

Changes:
- Add RP23XX_GPIO_NREGS macro to compute number of interrupt registers
- Use conditional compilation to only mask reserved bits on RP2350A
  where the last register has 6 valid GPIOs (bits 0-23)
- Fix PWM port validation to allow 12 ports on RP2350B

Signed-off-by: paolo <paolo.volpi@gmail.com>
2026-01-31 02:43:51 +08:00
hujun5
3ec45774fb sched_get_stateinfo.c: misra_c_2012_rule_8_9_violation
Move the static g_statenames array from file scope to block scope within the
nxsched_get_stateinfo() function. This resolves MISRA C 2012 Rule 8.9 violation
which requires static variables to be used at block scope when only one function accesses them.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-31 02:39:19 +08:00
hujun5
2860333552 sched_setpriority.c: coverity HIS_metric_violation: RETURN
This change consolidates multiple return statements in nxsched_set_priority()
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-31 02:38:55 +08:00
wangmingrong1
fee69a2046 driver/virtio: Delete reset on initialization
Resetting during initialization can cause qemu to lock up, for example, virtio-gpu. qemu does not need to reset virtio during initialization.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-01-31 02:38:46 +08:00
zhaohaiyang1
f653ffd723 forward: Add IFF_NOSRC_FORWARD and IFF_NODST_FORWARD flags.
* IFF_NOSRC_FORWARD: Controls whether device prohibits forwarding packets inputs
* IFF_NODST_FORWARD: Controls whether device prohibits forwarding packets outputs

This allows users to selectively enable/disable forwarding on specific
devices, improving network flexibility and security.
Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2026-01-31 02:37:58 +08:00
paolovolpi
db50f0445a drivers/ioexapnder/mcp23x17 : Fix write gpio output values on OLAT registers
Gpio output value must be set on OLATA and OLATB registers.

Summary

Why is this change necessary?
This is a bug fix. The MCP23x17 driver was writing GPIO output values to incorrect registers, causing output
pins to not behave as expected.

What functional part of the code is being changed?
The MCP23x17 I/O expander driver (drivers/ioexpander/mcp23x17.c).

How does the change work?
The fix ensures GPIO output values are written to the OLATA and OLATB (Output Latch) registers instead of the
incorrect registers. The OLAT registers are the proper registers for controlling the actual output pin
states on the MCP23x17.

Impact

- User experience: No adaptation required. This fix corrects existing broken behavior.
- Build: No impact.
- Hardware: Affects boards using the MCP23x17 I/O expander.
- Documentation: None required.
- Security: No impact.
- Compatibility: Backward compatible - fixes incorrect behavior.

Testing

Build Host:
- OS: Ubuntu 22.04
- Compiler: arm-none-eabi-gcc

Target:
- Architecture: ARM (RP2350)
- Board: RP2350-based board
- Configuration: Custom config with MCP23x17 enabled over I2C0

Testing performed:
- Connected MCP23x17 to RP2350 via I2C0
- Attached an LED array to all 16 GPIO pins of the MCP23x17
- Configured all 16 GPIO as outputs
- Wrote a simple test application to toggle the LEDs on and off
- Before fix: LEDs did not respond correctly to output commands
- After fix: All 16 LEDs toggle on/off as expected

Signed-off-by: paolo <paolo.volpi@gmail.com>
2026-01-30 17:42:48 +01:00
hujun5
926f5de541 sched_cpuload.c: misra_c_2012_rule_8_9_violation
Move the static g_cpuload_wdog watchdog timer from file scope to block scope
within the cpuload_init() function. This resolves MISRA C 2012 Rule 8.9 violation
which requires static variables used by a single function to be scoped at block level.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-30 12:52:22 -03:00
Laczen JMS
27542b3b09 boards/xtensa/esp32: remove alignments for simpleboot
The simpleboot format does not require alignment sections to be
inserted as they are added by esptool.py

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2026-01-30 11:18:02 -03:00
hujun5
71b7493a86 tls_getinfo.c: tls_get_info needs to be compiled in most cases.
Simplify the compilation condition for tls_get_info() by removing the
CONFIG_TLS_ALIGNED check and adding an undef directive to ensure the function
is available in most cases rather than being limited to kernel or non-aligned TLS builds.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-30 20:13:28 +08:00
Bowen Wang
521fcd964d virtio: should use size matched operation to read virtio config space
1. Use virtio_read_config_bytes() to read the string types in
rpmsg-virtio and virtio-net;
2. Use virtio_read_config_member() to read the elements in
virtio-snd configuration space;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 08:11:57 -03:00
wangxingxing
d1ae87a97a fs/9pfs: use virtio_read_config_bytes() to read the tag in config space
Follow the virtio spec, should use size matched operation to read virtio
config space.

Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
2026-01-30 08:11:57 -03:00
Bowen Wang
129955eb14 virtio/virtio-config: add virtio_read_config_bytes() api
Follow the virtio spec:
For the device-specific configuration space, the driver MUST use 8
bit wide accesses for 8 bit wide fields, 16 bit wide and aligned
accesses for 16 bit wide fields and 32 bit wide and aligned accesses
for 32 and 64 bit wide fields.

For a string in the virtio config space, we should should byte to
byte read operations to read this string, so add a api
virtio_read_config_bytes() for this.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 08:11:57 -03:00
humzak711
46e03d0471 arch/x86_64: use pause to reduce power consumption in spin wait loops
Signed-off-by: humzak711 <humzak711@gmail.com>

This commit defines the UP_WFE() macro as the 'pause' instruction for
x86_64. This optimization reduces power consumption and prevents
pipeline flushes caused by memory ordering violations during contended
spinlock acqusitions
2026-01-30 08:09:44 -03:00
Bowen Wang
97b64010cd Documentation/rpmsg: add rpmsg dump documentation
Add documentation for the RPMsg dump command, which is a diagnostic
tool for dumping RPMsg debugging information. The document covers:

- Command usage and syntax
- Output description including CPU info, endpoint list, virtqueue
  dump, and buffer states
- Common debugging use cases such as TX buffer timeout issues,
  communication failures, and buffer leak detection

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 07:50:11 -03:00
Bowen Wang
5e2b3a114f lib/rpmsg: add priority support for rpmsg endpoint
Add priority field to rpmsg_endpoint structure to support
message prioritization. This allows different endpoints to
have different priority levels for scheduling purposes.

Changes:
- Define priority constants (MIN=0, DEFAULT=127, MAX=255)
- Add RPMSG_PRIO_RT alias for real-time priority
- Add priority field to struct rpmsg_endpoint
- Initialize priority to default value in rpmsg_register_endpoint()

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 07:50:11 -03:00
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