kernel: init: allow custom switch to main for no-multithreading case
Certain architectures, such as ARM Cortex-M require a custom switch to main(), in case the case we build Zephyr without support for multithreading (CONFIG_MULTITHREADING=n). So as to keep the change to kernel/init.c as unintrusive as possible, we install an ARCH-specific hook in z_cstart(), which gets called for architectures that require this customized switch to main() function. Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
parent
27ed1c3e13
commit
60bd51aa37
1 changed files with 8 additions and 0 deletions
|
@ -477,6 +477,13 @@ FUNC_NORETURN void z_cstart(void)
|
|||
|
||||
#ifdef CONFIG_MULTITHREADING
|
||||
switch_to_main_thread(prepare_multithreading());
|
||||
#else
|
||||
#ifdef ARCH_SWITCH_TO_MAIN_NO_MULTITHREADING
|
||||
/* Custom ARCH-specific routine to switch to main()
|
||||
* in the case of no multi-threading.
|
||||
*/
|
||||
ARCH_SWITCH_TO_MAIN_NO_MULTITHREADING(bg_thread_main,
|
||||
NULL, NULL, NULL);
|
||||
#else
|
||||
bg_thread_main(NULL, NULL, NULL);
|
||||
|
||||
|
@ -488,6 +495,7 @@ FUNC_NORETURN void z_cstart(void)
|
|||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
#endif
|
||||
#endif /* CONFIG_MULTITHREADING */
|
||||
|
||||
/*
|
||||
* Compiler can't tell that the above routines won't return and issues
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue