Skip to content

Commit 96a65e2

Browse files
Nicolas Pitrecarlescufi
authored andcommitted
riscv: don't include the secondary CPU boot code when not needed
Linker garbage collection couldn't work due to the explicit reference in reset.S. Signed-off-by: Nicolas Pitre <[email protected]>
1 parent 057e2fc commit 96a65e2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

arch/riscv/core/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ zephyr_library_sources(
1111
reboot.c
1212
reset.S
1313
switch.S
14-
smp.c
1514
thread.c
1615
)
1716

17+
if ((CONFIG_MP_MAX_NUM_CPUS GREATER 1) OR (CONFIG_SMP))
18+
zephyr_library_sources(smp.c)
19+
endif ()
20+
1821
zephyr_library_sources_ifdef(CONFIG_DEBUG_COREDUMP coredump.c)
1922
zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c)
2023
zephyr_library_sources_ifdef(CONFIG_RISCV_PMP pmp.c pmp.S)

arch/riscv/core/reset.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ aa_loop:
9797
call _PrepC
9898

9999
boot_secondary_core:
100+
#if CONFIG_MP_MAX_NUM_CPUS > 1
100101
la t0, riscv_cpu_wake_flag
101102
lr t0, 0(t0)
102103
bne a0, t0, boot_secondary_core
@@ -108,3 +109,6 @@ boot_secondary_core:
108109
la t0, riscv_cpu_wake_flag
109110
sr zero, 0(t0)
110111
j z_riscv_secondary_cpu_init
112+
#else
113+
j loop_unconfigured_cores
114+
#endif

0 commit comments

Comments
 (0)