diff options
author | Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no> | 2016-11-18 17:55:16 +0100 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2016-11-22 19:34:52 -0500 |
commit | cf057949246b2f1e46150c1f9f57320beceee438 (patch) | |
tree | 565fb56f51d1055464bf34f6745f06f474f4e9c2 | |
parent | 60a31d6ed1f75b7b3128edaaa213a8ca2475317e (diff) |
kernel: declare main and idle stack as globals
Renamed main_stack and idle_stack, to _main_stack and
_idle_stack, respectively, and made them globals. This does
not affect performance. They are still kept kernel private
symbols and not part of kernel API.
This will allow these symbols to be referenced in calls to
stack_analyse misc functions to profile stack usage in
applications.
Change-id: Id6b746c5cfda617c26901c6e62c3e17114471f57
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
-rw-r--r-- | kernel/unified/init.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/unified/init.c b/kernel/unified/init.c index 39754c4a0..67e12d0a8 100644 --- a/kernel/unified/init.c +++ b/kernel/unified/init.c @@ -94,11 +94,11 @@ uint64_t __noinit __idle_tsc; /* timestamp when CPU goes idle */ #define MAIN_STACK_SIZE CONFIG_MAIN_STACK_SIZE #endif -static char __noinit __stack main_stack[MAIN_STACK_SIZE]; -static char __noinit __stack idle_stack[IDLE_STACK_SIZE]; +char __noinit __stack _main_stack[MAIN_STACK_SIZE]; +char __noinit __stack _idle_stack[IDLE_STACK_SIZE]; -k_tid_t const _main_thread = (k_tid_t)main_stack; -k_tid_t const _idle_thread = (k_tid_t)idle_stack; +k_tid_t const _main_thread = (k_tid_t)_main_stack; +k_tid_t const _idle_thread = (k_tid_t)_idle_stack; /* * storage space for the interrupt stack @@ -281,13 +281,13 @@ static void prepare_multithreading(struct k_thread *dummy_thread) sys_dlist_init(&_ready_q.q[ii]); } - _new_thread(main_stack, MAIN_STACK_SIZE, + _new_thread(_main_stack, MAIN_STACK_SIZE, _main, NULL, NULL, NULL, CONFIG_MAIN_THREAD_PRIORITY, K_ESSENTIAL); _mark_thread_as_started(_main_thread); _add_thread_to_ready_q(_main_thread); - _new_thread(idle_stack, IDLE_STACK_SIZE, + _new_thread(_idle_stack, IDLE_STACK_SIZE, idle, NULL, NULL, NULL, K_LOWEST_THREAD_PRIO, K_ESSENTIAL); _mark_thread_as_started(_idle_thread); @@ -303,7 +303,7 @@ static void prepare_multithreading(struct k_thread *dummy_thread) static void switch_to_main_thread(void) { #ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN - _arch_switch_to_main_thread(main_stack, MAIN_STACK_SIZE, _main); + _arch_switch_to_main_thread(_main_stack, MAIN_STACK_SIZE, _main); #else /* * Context switch to main task (entry function is _main()): the |