diff options
| author | tangzz98 <[email protected]> | 2023-10-30 08:24:55 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-30 08:24:55 -0400 |
| commit | acc66c547999ce444b79efccd67625a1af347d5d (patch) | |
| tree | 316bb953009ba0b0e9a77422d767fd7d82d50466 /src/thread.c | |
| parent | 1554888c0b004bac7098e2a92a32603dd26b452c (diff) | |
实现MPU抽象层 (#8080)
- 为RT-Thread设计MPU抽象层,支持ARMV7-M,ARMV8-M架构,让用户使用MPU检测栈溢出等内存问题,实现线程内存隔离
- 在components/mp目录下提供通用的API,libcpu目录下提供各处理器架构的具体实现
- 在STM32U575 NUCLEO, STM32H75 NUCLEO开发板测试通过
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/thread.c b/src/thread.c index 21c6230192..cd14a15d21 100644 --- a/src/thread.c +++ b/src/thread.c @@ -157,6 +157,10 @@ static rt_err_t _thread_init(struct rt_thread *thread, rt_list_init(&(thread->tlist)); rt_list_init(&(thread->tlist_schedule)); +#ifdef RT_USING_MEM_PROTECTION + thread->mem_regions = RT_NULL; +#endif + #ifdef RT_USING_SMART thread->wakeup.func = RT_NULL; #endif @@ -170,6 +174,9 @@ static rt_err_t _thread_init(struct rt_thread *thread, /* init thread stack */ rt_memset(thread->stack_addr, '#', thread->stack_size); +#ifdef RT_USING_HW_STACK_GUARD + rt_hw_stack_guard_init(thread); +#endif #ifdef ARCH_CPU_STACK_GROWS_UPWARD thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter, (void *)((char *)thread->stack_addr), |
