Commit Graph

194 Commits

Author SHA1 Message Date
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
wdfk-prog 8d3ad68caf [src][tick]rt_tick setting arbitrary value function is added to support low-power wake-up tick compensation 2024-07-19 11:51:39 +08:00
supperthomas b79d5013ff [doc][doxygen] Fix hook struct error.
Signed-off-by: supperthomas <78900636@qq.com>
2024-06-27 23:05:12 +08:00
supperthomas 14e4c45408 [doc][doxygen] Fix doxygen struct error.
Signed-off-by: supperthomas <78900636@qq.com>
2024-06-26 20:22:43 +08:00
Shell e5b7f3fdd8
[kservice] Enhance support for backtrace service (#9037)
[feat] Enhance support for backtrace service

rt_backtrace_formatted_print() and rt_backtrace_to_buffer() to help
debug routines.

Also, following modification are included:
- make rt_backtrace_frame patchable with weak attr
- replace lwp backtrace with sync output

Signed-off-by: Shell <smokewood@qq.com>
2024-06-13 08:55:53 +08:00
Shell f17f994f8c
[arm64] add hw thread self (#8942)
* [libcpu] arm64: Add hardware thread_self support

This patch introduces hardware-based thread self-identification
for the AArch64 architecture. It optimizes thread management by
using hardware registers to store and access the current thread's
pointer, reducing overhead and improving overall performance.

Changes include:
- Added `ARCH_USING_HW_THREAD_SELF` configuration option.
- Modified `rtdef.h`, `rtsched.h` to conditionally include
  `critical_switch_flag` based on the new config.
- Updated context management in `context_gcc.S`, `cpuport.h`
  to support hardware-based thread self.
- Enhanced `scheduler_mp.c` and `thread.c` to leverage the new
  hardware thread self feature.

These modifications ensure better scheduling and thread handling,
particularly in multi-core environments, by minimizing the
software overhead associated with thread management.

Signed-off-by: Shell <smokewood@qq.com>

* fixup: address suggestion

* fixup: rt_current_thread as global

* scheduler: add cpu object for UP scheduler

Also, maintain the rt_current_thread in cpu object on UP scheduler.

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-28 14:27:55 +08:00
Shell f2d6325b43
[smart] select console device dynamically (#8949)
* [smart] select console device dynamically

- Fixed compiler warning on terminal subsystem for
  `components/lwp/terminal/terminal.h`
- Updated default console setup to dynamically select an appropriate tty
  device based on the configured console device name.

Signed-off-by: Shell <smokewood@qq.com>

* fixup: remove useless codes

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-17 13:19:00 +08:00
Yang Xijing f55187f830 [include/rtthread.h] rt_thread_close函数声明应当与RT_USING_HEAP无关 2024-05-11 13:42:27 -04:00
Shell 6977cf9101
[src] add rt_hw_cpu_id() wrapper API (#8894)
* [src] add rt_hw_cpu_id() wrapper API

rt_hw_cpu_id() is an unsafe API which should not be used by most codes
directly. It's error-prone because it must be used in proper context,
otherwise it can lead to errors and unpredictable behavior.

This patch adds a wrapper API for rt_hw_cpu_id() to address this risk.
It includes the context-checking functionality and provides a safer
alternative for obtaining CPU IDs, ensuring that it is used correctly
within the appropriate context.

Signed-off-by: Shell <smokewood@qq.com>

* fixup UMP

* update API & comment

* ci: cpp_check

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-08 09:22:09 +08:00
zms123456 9112dffec8
[src][Kconfig]make RT_ASSERT independent of RT_USING_DEUBG 2024-05-06 20:40:30 -04:00
Shell 2c9b7c10b9
[kernel] add rt_thread_close()
* [thread] Add rt_thread_close()

This patch introduces a new function `rt_thread_close()` to enhances the
usability and maintainability by providing a dedicated mechanism for
closing threads.

- A new function `rt_thread_close()` is added to the API, providing a
  standardized approach for closing threads.
- The `rt_thread_close()` function removes a thread from the thread
  queue, updates its status to indicate closure, and performs the thread
  timer detaching which is a embedded timer in thread object.
- Additionally, the `rt_thread_detach()` function is modified to utilize
  `rt_thread_close()` internally, streamlining the thread detachment
  process.

Signed-off-by: Shell <smokewood@qq.com>
2024-05-01 00:49:09 -04:00
Meco Man 792c3c0603 [kernel] move errno functions into klibc 2024-04-20 00:57:17 -04:00
Shell 451ac03965 add cpu up 2024-04-19 21:30:12 -04:00
Shell 2aacba2c86 [src] Fixup UP irq_spinlock
Use scheduler lock in up irq_spinlock to avoid scheduling during spinlock.

Signed-off-by: Shell <smokewood@qq.com>
2024-04-19 21:30:12 -04:00
xiao-mang 84e6b3c393 fix for art-pi smart 2024-04-19 18:17:20 +08:00
xiao-mang 4de96450be fix for art-pi smart 2024-04-19 18:17:20 +08:00
Shell f143ea2b31
[kernel] remove redundant _scheduler_stack_check 2024-03-20 22:26:41 -04:00
Meco Man e81978c5dc [kernel] move std libc related to rtklibc.h 2024-03-20 22:26:11 -04:00
Shell 71560bafb5
🎯 Sync smart & scheduler codes (#8537)
Signed-off-by: Shell <smokewood@qq.com>
Co-authored-by: xqyjlj <xqyjlj@126.com>
2024-02-23 17:49:15 +08:00
Yuqiang Wang c6bdee3c50
[ci] open ci check with function declaration warning (#8546) 2024-02-20 22:45:04 -05:00
Meco Man 2748a6ada4 [kernel] fix some strict compiling warnings 2024-02-19 01:56:21 -05:00
Shell f6fce5f8d7 [kservice] MT-safe output support (kprintf/kputs)
Signed-off-by: Shell <smokewood@qq.com>
2024-01-16 00:59:18 +08:00
Shell cc157baf23
[kernel] fixup of data racing accessing percpu objects (#8475)
Signed-off-by: Shell <smokewood@qq.com>
2024-01-09 23:09:49 +08:00
Shell e7880a9713 [kernel] support for hook list
Signed-off-by: Shell <smokewood@qq.com>
2024-01-02 19:42:46 +08:00
Shell 3a7903b799 [kernel] Add hook for malloc services
Including the patch for memory allocation, testsuites and fixups of
static analysis.

Signed-off-by: Shell <smokewood@qq.com>
2024-01-02 19:42:46 +08:00
xqyjlj e31fa93423
feat: spinlock should lock sched (#8360) 2023-12-22 11:15:18 +08:00
Meco Man 873fd76b2f [libc] add RT_USING_INTERNAL_LIBC_ONLY macro
This option is for RT-Thread Nano version.
If select this option, it will not compile components/libc
folder and only use tool chain internal libc. Normally, the
tool chain internal is only cover ISO standard (e.g. armcc),
but some tool chains' internal libc will cover more than
ISO standard (e.g. newlib).
2023-11-21 23:22:55 -05:00
Shell eafb04e011
[ctime] fixup of data racing (#8187)
Signed-off-by: Shell <smokewood@qq.com>
2023-10-26 13:56:27 +08:00
xqyjlj 3283f54c7a
🎈 perf: perf rt_hw_interrupt_disable/enable (#8042)
Signed-off-by: Shell <smokewood@qq.com>
Co-authored-by: Shell <smokewood@qq.com>
2023-10-25 20:31:25 +08:00
Shell 70a8d1d465
[kservice] improve backtrace service in kernel (#8144)
Signed-off-by: Shell <smokewood@qq.com>
2023-10-21 20:14:45 +08:00
geniusgogo 552b5406b5
restore smp macro define. (#8151) 2023-10-20 13:25:47 +08:00
geniusgogo ecd29fda60
Sync dfs lwp (#8123) 2023-10-17 13:07:59 +08:00
Shell 4158c8e88e
[smart] Replace irq disable/enable codes in futex (#7941)
Signed-off-by: Shell <smokewood@qq.com>
2023-10-14 13:07:45 +08:00
Meco Man 35231eb116 [kernel] fix interruptible typo 2023-09-19 00:45:02 -04:00
zhkag 0b9a808cca
[posix]修复消息队列返回长度异常 (#8014) 2023-09-08 18:15:03 +08:00
Meco Man c1cc1332e9 [debug] fix the error when disable RT_USING_DEBUG 2023-07-26 23:14:54 -04:00
Man, Jianting (Meco) aee1bd532e
clean up rtthread.h (#7843) 2023-07-23 06:19:34 +08:00
Man, Jianting (Meco) 244b903e5d
[debug] 整理debug宏并增加RT_DEBUGING_CONTEXT (#7805) 2023-07-22 10:36:42 +08:00
ErikChanHub 2f5e4ac27e
【dd2.0】Support the Core API for dd2.0 (#7791) 2023-07-13 14:49:35 +08:00
Shicheng Chu 2da019234e
[include][dbg]update: delete rtdebug.h (#7759) 2023-07-01 08:41:02 -04:00
zhkag e65509a58e
[src][components][include]消息队列支持优先级 (#7382) 2023-06-26 00:06:06 -04:00
zhkag 33f550cb65
[Kernel] message 可以返回消息的实际大小 (#7709) 2023-06-21 18:22:42 +08:00
Bernard Xiong 4b4c3c85f2
[atomic] add stdc atomic detection. (#7536) 2023-05-20 23:41:29 +08:00
Fan Yang 48557de148
[include][src] Add API to get object name and thread name (#7507)
Signed-off-by: Fan YANG <fan.yang@hpmicro.com>
Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
2023-05-17 17:40:18 +08:00
dejavudwh e12c2f9306
[Better style] Unify the function declaration and definition paramete… (#7432) 2023-05-01 07:35:03 +08:00
Meco Man f58d3c5200 rt_device_write/read return data type as rt_ssize_t
rt_ssize_t can give negative error code, which follows the unix style correctly
2023-02-07 21:43:57 -05:00
tuduweb 9fbf63441e
[doxygen] Fix some warnings in doxygen (#6899) 2023-02-02 21:00:58 -05:00
guo 68ca9f07a6
[rt-smart] 弱化 RT_USING_LWP,使用 RT_USING_SMART 作为宏配置 (#6740)
* [dfs] sync cromfs

* [rt-smart]Weaken RT_USING_LWP, use RT_USING_SMART as macro configuration

* [format] fix some format issue.
2022-12-16 18:38:28 +08:00
guo ecf2d82159
sync branch rt-smart. (#6641)
* Synchronize the code of the rt mart branch to the master branch.
  * TTY device
  * Add lwP code from rt-smart
  * Add vnode in DFS, but DFS will be re-write for rt-smart
  * There are three libcpu for rt-smart:
    * arm/cortex-a, arm/aarch64
    * riscv64

Co-authored-by: Rbb666 <zhangbingru@rt-thread.com>
Co-authored-by: zhkag <zhkag@foxmail.com>
2022-12-03 12:07:44 +08:00
Bernard Xiong 79e298147b
Merge pull request #6523 from BernardXiong/nested_mutex
[Kernel] Add nested mutex feature
2022-11-06 08:59:12 +08:00