Commit Graph

60635 Commits

Author SHA1 Message Date
likun17 d9aaaaf1c7 drivers/sensors: Waiting time optimized.
wait proxy timeout changed to 1 second.

Signed-off-by: likun17 <likun17@xiaomi.com>
2026-01-22 17:17:51 +08:00
likun17 19b3d66759 drivers/sensors: wait proxy logic optimization.
The interface for asynchronously calling sensor_rpmsg_ioctl
not waits for the proxy.

Signed-off-by: likun17 <likun17@xiaomi.com>
2026-01-22 17:17:51 +08:00
dongjiuzhu1 636264a7d6 drivers/sensors: wait proxy created when send ioctl message to remote.
since creating resources on the remote core takes time,
we need to wait for the remote core to return ack.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-22 17:17:51 +08:00
yukangzhi 53e8c008f5 fs: Fix the incorrect return value of the lseek interface.
The lseek interface needs to return the new offset in file.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-22 17:15:16 +08:00
pangzhen1 14efe537bd arch/tricore: add tricore mpu driver
tricore mpu driver code

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-22 16:45:58 +08:00
hujun5 b0cb4e5968 arm64: add MPU-based address environment support and refactor MMU variant
Rename arm64_addrenv.c to arm64_addrenv_mmu.c to separate MMU-specific logic.
Add new arm64_addrenv_mpu.c with stub implementations of address environment
functions for MPU-based systems. Enable address environment support in FVP ARMv8-R
Kconfig to support kernel stacks in protected mode. Conditionally build MPU or
MMU address environment code based on CONFIG_ARCH_USE_MMU/CONFIG_ARCH_USE_MPU.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:39:34 +08:00
hujun5 14e5d8a995 arm64: fix mpu_freeregion
The limit register contains the enable/disable bit for the MPU region,
so it must be written first before writing the base register to ensure
proper region disable operation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:39:00 +08:00
hujun5 223230a9ed spinlock: add rspin_lock_count
spinlock: add rspin_lock_count query interface

Add rspin_lock_count() function to query the current recursion count of a
recursive spinlock. This allows callers to inspect the lock state without
modifying it, useful for debugging and diagnostics.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:38:37 +08:00
hujun5 4c43efafa5 spinlock: optimize the implementation of rspinlock in a single-core
Add CONFIG_SPINLOCK conditional compilation to optimize rspinlock functions
for systems without spinlock support. Provide simple macro implementations
that bypass recursive lock logic when spinlock is not configured.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:38:37 +08:00
hujun5 bb69f77164 spinlock: add rspinlock interface for recursive spinlock support
Add new recursive spinlock (rspinlock) interface functions to support nested
spinlock acquisitions by the same CPU. Includes rspin_lock, rspin_unlock,
rspin_breaklock, and rspin_restorelock for proper recursive lock management.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:38:37 +08:00
hujun5 6f03601169 arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures
Rename STACK_ALIGNMENT macro to STACKFRAME_ALIGN throughout the codebase
to provide clearer naming semantics. The new name better reflects the macro's
purpose of frame alignment rather than general stack alignment.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:37:24 +08:00
dongjiuzhu1 d61661e4c2 timers/rtc: check ioctl null pointer and return -ENOTTY
Add null pointer check for ioctl operations in RTC driver.
Return -ENOTTY when ioctl function pointer is NULL to prevent crashes.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-22 14:07:59 +08:00
dongjiuzhu1 9a0b42d4f0 drivers/rpmsgrtc: fix crash because list_node is not in server list
Fix potential crash when removing client from server list.
Add proper list initialization check before deletion operation.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-22 14:07:59 +08:00
dongjiuzhu1 1a87094e35 drivers/rpmsg_rtc: don't rpmsg send for some core
without rpmsg rtc client driver

Avoid sending rpmsg messages to cores that don't have RTC client driver.
Check endpoint availability before attempting to send messages.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-22 14:07:59 +08:00
dongjiuzhu1 37729ecb51 drivers/timer/rpmsg_rtc: export ept about rtc to remote cpu
Export rpmsg endpoint to allow remote CPU to access RTC services.
Simplify the initialization flow and remove unnecessary Kconfig options.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-22 14:07:59 +08:00
wangzhi16 a73ff585f1 sched/signal: fix the occasional issue where SIGCONT was not executed
Build Documentation / build-html (push) Has been cancelled
In multi-core scenarios, a problem occurs: the target thread receives SIGCONT but does not execute them.

Further analysis reveals that in the sig_dispatch function, the target thread is placed in the readytorun queue only if the SIGCONT signal is sent and the target thread is in the TSTATE_TASK_STOPPED state. However, if the following conditions occur:

CPU0				CPU1
dispatch SIGSTOP
dispatch SIGCONT(check state)
				sched_suspend(set task_state = TSTATE_TASK_STOPPED)

