Skip to content

Commit a27a6da

Browse files
committed
extmod/zephyr_kernel: Add placeholder for z_init_cpu implementation.
The investigation identified that ports/zephyr calls z_init_cpu(0) in prepare_multithreading() to initialize the idle thread, IRQ stack, and CPU state. This is currently missing from extmod/zephyr_kernel. However, z_init_cpu() requires idle thread and IRQ stack arrays from Zephyr's kernel/init.c, which has unmet CONFIG dependencies for our minimal threading-only build. Add TODO comments documenting this missing initialization, with the call commented out until dependencies can be resolved. Signed-off-by: Andrew Leech <[email protected]>
1 parent 6ec81dc commit a27a6da

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

extmod/zephyr_kernel/zephyr_cstart.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ static struct k_thread dummy_thread;
5555
struct k_thread z_main_thread;
5656
K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE);
5757

58+
// TODO: z_init_cpu implementation requires idle thread and IRQ stack arrays
59+
// from Zephyr's init.c which we're not building. For now, testing without it.
60+
5861
/**
5962
* prepare_multithreading - Initialize main thread and ready queue
6063
*
@@ -88,6 +91,9 @@ static char *prepare_multithreading(void) {
8891
z_mark_thread_as_not_sleeping(&z_main_thread);
8992
z_ready_thread(&z_main_thread);
9093

94+
// TODO: Initialize CPU 0 - requires implementing z_init_cpu() with idle thread support
95+
// z_init_cpu(0);
96+
9197
return stack_ptr;
9298
}
9399

extmod/zephyr_kernel/zephyr_kernel.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ $(BUILD)/zephyr_gen_root/zephyr/syscalls/log_msg.h:
9191

9292
# Minimal Zephyr kernel source files (threading-only subset)
9393
# Excludes files requiring device tree or full hardware support
94-
# Note: init.c, idle.c excluded (require full initialization and PM support)
94+
# Note: init.c excluded (z_init_cpu provided in zephyr_cstart.c instead)
9595
ZEPHYR_KERNEL_SRC_C := \
9696
$(ZEPHYR_BASE)/kernel/thread.c \
9797
$(ZEPHYR_BASE)/kernel/sched.c \

0 commit comments

Comments
 (0)