Skip to content

Commit 888d536

Browse files
committed
allow PICO_CORE1_STACK_SIZE=9
1 parent 482dd59 commit 888d536

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/rp2_common/pico_multicore/multicore.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ bool multicore_fifo_pop_timeout_us(uint64_t timeout_us, uint32_t *out) {
6666
return true;
6767
}
6868

69+
#if PICO_CORE1_STACK_SIZE > 0
6970
// Default stack for core1 ... if multicore_launch_core1 is not included then .stack1 section will be garbage collected
7071
static uint32_t __attribute__((section(".stack1"))) core1_stack[PICO_CORE1_STACK_SIZE / sizeof(uint32_t)];
72+
#endif
7173

7274
static void __attribute__ ((naked)) core1_trampoline(void) {
7375
#ifdef __riscv
@@ -153,11 +155,15 @@ void multicore_launch_core1_with_stack(void (*entry)(void), uint32_t *stack_bott
153155
}
154156

155157
void multicore_launch_core1(void (*entry)(void)) {
158+
#if PICO_CORE1_STACK_SIZE > 0
156159
extern uint32_t __StackOneBottom;
157160
uint32_t *stack_limit = (uint32_t *) &__StackOneBottom;
158161
// hack to reference core1_stack although that pointer is wrong.... core1_stack should always be <= stack_limit, if not boom!
159162
uint32_t *stack = core1_stack <= stack_limit ? stack_limit : (uint32_t *) -1;
160163
multicore_launch_core1_with_stack(entry, stack, sizeof(core1_stack));
164+
#else
165+
panic("multicore_launch_core1() can't be used when PICO_CORE1_STACK_SIZE == 0");
166+
#endif
161167
}
162168

163169
void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vector_table) {

0 commit comments

Comments
 (0)