This causes the target thread on CPU 1 to receive SIGCONT but not be placed in the readytorun queue, remaining in the stopped state.
Therefore, A flag is needed to indicate whether the SIGCONT action has been executed. At the same time, the critical section protection range of nxsig_stop_task needs to be expanded to prevent another thread from executing the SIGCONT logic during the execution of this function.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-22 03:58:12 +08:00
pangzhen1 d11307b236 sched/irq: Avoid same static function name in different files
In irq_attach_thread.c and irq_attach_wqueue.c, there are static functions named irq_default_handler with the same name, which can be easily misunderstood. Therefore, they have been renamed to different functions.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-22 03:51:00 +08:00
Jean THOMAS 6581e312f5 stm32: disable UART up_putc when semihosting
Do not compile up_putc functions in stm32_serial.c to avoid conflicts
with implementation from arm_semi_syslog.c when semihosting is enabled.

Signed-off-by: Jean THOMAS <jean@lambdaconcept.com>
2026-01-22 03:49:05 +08:00
Jiri Vlasak 4710b2f632 doc/apps: Add BARE 2026-01-22 03:48:35 +08:00
Bowen Wang baba361bb1 Documentation/rpmsg: add RPMsg core concepts document
Add a concise RPMsg documentation covering:
- Overview of RPMsg framework for AMP systems
- Application scenarios (heterogeneous/homogeneous AMP)
- Layered architecture (Services/Framework/Transport/Physical)
- Message encapsulation process
- Workflow: channel establishment, sending and receiving
- Key design considerations (FIFO order, callback blocking)
- Transport layer comparison

All diagrams use ASCII art for portability.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-22 03:45:55 +08:00
Bowen Wang e238804119 rpmsg/rpmsg_virtio: add rpmsg virtio common pm support
implement the pm feature in rpmsg virtio common part, now the rpmsg
virtio can use in the low power case.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-22 03:45:55 +08:00
Lars Kruse 21c19b7824 drivers/analog/mcp47x6: fix configuration command
Previously the ioctl-based configuration was not encoded properly.
It lacked the three command bits selecting the "set volatile
configuration" mode.
Thus, configuration the reference, power-down or gain resulted in no
change.

Now the configuration is properly applied.

The DAC value to be send is now combined with the proper command prefix
bits, too.
But this operation was already working, since the command prefix is zero.

Signed-off-by: Lars Kruse <devel@sumpfralle.de>
2026-01-22 00:12:37 +08:00
Côme VINCENT 34d3b06955 drivers/timers/capture: fix typo in capture.h
This commit fixes a typo in the capture.h header file. This is a
breaking change, but the fix is trivial (replace macro with new one).

Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
2026-01-22 00:06:45 +08:00
fangxinyong cd958831d8 sched/init: use enum type for g_nx_initstate
Change g_nx_initstate type from uint8_t to enum nx_initstate_e.
Avoid enum/integer base-type mismatch in init state comparisons.
Satisfies MISRA C:2012 Rule 10.4 without behavior change.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong d38078b778 libs/libc: posix_spawnattr_init zero-initialize attr
Zero-initialize posix_spawnattr_t in posix_spawnattr_init().
Prevent use of uninitialized fields reported by Coverity.
Preserve existing default flag initialization.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong ef6278b0ff arch/arm: armv8-r irq type-safe bit ops
Use 1u/~1u constants for TPIDRPRW bit operations.
Avoid implicit conversion to a different underlying type (MISRA Rule 10.3).
No functional change to task pointer tagging logic.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong a7b7630fd3 sched/task: task_setup return path cleanup
Refactor nxtask_setup_stackargs() to use a single ret exit path.
Avoid partially-initialized state on error paths and improve readability.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong 31901573ba sched/task: task_spawnparms return path cleanup
Initialize ret and propagate scheduler/param errors via a single return.
Make spawn_file_is_duplicateable() decision explicit using a dup state.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong c9f460d793 task_task_cancelpt.c:coverity HIS_metric_violation: RETURN
Replace early return with a ret flag to unify the exit path.
Keep critical section behavior unchanged while simplifying control flow.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
fangxinyong d2b87c7189 task_getpid.c:coverity HIS_metric_violation: RETURN
Use a local ret variable and return once at the end.
This keeps the IDLE_PROCESS_ID fallback behavior unchanged.
Addresses Coverity HIS_metric_violation: RETURN.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +08:00
hujun5 bb8d16f422 sched: add spinlock to sched_note_preemption and nxsched_critmon_preemption
Add spinlock protection to sched_note_preemption and nxsched_critmon_preemption.
Ensures thread-safe access to global state in preemption notification and critical
monitoring, preventing race conditions in SMP and interrupt contexts.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 20:29:55 +08:00
zhanghongyu fa652f9c24 net: limit TCP and UDP send/recv buffer usage with throttled IOB
The main content of this submission is to limit both the TX/RX buffers
of TCP/UDP to throttled IOBs, avoiding impacts on the sending and
receiving of control-type messages.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-21 20:06:47 +08:00
hujun5 a50737a75f tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts
Fix incorrect direct access to semcount field by using val intermediate
field in memory pool and network stats debugging scripts. This corrects
the data structure navigation to match actual kernel semaphore layout.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 20:05:18 +08:00
zhanghongyu 646010d0a0 net/bluetooth: fix rmutex deadlock
the lock in the "bluetooth_conn" was not initialized, which resulted in
a blocking situation when attempting to hold the lock for the first
time.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-21 19:24:02 +08:00
yukangzhi 3448e84a4c arch/arm: armv8-r PL at startup needs to be checked
When the system startup from the PL1 SYS mode, the initialization
of the PL2 HYP register needs to be skipped. Put the Hypervisor
initialization code together and skip it all at once.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-21 19:21:43 +08:00
xuxin19 98d4d887da msvc ci:change arm source to xpack
Try using Xpack to obtain the Windows toolchain to resolve CI/BB issues.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-21 19:19:39 +08:00
hujun5 f6f8acafbb arch: fix cmake error
Add default values (0x0) for ARCH_TEXT_VBASE, ARCH_DATA_VBASE, and
ARCH_HEAP_VBASE to resolve cmake configuration warnings when these
values are not explicitly set during initialization.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 14:38:36 +08:00
hujun5 37ecb28eb1 semaphore/sem_trywait.c: Remove redundancy leave_critical_section
Remove redundant leave_critical_section() call in nxsem_trywait_slow() as the
critical section is properly released at the exit point via 'out' label, making
the intermediate call unnecessary and eliminating code duplication.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 14:27:14 +08:00
hujun5 0b96303fda libc/environ: add interrupt context check to getenv
Prevent getenv() from being called in interrupt context by adding
up_interrupt_context() check. This ensures thread-safe access to
environment variables in multi-threaded scenarios.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:37:55 +08:00
hujun5 5fb2ff3fe9 sched/tls: fix thread ID initialization in tls_dup_info
Set the thread ID (tl_tid) to the destination task's pid during TLS
duplication in fork operations. This ensures the duplicated TLS info
correctly reflects the forked task's thread identifier.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:34:27 +08:00
wangchengdong 291938150f sched/hrtimer: add option for list-based hrtimer management
Add support for managing hrtimers using a simple list. This approach
  is more memory-efficient, as list nodes use less memory, and it is
  preferable to an RB-tree when the number of hrtimers is relatively small.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-21 10:33:12 +08:00
