[kernel] 优化内置线程命名

main线程栈指定对齐字节数
This commit is contained in:
Meco Man 2022-08-24 15:38:02 -04:00 committed by guo
parent d49ac097ab
commit 43ede1859a
2 changed files with 16 additions and 16 deletions

View File

@ -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 */

View File

@ -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]);
}