From 43ede1859af5180251bfb0da5ab7eb5292fa9775 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 24 Aug 2022 15:38:02 -0400 Subject: [PATCH] =?UTF-8?q?[kernel]=20=E4=BC=98=E5=8C=96=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=91=BD=E5=90=8D=20main=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=A0=88=E6=8C=87=E5=AE=9A=E5=AF=B9=E9=BD=90=E5=AD=97=E8=8A=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components.c | 6 +++--- 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]); }