From d39dc587f5cdf2d776b3841434ca7ef85107c819 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 16 Feb 2024 17:14:57 +0100 Subject: [PATCH] core/init: clean up !core_thread init path --- core/lib/init.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/core/lib/init.c b/core/lib/init.c index d45ddc15c8..6b3cccd3e4 100644 --- a/core/lib/init.c +++ b/core/lib/init.c @@ -90,6 +90,13 @@ static void *idle_thread(void *arg) void kernel_init(void) { + if (!IS_USED(MODULE_CORE_THREAD)) { + /* RIOT without threads */ + main_trampoline(NULL); + while (1) {} + return; + } + irq_disable(); if (IS_USED(MODULE_CORE_IDLE_THREAD)) { @@ -99,19 +106,10 @@ void kernel_init(void) idle_thread, NULL, "idle"); } - if (IS_USED(MODULE_CORE_THREAD)) { - thread_create(main_stack, sizeof(main_stack), - THREAD_PRIORITY_MAIN, - THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST, - main_trampoline, NULL, "main"); - } - else { - /* RIOT without threads */ - irq_enable(); - main_trampoline(NULL); - while (1) {} - return; - } + thread_create(main_stack, sizeof(main_stack), + THREAD_PRIORITY_MAIN, + THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST, + main_trampoline, NULL, "main"); cpu_switch_context_exit(); }