646 Commits

Author SHA1 Message Date
rbb666
5119fc5433 update:rtthread version number to v5.3.0 2025-11-10 16:56:22 +08:00
Copilot
d39a439603 [klibc] 将函数签名与标准 libc 对齐以修复类型冲突 #10890 2025-11-07 15:48:51 +08:00
Yonggang Luo
62bc4ba774 Remove rarely used rt_time_t
next_delay should be rt_tick_t

Use time_t for RT_DEVICE_CTRL_RTC_GET_TIME
2025-10-10 20:21:40 +08:00
Chen Wang
3dd4f71bb6 doxygen: cleanup code for group_thread_management
The cleanup involved three parts:

- Merging the standalone "/**@{*/" into
  "@addtogroup group_thread_management"

- Changing "/**@}*/" to "/** @} group_thread_management */",
  adding the group name makes it easier to find the matching "@{" part.

- Deleting the "@addtogroup" directive in "include/rtthread.h"
  because this header file doesn't have doxygen comments.
  All doxygen comments for function bodies are defined in other .c files.

  Note, we remian two doxygen comments for rt_thread_inited_hookproto_t
  and rt_thread_idle_sethook in the "include/rtthread.h".
  rt_thread_inited_hookproto_t is really defined here.
  For rt_thread_idle_sethook, please see FIXME comment for reason.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-30 10:25:08 +08:00
Chen Wang
05dc189e37 doxygen: cleanup code for group_object_management
The cleanup involved three parts:

- Merging the standalone "/**@{*/" into
  "@addtogroup group_object_management"

- Changing "/**@}*/" to "/** @} group_object_management */",
  adding the group name makes it easier to find the matching "@{" part.

- Deleting the "@addtogroup" directive in "include/rtthread.h"
  because this header file doesn't have doxygen comments.
  All doxygen comments for function bodies are defined in "src/object.c".

