Commit graph

60731 commits

Author SHA1 Message Date
makejian
3f0cc5f09c crypto: export algorithm about ecc
Transplanting the ECC algorithm from https://github.com/jestan/easy-ecc

which is BSD lisence

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-26 10:55:57 +08:00
Max Kriegleder
c5d57fab83 arch/arm/nrf{52|53|91}: fix timer timeout value (overflow issue)
When setting the timeout value, an overflow occurs. Also, if
NRF52_TIMER_PER > 1000000, the macro will evaluate to zero in
its current form.

Signed-off-by: Max Kriegleder <max.kriegleder@gmail.com>
2026-01-26 10:55:28 +08:00
zhaoxingyu1
58ae8e9605 mtdconfig: change TESTING_MTD_CONFIG_FAIL_SAFE name
change nvs module testcase name TESTING_MTD_CONFIG_FAIL_SAFE
to CONFIG_TESTING_MTD_CONFIG_NVS

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-26 10:52:51 +08:00
zhaoxingyu1
e62ba0adc5 mtdconfig: change the relevant judgments of mtd_config
For the MTD_CONFIG configuration item in
drivers/mtd/Kconfig has changed.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-26 10:52:51 +08:00
zhaoxingyu1
0e1dd46f3b mtd/mtd_config: add mtdconfig_register_by_path/mtdconfig_unregister_by_path api
mtd_config/mtd_config_nvs should all support
mtdconfig_register_by_path/mtdconfig_unregister_by_path api

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-26 10:52:51 +08:00
zhaoxingyu1
e4a73edec8 mtdconfig: lomtdconfig device change to depends on !MTD_CONFIG_NONE
The structure of mtd_config in Kconfig has changed.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-26 10:52:51 +08:00
zhaoxingyu1
273222c06e mtdconfig: modify mtdconfig kconfig
change filename  mtd/mtd_config_fs.c to mtd/mtd_config_nvs.c
and optimize the configuration related to mtdconfig

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-01-26 10:52:51 +08:00
simbit18
116196da02 boards/arm/s32k1xx: CMake added boards
CMake added boards:

  - s32k118evb

 -  s32k144evb

 -  s32k146evb

 -  s32k148evb

 -  ucans32k146

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-01-26 10:42:24 +08:00
simbit18
92bb15b85f arch/arm/src/S32K1xx: CMake build implemented for NXP S32K1 Family
- added NXP S32K1 Family

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-01-26 10:42:24 +08:00
wangchengdong
3538d805fc sched/hrtimer: refresh code comments to match implementation
Several code comments in the hrtimer subsystem have become outdated
following recent implementation changes. This patch updates them to
accurately describe the current code behavior and algorithms.

Signed-off-by: Chengdong Wang <wangcd91@gmail.com>
2026-01-26 10:10:57 +08:00
masc
09f09daeab Author: shichunma <masc2008@gmail.com> Date: Thu Jan 15 07:24:08 2026 +0800
drivers/usbdev/rndis: after client send notication, host can't read msg timely

rndis use intr ep to notify host to read RNDIS message from client, it should
read all the messages cached. Need notify host to read again if there is msg left.

Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
2026-01-25 23:59:49 +08:00
hujun5
172c548812 trace: fix macro line continuation formatting
Fix macro line continuation formatting in trace.h by consolidating
multi-line macro definitions onto single lines. This eliminates unnecessary
line continuations and improves code readability while maintaining functionality.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-25 10:45:26 -03:00
yukangzhi
b50c5f6638 note/noteram: add FIONREAD ioctl to report unread buffer size
Add handling for the FIONREAD ioctl in noteram_ioctl to return the
number of unread bytes in the circular note buffer (noteram_unread_length()).
Validate the argument pointer and return -EINVAL if it is NULL.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-24 23:32:57 +08:00
yukangzhi
b7fd8a268d arch/tricore: add NMI trap handler (weak)
Add support for handling non-maskable interrupts (NMI) on TriCore
platforms. The NMI trap handler `tricore_nmitrap()` is provided as a weak
function that prints diagnostic information and invokes a panic with
register context. The main trap dispatcher will invoke `tricore_nmitrap`
when an NMI trap class is detected.

