Commit Graph

591 Commits

Author SHA1 Message Date
Shell 6ca327d8ce
[smart] add CPU/thread usage tracing config (#8947)
* [smart] add CPU usage tracing config

This patch introduces following features:

- Added CPU usage tracing functionality, enabled by default, for
  applications like 'top'
- update time as smart independent

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

* fixup: add ump idle thread

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-06-04 00:06:41 +08:00
GUI e7cddf3a52
[Feature] Support simple power domain API (#9005)
* [Feature] Power domain for device

1.Support device power on/off.
2.Support attach/detach device.
3.Support power domain driver api.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* [DM/platform] Enhanced platform bus

1.Add power domain for device.
2.Support `remove` and `shutdown` bus interface.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-30 15:30:40 +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 48bd0e49f2
[ipc] support of lockless rt_completion (#8887)
* [ipc] lockless rt_completion implementation

The new rt_completion implemented by lockless algorithm can improve timer resolution for up to ~12%, compare to sem IPC.

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

* fixup: error

* remove useless changes

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-08 09:25:57 +08: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
sp-cai 554632f1ee
[ipc] [dataqueue] 修复队列 pop 挂起的线程 push 无法恢复运行的错误 (#8839)
队列在 push 后查找挂起列表时使用了错误的挂起列表。
2024-04-22 20:20:35 +08:00
Meco Man d68e47eb25 [klibc] organize and renmae macros, and add CI check 2024-04-20 21:52:49 -04:00
Meco Man 792c3c0603 [kernel] move errno functions into klibc 2024-04-20 00:57:17 -04:00
Shell d1bb01621b fixup: add Kconfig option 2024-04-19 21:30:12 -04:00
Shell 8c4db32d04 fixup: debug 2024-04-19 21:30:12 -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
zhao maosheng 24373e1ec3 add rt_hw_interrupt_uninstall declare in rthw 2024-04-18 22:08:08 -04:00
Meco Man a0735dcb11 upgrade RT-Thread version to v5.2.0 2024-04-16 23:04:24 -04:00
zms123456 6ad0b2bd09
[components][drivers]fix workqueue bug
fix workqueue bug
2024-04-15 23:15:37 -04:00
Shell ad9c20950f
[include] using signed atomic types 2024-04-11 18:48:54 -04:00
geniusgogo 48f83a5416
add subsys early init level (#8756)
Signed-off-by: geniusgogo <xpxyr@sina.com>
2024-04-10 23:55:58 +08:00
Shell 4b0f42c24a
[drivers/serial] Introduce hooker for TTY (#8733)
In this patch, a hook list has been introduced to address the concerns
regarding coupling issues arising from modifications to the serial code
for integrating TTY logic.

Signed-off-by: Shell <smokewood@qq.com>
2024-04-09 21:36:16 +08:00
Shell 83e95bdff4
sync smart & dfs (#8672)
Signed-off-by: xqyjlj <xqyjlj@126.com>
Signed-off-by: Shell <smokewood@qq.com>
Co-authored-by: xqyjlj <xqyjlj@126.com>
2024-03-28 23:42:56 +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
Yuqiang Wang c0e632e56f Fixed an issue in mdk where macro definitions are not supported in the C99 specification 2024-03-20 22:43:55 +08:00
Meco Man e3a14a97a9
[kernel] fix warning of rt_thread_t struct (#8584) 2024-03-06 16:57:19 +08:00
Rbb666 d31c05a44c [tools]Fix project compilation errors generated by mdk and iar 2024-03-05 19:53:53 -05:00
Yuqiang Wang 7eccdb471e
[kernel] fix incorrect expression in macros (#8568) 2024-02-29 19:23:00 -05: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
fangjianzhou 10b16273b8
[drivers][core] 完善设备模型 (#8384) 2024-01-09 23:10:42 +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
xqyjlj 6b6d39d716
feat: delete thread ref (#8456) 2024-01-05 17:03:55 +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
Meco Man 20fb70ba15 [rtdef] remove legacy code 2023-12-25 10:50:43 +08:00
xqyjlj e31fa93423
feat: spinlock should lock sched (#8360) 2023-12-22 11:15:18 +08:00
geniusgogo 3dfafcd1d9
add semaphore max value control. (#8390) 2023-12-21 10:31:27 +08:00
xqyjlj 0541b39d61 feat(rtdef.h): add rt_always_inline 2023-12-21 01:00:59 +08:00
Meco Man 005828eba7 [nano] rt-thread susport nano option 2023-11-30 11:39:34 +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
geniusgogo 9acebb07dc
fix rt_channel lock. (#8244) 2023-11-10 21:37:07 +08:00
Meco Man 589641258e [debug] rename RT_DEBUGING_INIT as RT_DEBUGING_AUTO_INIT 2023-11-10 05:24:33 -05:00
yanghuang b51a3420b0 [kernel] 解决rt_slist_for_each_entry宏不能正常遍历slist链表中元素的问题
因rt_slist_for_each_entry宏不能正常调用,在实际开发中去循环再调用rt_slist_entry很不简洁,所以修改了rt_slist_for_each_entry宏中关于链表next的判空处理。目前相关代码在GD32系统的MCU上均能正常工作,相关应用也在生产产品中经过验证。
2023-11-06 10:03:04 +08:00
Meco Man bb8667e13b
[rtdef] add comment for RT_USING_LIBC_ISO_ONLY (#8229) 2023-11-06 09:53:02 +08:00