anpeiyun 3c1712c66d kasan/hook.c: prevent recursive report overflow
Stop the report handler from re-entering KASAN by halting checks when printing.
Reuse the dump_only flag so read/write panic toggles only emit stack traces.
Retain stack dumps for panic-disabled paths without risking another overflow.

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-01-21 10:27:02 +08:00
hujun5 c9e5b52f33 sched/pthread: remove duplicate robust mutex checking logic
Remove redundant robust mutex owner validation code from pthread_mutex_timedlock
that duplicates similar logic already present in pthread_mutex_take. This reduces
code duplication and improves maintainability.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:12:22 +08:00
hujun5 bc3d478749 sched/pthread: use spin_lock_irqsave_nopreempt for mutex head lock
Replace spin_lock_irqsave with spin_lock_irqsave_nopreempt in
pthread_mutex_inconsistent to prevent preemption during mutex list
manipulation and avoid potential deadlocks or race conditions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:05:17 +08:00
yintao f7dc54e869 drivers/rpmsg: use nuttx/atomic.h instead meatl/atomic.h
All the atomic operation already changed to nuttx's, so change
the include header too

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-21 10:01:40 +08:00
raiden00pl 491e86762b boards/nrf53: correct rptun names
after recent changes in rptun framework, HCI over rptun was broken due to
wrong cpu names.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-01-20 17:54:49 +01:00
Laczen JMS 88f62fd322 boards/xtensa/esp32: add rtc_reserved_seg to legacy_sections
Enable building the legacy idf format of nuttx when rtc is enabled.
Without this addition the build fails because the rtc data is placed in
rom.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2026-01-21 00:39:12 +08:00
makejian 5b52a32f5a crypto/crypto.c: Determine the order of obtained crypto drivers
After adding the cross-core crypto driver, there are now three encryption modes:
1. Hardware driver in local core
2. Crypto driver in remote core
3. Software encryption in local core

This prioritizes local hardware driver first, then remote driver (typically hardware),
and finally local software encryption as a fallback.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian e23dd613c9 crypto/cryptodev: optimize without dynamic memory in crypto process
Replace dynamic memory allocation with stack-based variables in cryptodev_op().
This eliminates kmm_malloc/kmm_free overhead and simplifies error handling
by removing the need for goto bail cleanup paths.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian 66f9329839 crypto/cryptodev: export ivlen to support different cipher algs
Add ivlen field to crypt_op and crp_ivlen to cryptop structure to support
cipher algorithms with different IV lengths.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00