diff options
| author | Meco Man <[email protected]> | 2022-08-24 15:38:02 -0400 |
|---|---|---|
| committer | guo <[email protected]> | 2022-08-25 10:11:35 +0800 |
| commit | 43ede1859af5180251bfb0da5ab7eb5292fa9775 (patch) | |
| tree | 4396976d729e54c8847eb49b4b16ccf3d66cf58a | |
| parent | d49ac097ab97fc1b5a96ef6f50ab7eaa8a6ba332 (diff) | |
[kernel] 优化内置线程命名
main线程栈指定对齐字节数
| -rw-r--r-- | src/components.c | 6 | ||||
| -rw-r--r-- | src/idle.c | 26 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/components.c b/src/components.c index 9433b7457c..37519c042a 100644 --- a/src/components.c +++ b/src/components.c @@ -166,8 +166,8 @@ int entry(void) #ifndef RT_USING_HEAP /* if there is not enable heap, we should use static thread and stack. */ -ALIGN(8) -static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE]; +ALIGN(RT_ALIGN_SIZE) +static rt_uint8_t main_thread_stack[RT_MAIN_THREAD_STACK_SIZE]; struct rt_thread main_thread; #endif /* RT_USING_HEAP */ @@ -216,7 +216,7 @@ void rt_application_init(void) tid = &main_thread; result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL, - main_stack, sizeof(main_stack), RT_MAIN_THREAD_PRIORITY, 20); + main_thread_stack, sizeof(main_thread_stack), RT_MAIN_THREAD_PRIORITY, 20); RT_ASSERT(result == RT_EOK); /* if not define RT_USING_HEAP, using to eliminate the warning */ diff --git a/src/idle.c b/src/idle.c index 4b8a002942..30f22d8963 100644 --- a/src/idle.c +++ b/src/idle.c @@ -47,9 +47,9 @@ static rt_list_t _rt_thread_defunct = RT_LIST_OBJECT_INIT(_rt_thread_defunct); -static struct rt_thread idle[_CPUS_NR]; +static struct rt_thread idle_thread[_CPUS_NR]; ALIGN(RT_ALIGN_SIZE) -static rt_uint8_t rt_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE]; +static rt_uint8_t idle_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE]; #ifdef RT_USING_SMP #ifndef SYSTEM_THREAD_STACK_SIZE @@ -248,7 +248,7 @@ static void rt_defunct_execute(void) } } -static void rt_thread_idle_entry(void *parameter) +static void idle_thread_entry(void *parameter) { #ifdef RT_USING_SMP if (rt_hw_cpu_id() != 0) @@ -306,24 +306,24 @@ static void rt_thread_system_entry(void *parameter) void rt_thread_idle_init(void) { rt_ubase_t i; - char tidle_name[RT_NAME_MAX]; + char idle_thread_name[RT_NAME_MAX]; for (i = 0; i < _CPUS_NR; i++) { - rt_sprintf(tidle_name, "tidle%d", i); - rt_thread_init(&idle[i], - tidle_name, - rt_thread_idle_entry, + rt_sprintf(idle_thread_name, "tidle%d", i); + rt_thread_init(&idle_thread[i], + idle_thread_name, + idle_thread_entry, RT_NULL, - &rt_thread_stack[i][0], - sizeof(rt_thread_stack[i]), + &idle_thread_stack[i][0], + sizeof(idle_thread_stack[i]), RT_THREAD_PRIORITY_MAX - 1, 32); #ifdef RT_USING_SMP - rt_thread_control(&idle[i], RT_THREAD_CTRL_BIND_CPU, (void*)i); + rt_thread_control(&idle_thread[i], RT_THREAD_CTRL_BIND_CPU, (void*)i); #endif /* RT_USING_SMP */ /* startup */ - rt_thread_startup(&idle[i]); + rt_thread_startup(&idle_thread[i]); } #ifdef RT_USING_SMP @@ -356,5 +356,5 @@ rt_thread_t rt_thread_idle_gethandler(void) int id = 0; #endif /* RT_USING_SMP */ - return (rt_thread_t)(&idle[id]); + return (rt_thread_t)(&idle_thread[id]); } |