This change improves diagnostics when watchdog-induced NMIs or other
non-maskable exceptions occur during runtime.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-24 23:32:03 +08:00
liwenxiang1
9d5e83b411 gdbserver.py:add x86_64 arch
Add x86_64 support, we can use it to analysis of x86_64 crashes

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-24 23:31:43 +08:00
anjiahao
73aa7391a9 gdbserver.py: use lief inside of pyelftools to improve load speed
test:
an elf have 273MB, load symbol 32s to 2s

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-24 23:31:43 +08:00
anjiahao
3833dea6a4 gdbserver.py: if thread < 0, need set to 0
Fix unexpected thread values

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-24 23:31:43 +08:00
buxiasen
4063f4b207 tools/gdbserver: compatible with vscode, c command should cut from [2:
Fix use in vsocode

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-01-24 23:31:43 +08:00
anjiahao
218fe2c53b gdbserver.py:add unpack_data log info to debug
Improve debug

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-24 23:31:43 +08:00
yinshengkai
d3460aa111 note/ram: support multiple noterams to dump data when panic occurs
When creating a noteram, you can choose whether to dump
this noteram when the system crashes.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-01-24 19:33:17 +08:00
pangzhen1
7acb0df84f arch/arm: Add the macro definitions for CFI instructions for greenhills compiler
Add the macro definitions for CFI instructions for greenhills compiler

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-24 19:32:25 +08:00
trns1997
9159f6e353 build/cmake: Add toolchain C++ library linking for all platforms.
Extend CONFIG_LIBCXXTOOLCHAIN support to all remaining platforms
in CMake builds by explicitly locating and linking libstdc++.a
from the toolchain. This prevents build failures caused by STL
header/library mismatches where toolchain headers are included
without the corresponding library.
* Adds nuttx_find_toolchain_lib() calls for all platforms.
* Aligns CMake behavior with Make build system.

Signed-off-by: trns1997 <trns1997@gmail.com>
2026-01-24 19:30:21 +08:00
yukangzhi
b82ad5c495 arch/tricore: disable CPU and system watchdogs during startup
Some Aurix Boot-FW configurations leave watchdogs enabled by default,
which can cause unexpected resets during early bring-up. This change
explicitly disables the CPU and system watchdogs during core0 startup to
ensure reliable system initialization.

- For TC3XX chips, call `IfxScuWdt_disableCpuWatchdog()` and
  `IfxScuWdt_disableSafetyWatchdog()`.
- For TC4XX chips, call `IfxWtu_disableCpuWatchdog()` and
  `IfxWtu_disableSystemWatchdog()`.

This is a low-risk startup change and does not alter watchdog behavior
after system initialization.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-24 19:29:31 +08:00
yukangzhi
8cdf58d124 libs/libc/regex: remove logically dead code in regcomp.c
This change removes redundant and unreachable checks of `status != REG_OK`
that were reported by static code scanning. Two occurrences were fixed in
`libs/libc/regex/regcomp.c`

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-24 19:28:56 +08:00
liwenxiang1
b1fe00fa1e arch/acpi:Fix issue 02 Compile acpidump crash problem
At certain optimization levels, GCC/Clang may insert UD2 if it detects undefined behavior (such as integer overflow or illegal pointer access), causing the program to crash immediately instead of executing unpredictable code.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-24 19:28:22 +08:00
pangzhen1
5a1a7dc38e sched/irq: Every function must have exactly one entry point and one exit point
According to MISRA C-2004 Rule 14.7, Every function must have exactly one entry point and one exit point.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-24 19:26:17 +08:00
cuiziwei
f17b82bd65 libcxx/libstdc++: Add libsupc++.defs to support libsupc++
This patch adds support for building libsupc++ (the C++ runtime
support library from GCC's libstdc++-v3).

libsupc++ provides core C++ runtime support including:
- Exception handling (eh_*.cc)
- RTTI (Run-Time Type Information)
- Memory allocation operators (new/delete)
- Type info support

The implementation includes:
- libsupc++.defs for libsupc++ build integration
- support make and cmake build
- Use gthr.h, gthr-posix.h and unwind-pe.h from libgcc
- LIBSTDCXX_VERSION config option with default 14.2.0

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-01-24 17:33:19 +08:00
humzak711
e47a0dd228 arch/x86_64: optimize assembly instructions for size and performan
Signed-off-by: humzak711 <humzak711@gmail.com>

arch/x86_64: optimize assembly instructions for size and performance
2026-01-24 17:24:41 +08:00
Bowen Wang
2795918932 drivers/rpmsg: unify cpuname/local_cpuname to struct rpmsg_s
Unify all the cpuname/local_cpuname to struct rpmsg_s, so we can
remove the ops->get_cpuname and ops->get_local_cpuname in
struct rpmsg_ops_s.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-24 17:10:18 +08:00
buxiasen
c4acb35000 drivers/rpmsg_virtio_lite: init the pm wakelock name
Fix the issue that pm feature not picked before
rename the rpmsg_virtio to rpmsg_virtio_lite

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-24 17:10:18 +08:00
hujun5
fd67ef3af9 assert: fix DEBUGASSERT recursive triggering
Add head pointer checks in notifier_call_chain macros to prevent recursion into
sched_lock() when assertions are triggered during early system startup. This avoids
cascading DEBUGASSERT failures when the notifier head is empty or uninitialized.
backtrace:
  DEBUGASSERT(rtcb && rtcb->lockcount < MAX_LOCK_COUNT);
  sched_lock()
  panic_notifier_call_chain
  _assert()
  arm64_fatal_handler

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-24 17:03:57 +08:00
yinshengkai
2bfff207fd drivers/serial: Fix SIGINT not delivered to foreground process on Ctrl-C.
When pressing Ctrl-C, the foreground process did not receive SIGINT
and failed to terminate.

The serial driver called nxsig_tgkill(-1, dev->pid, signo) from
interrupt context. With pid=-1, nxsig_dispatch() was called with
thread=true, which requires stcb->group == this_task()->group.
However, in interrupt context, this_task() returns the IDLE task,
whose group differs from the target process group. This caused
the signal dispatch to fail with -ESRCH.

Solution:
Replace nxsig_tgkill(-1, pid, signo) with nxsig_kill(pid, signo).
nxsig_kill() uses thread=false, which routes through group_signal()
without the same-group check, allowing signals to be delivered
correctly from interrupt context.

Impact:
- Fixes Ctrl-C signal delivery in serial console
- No API changes
- Affects serial driver interrupt handling only

Testing: Verified on QEMU ARM64 simulator with serial console

Signed-off-by: yinshengkai <yinshengkai@bytedance.com>
2026-01-24 16:54:36 +08:00
pangzhen1
72117428fb sched/irq: Avoid directly converting variables of type uintptr_t to void*
According to MISRA C-2012 Rule 11.6, a cast shall not be performed between pointer to void and an arithmetic type

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-23 20:30:05 -03:00
zhanghongyu
d5d6b65213 Revert "net: limit TCP and UDP send/recv buffer usage with throttled IOB"
This reverts commit fa652f9c24.

When testing iperf on boards such as ESP32-C6, ESP32-C3, and ESP32,
blocking issues are encountered, so the patch is reverted.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-23 14:40:06 -03:00
yinshengkai
9015f40909 trace: add mark and printf support
Add new trace macros: trace_mark and trace_printf.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-01-23 11:30:28 -03:00
pangzhen1
d7bb8da695 sched/irq: Fix potential deadlock in irqchain_detach
Release g_irqchainlock before calling irq_detach to avoid holding two locks
simultaneously, which can cause thread deadlock.

The irqchain_detach function was calling irq_detach while holding g_irqchainlock,
and irq_detach attempts to acquire g_irqlock. This lock ordering violation could
lead to deadlock in multithreaded scenarios.

Fix:
- Move spin_unlock_irqrestore(&g_irqchainlock, flags) before irq_detach call
- Ensure locks are released in proper order to prevent circular wait

This is part of the irq_chain_lock feature for safer IRQ chain handling.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-23 08:17:49 -03:00
yukangzhi
1b22f8c65b driver/note: Fix compilation error when CONFIG_SYSLOG_TO_SCHED_NOTE=y
Add compilation condition for 'nx_vsyslog' syscall.
Export 'sched_note_printf_ip' syscall when CONFIG_SYSLOG_TO_SCHED_NOTE=y
Put the implementation of sched_note_printf_ip in libc/misc/lib_note.c

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-23 07:48:08 -03:00
hujun5
5f92db54a6 sched: fix regression from PR #18040 by adding NULL pointer safety
Replace DEBUGASSERT checks with proper NULL pointer validation in getpid() and
task_get_info() functions. Return IDLE_PROCESS_ID or -ESRCH on NULL conditions
instead of asserting, improving robustness during early system startup and error conditions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-23 16:59:55 +08:00
yinshengkai
cd1000575e docs/dumpstack: improve documentation
Add dumpstack usage and configuration instructions

Signed-off-by: yinshengkai <yinshengkai@bytedance.com>
2026-01-23 16:33:01 +08:00
yinshengkai
5892554984 arch/arm64: fix backtrace return address precision
The return address stored in the frame should point to the instruction
after the call. To get the actual call site, we need to subtract the
instruction size (sizeof(void *)) from the saved return address.

This ensures that backtrace addresses correctly point to the calling
instruction rather than the next instruction.

Signed-off-by: yinshengkai <yinshengkai@bytedance.com>
2026-01-23 16:33:01 +08:00
wangchengdong
1d6d682947 boards/sim: enable list-based hrtimer in CI ostest
Enable list-based hrtimer in CI ostest

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-23 16:28:22 +08:00
chenxiaoyi
dbbcd7c88c arch/xtensa: remove the use of XCHAL_SYSCALL_LEVEL
After PR#14672, there is no use of XCHAL_SYSCALL_LEVEL.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2026-01-23 10:52:43 +08:00
chenxiaoyi
775c95a599 arch/xtensa: delete XCHAL_SYSCALL_LEVEL macro definition
After PR#14672, there is no use of XCHAL_SYSCALL_LEVEL.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2026-01-23 10:52:43 +08:00
Bartosz Wawrzynek
585d954d0b boards/sim: Fix watchdog callback
drivers: Fix types and sx127x driver rx
net/pkt: Fix type

Small fixes.

Signed-off-by: Bartosz <bartol2205@gmail.com>
2026-01-23 09:46:02 +08:00
hujun5
5051721298 sched/pthread: move pthread mutex from syscall to user-space
Move pthread mutex operations from kernel-space syscall
interface to user-space implementations
to reduce syscall overhead. Relocate mutex holder list
tracking from task control block (tcb) to
thread local storage (tls) to improve memory layout and
cache efficiency. Add helper macros for
conditional mutex implementations and update syscall
interface accordingly.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 12:40:49 -03:00
guohao15
5e117fda60 mtdconfig: support ram_mtdconfig device && lomtdconfig device
For nvs test in qemu

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-01-22 23:18:26 +08:00
yinshengkai
2c1a615442 net: access the serial port in raw format to avoid character escaping
If the serial port is set to isconsole,
\n will be escaped as \r\n, causing communication failure.

Signed-off-by: yinshengkai <yinshengkai@bytedance.com>
2026-01-22 23:17:08 +08:00
dongjiuzhu1
f9c5647813 drivers/sensors: sensor deadlock fix.
using read-write lock to avoid deadlock

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-22 23:15:48 +08:00
likun17
6a8262314f drivers/sensors: sensor bug fix.
flush fixes the problem of not being able to get the lock.
call trace:

A thread:                               rptun thread:
lock upper_lock
	lock upper_lock
        rpmsg send             ->       wait upper_lock
        unlock upper_lock
        wait response        <--\--     don't reponse this rpmsg request
unlock upper_lock

Signed-off-by: likun17 <likun17@xiaomi.com>
2026-01-22 23:15:48 +08:00
dongjiuzhu1
61f7582cc7 drivers/sensors: sensor bug fix.
fix cross-core flush failed when physical driver without flush interface

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Signed-off-by: likun17 <likun17@xiaomi.com>
2026-01-22 23:15:48 +08:00