Plus minor cleanup for group_hook in src/object.c.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-29 14:22:40 +08:00
蒙蒙plus
138c8887e7 移除已经废弃的CPU使用率相关的字段和初始化代码 2025-09-12 09:56:16 +08:00
Chen Wang
f44ce3a64c doxygen: updated doc for thread management subsystem
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-02 18:05:44 +08:00
Rbb666
3c17851fe2 [Add][kernel/thread]Add thread overflow hook and testcases:thread_overflow_tc.c. 2025-09-02 16:46:55 +08:00
Rbb666
bc4c036942 [Add][kservice]Add thread usage support. 2025-08-30 13:10:14 +08:00
R b b666
0b14a54614 Update RT_VERSION to 5.2.2 (#10627)
Update RT_VERSION to 5.2.2.
2025-08-22 10:56:29 +08:00
cmbjxxiao
37d902537c [arm_compiler_v4/v5] define rt_packed as __packed #10553 2025-08-06 15:16:18 +08:00
Chen Wang
3c046646cb doxygen: promote object management to a separate page
For "RT-Thread User Guide":
Take the "RT-Thread Kernel Object Model" sub-section out of
the "Kernel Basics" section and rename it to "Object Management".

Correspondingly, rename the "Kernel Object Management" section
in the "RT-Thread API Guide" to "Object Management".

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-07-22 18:07:17 +08:00
Chen Wang
2aebe694d9 doxygen: group name all in lowcase (part 2) (#10530)
* doxygen: fs: unify groupname to lowercase

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* doxygen: drivers: unify groupname to lowercase

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* doxygen: signal: unify groupname to lowercase

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

---------

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-07-22 13:59:25 +08:00
Chen Wang
8e9872a554 doxygen: group name all in lowcase
This patch only updated the groups defined in documentation/0.doxygen.

Other groups will be moved into documentation/0.doxygen and updated at
that time.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-06-25 14:02:28 +08:00
vandoul
169d84d65a 修复单向列表移除节点时存在的安全风险.
Signed-off-by: vandoul <vandoul@ticks.cn>
2025-06-13 17:04:27 +08:00
Chen Wang
e234cc8658 doxygen: change group_Device to group_device_driver
The originally defined "group_Device" should actually
be part of the device-driver component, so create
a new "group_device_driver" and then rename
"group_Device" to "group_device_driver".

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-05-29 13:47:46 +08:00
htl5241
31ff6fecc1 [clock]添加 rt_tick_get_delta 函数 2025-05-23 14:21:37 +08:00
ricky
7125e7bebd include:rtdef.h: comment Refine the annotation of RT_ALIGN and RT_ALIGN_DOWN (#10201)
include :rtdef.h : [ Refine the annotation of RT_ALIGN and RT_ALIGN_DOWN ]

This macro is vulnerable to non-2-byte alignments,
but I assume that the macro definition was designed with an explicit use case of 2-byte alignments in mind.
Therefore, I only modify the comment to remind the user.

Solution:
RT_ALIGN(size, align) ((size) + (align) - 1) / (align) * (align)
RT_ALIGN_DOWN(size, align) (size) / (align) * (align)
Here's what deepseek recommends more.

Signed-off-by: Yucai Liu <1486344514@qq.com>
2025-04-18 17:07:57 +08:00
wycwyhwyq
12de72a462 add RT_THREAD_CTRL_SET_PRIORITY 2025-04-13 15:25:42 +08:00
wycwyhwyq
da1c5c7882 add RT_THREAD_CTRL_SET_PRIORITY 2025-04-13 15:25:42 +08:00
wycwyhwyq
f13193ff92 [src] fix mutex bug 2025-04-13 15:25:42 +08:00
Yang Xijing
6639dbe252 【修改】timer parameter注释 (#10172) 2025-04-08 12:11:19 +08:00
kk
4acef9b1cd Update include/rtdef.h version to 5.2.1 2025-03-28 23:12:14 -04:00
latercomer
4c061ceffe rttypes.h中增加了对ARCH_CPU_64BIT宏的判断
Signed-off-by: latercomer <latercomer@qq.com>
2025-03-17 16:45:59 +08:00
LaterComer
d5bc868d80 rttypes.h中rt_intptr_t和rt_uintptr_t定义反了 (#10115) 2025-03-16 23:31:41 +08:00
kurisaw
b3225ec81a fix: clear error compilation of signal in qemu-a9 smp mode 2025-02-22 14:17:35 -05:00
kurisaw
ea31985b32 fix: fixed an issue where rt_typeof was not supported in the MDK toolchain 2025-02-19 20:24:59 -05:00
Chen Wang
c40b79037c doxygen: add prefix for groups (#9991)
* doxygen: add prefix for groups

Add "group_" prefix to doxygen group names. This makes
it easier to grep with group name later.

This patch only modifies the groups defined in the pathes
of INPUT of documentation/Doxyfile:

INPUT = . \
        ../src \
        ../include \
        ../components/finsh \
        ../components/drivers/include/drivers \
        ../components/drivers/clk \
        ../components/dfs/dfs_v2/src \
        ../components/dfs/dfs_v2/include

Other groups are not touched.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* ci: fixed error report when run file_check.py

Such as:
- "please delete extra space at the end of this line."
- "the RT-Thread error code should return negative value. e.g. return
  -RT_ERROR"

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

---------

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-02-15 12:15:19 +08:00
Chen Wang
7c7ff6e532 kernel: cleanup debug APIs
- `dbg_log` is a “NOT RECOMMENDED API”, convert the calling of this
  API to LOG_x and remove this API.

- `dbg_here`/`dbg_enter`/`dbg_exit`: no one use these APIs, remove
  them directly.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2024-12-20 17:50:00 -05:00
GuEe-GUI
78f318aa8f [FIXUP] __rt_clz loss in aarch64
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-12-13 10:39:20 +08:00
Meco Man
8b4d1c0c5d [klibc] add rt_sscanf
cherry-pick from: https://github.com/PetteriAimonen/Baselibc/blob/master/src/vsscanf.c

BSD license
2024-11-25 09:49:23 +08:00
GUI
945114fd59 [DM/FEATURE] Support NVME (#9591)
* [DM/FEATURE] Support NVME

1. Support PRP and SGL (>= NVME v1.1) transport.
2. Support MSI/MSI-X for IO queues.
3. Support NVME on PCI.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-24 13:57:37 +08:00
GuEe-GUI
1bef42c64c [DM/FIXUP] remove some redundant INIT_EXPORT
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-18 15:03:23 +08:00
GuEe-GUI
3b22dbd049 [DM/FEATURE] DM Device IDA management
Drivers can manage their own IDs without having to concern
themselves with the register/unregister in system

Link: https://github.com/RT-Thread/rt-thread/issues/9534

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-18 14:23:25 +08:00
GuEe-GUI
d8db49c17a [COMPILER/FEATURE] Support rt_packed
__ARMCC_VERSION:         https://smtp.keil.com/support/man/docs/armcc/armcc_chr1359124980173.htm
__IAR_SYSTEMS_ICC__:     <Not Found>
__GNUC__:                https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-packed-type-attribute
__ADSPBLACKFIN__:        <Not Found>
_MSC_VER:                https://learn.microsoft.com/en-us/cpp/preprocessor/pack?view=msvc-170
__TI_COMPILER_VERSION__: https://software-dl.ti.com/codegen/docs/tiarmclang/rel1_3_0_LTS/migration_guide/migrating_c_and_cpp_source/pragmas_and_attributes.html
__TASKING__:             https://resources.tasking.com/sites/default/files/2021-02/TASKING_Alignment%20Requirements%20Restrictions_WEB.pdf

Usage:
```c
rt_packed(struct object1
{
    int dword;
    char byte;
});
typedef struct object1 object1;

rt_packed(struct object2
{
    int dword;
    char byte;
});
```

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-04 10:10:15 +08:00
Shell
2f6d98bfcb feat: smp_call: added signaling call_req
This patch introduces `rt_smp_call_request` API to handle queued
requests across cores with user provided data buffer, which provides a
way to request IPI through a non-blocking pattern.

It also resolved several issues in the old implementation:
- Multiple requests from different cores can not be queued in the work
  object of the target core.
- Data racing on `rt_smp_work` of same core. If multiple requests came
  in turns, or if the call is used by the target cpu, while a new
  request is coming, the value will be overwrite.
- Memory vulnerability. The rt_smp_event is allocated on stack, though
  the caller may not wait until the call is done.
- API naming problem. Actually we don't provide a way to issue an IPI to
  ANY core in mask. What the API do is aligned to MANY pattern.
- FUNC_IPI registering to PIC.

Changes:
- Declared and configured the new `RT_SMP_CALL_IPI` to support
  functional IPIs for task requests across cores.
- Replaced the single `rt_smp_work` array with `call_req_cores` to
  manage per-core call requests safely.
- Added `_call_req_take` and `_call_req_release` functions for atomic
  handling of request lifetimes, preventing data race conditions.
- Replaced single event handling with a queue-based approach
  (`call_queue`) for efficient multi-request processing per core.
- Introduced `rt_smp_call_ipi_handler` to process queued requests,
  reducing IPI contention by only sending new requests when needed.
- Implemented `_smp_call_remote_request` to handle remote requests
  with specific flags, enabling more flexible core-to-core task
  signaling.
- Refined `rt_smp_call_req_init` to initialize and track requests
  with atomic usage flags, mitigating potential memory vulnerabilities.

Signed-off-by: Shell <smokewood@qq.com>
2024-11-03 10:08:45 +08:00
Shell
285fee9d4c feat: rtatomic: lockless single linked list
Signed-off-by: Shell <smokewood@qq.com>
2024-11-03 10:08:45 +08:00
Shell
40cd8cce99 feat: Added rt_interrupt_context* family for nested interrupt handling
These changes introduce the rt_interrupt_context family, providing a
mechanism for managing nested interrupts. The context management
ensures proper storage and retrieval of interrupt states, improving
reliability in nested interrupt scenarios by enabling context tracking
across different interrupt levels. This enhancement is essential for
platforms where nested interrupt handling is crucial, such as in real-
time or multi-threaded applications.

Changes:
- Defined rt_interrupt_context structure with context and node fields
  in `rtdef.h` to support nested interrupts.
- Added rt_slist_pop function in `rtservice.h` for simplified node
  removal in singly linked lists.
- Declared rt_interrupt_context_push, rt_interrupt_context_pop, and
  rt_interrupt_context_get functions in `rtthread.h` to manage the
  interrupt/exception stack.
- Modified AArch64 CPU support in `cpuport.h` to include
  rt_hw_show_register for debugging registers.
- Refactored `_rt_hw_trap_irq` in `trap.c` for context-aware IRQ
  handling, with stack push/pop logic to handle nested contexts.
- Implemented interrupt context push, pop, and retrieval logic in
  `irq.c` to manage context at the CPU level.

Signed-off-by: Shell <smokewood@qq.com>
2024-11-03 10:08:45 +08:00
KunYi Chen
6b7f1177de fix: suppress unused warnings when DEBUG disabled
When RT_USING_DEBUG is disabled, variables used only in RT_ASSERT
statements become unused, triggering -Wunused-but-set-variable compiler
warnings. These variables are essential for runtime assertions in debug
builds but appear unused in release builds.

Example:
- Variables used in RT_ASSERT(var != RT_NULL) checks
- Affects multiple drivers and components using RT_ASSERT

This is a general cleanup to improve code compilation without affecting
functionality.
2024-10-25 22:22:09 -04:00
heyuanjie87
1045bcb9df 给使用独立的defunct线程添加限制条件 2024-10-21 13:05:08 +08:00
heyuanjie87
2351981e83 分离defunct 2024-10-21 13:05:08 +08:00
Shell
645b3c6015 feat: remove RT_USING_SCHED_THREAD_CTX
Prepare for the next release by removing the compatible codes for v5.1.0
and before.

Changes:

- Remove the compatible macros and Kconfig options for the old struct
  rt_thread layout.

Signed-off-by: Shell <smokewood@qq.com>
2024-10-19 15:19:41 -04:00
Shell
588611d314 feat: includes: included kerrno.h in rtdef.h
Those definitions are presented in rtdef.h until PR #9461 moved them to
kerrno.h, which introduced unknown definition error for project building

Changes:

- Added includes of kerrno.h

Signed-off-by: Shell <smokewood@qq.com>
2024-09-25 21:03:48 -04:00
zhujiale
244cf61af6 SMP 2024-09-24 09:56:30 +08:00
zhujiale
512dae84be smp_ipi 2024-09-24 09:56:30 +08:00
Meco Man
ee5014d32f [klibc] add kerrno.h 2024-09-23 21:30:37 +08:00
GuEe-GUI
802a6ed2ca [DM] Extended drivers MISC interface
1. RT_FIELD_PREP: prepare a bitfield element.
2. RT_FIELD_GET: extract a bitfield element.
3. rt_offsetof: member offset of a struct
4. rt_upper_32_bits: high 32 bits of value.
5. rt_lower_32_bits: lower 32 bits of value.
6. rt_upper_16_bits: high 16 bits of value.
7. rt_lower_16_bits: lower 16 bits of value.
8. rt_max_t: fix type of max(...).
9. rt_ilog2: integer logarithm base 2.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-06 17:45:03 -04:00
Shell
dfd8ccf262 feat: kernel/libcpu: fit into ilp32d 2024-09-01 15:12:34 -04:00
Shell
e9b683d0b3 feat: set RT_USING_STDC_ATOMIC to first priority
RT_USING_STDC_ATOMIC is a user selected option on current config system.
While the RT_USING_HW_ATOMIC is a forced option selected by Kconfig
under libcpu. And the RT_USING_STDC_ATOMIC will be meaningless if we set
RT_USING_HW_ATOMIC to first priority if the arch has hw-atomic.

Changes:
- set RT_USING_STDC_ATOMIC to first priority on rttypes.h

Signed-off-by: Shell <smokewood@qq.com>
2024-08-13 04:13:51 -04:00
zhao maosheng
f543160ead fix rt_atomic_dec_and_test 2024-08-09 12:54:10 +08:00