mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
allow PICO_CORE1_STACK_SIZE=0 (#2058)
This commit is contained in:
parent
08bf6a7faa
commit
c2118cc005
2 changed files with 7 additions and 1 deletions
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
* \include multicore.c
|
||||
*/
|
||||
|
||||
// PICO_CONFIG: PICO_CORE1_STACK_SIZE, Minimum amount of stack space reserved in the linker script for core 1, min=0x100, max=0x10000, default=PICO_STACK_SIZE (0x800), group=pico_multicore
|
||||
// PICO_CONFIG: PICO_CORE1_STACK_SIZE, Minimum amount of stack space reserved in the linker script for core 1 - if zero then no space is reserved and the user must provide their own stack, min=0, max=0x10000, default=PICO_STACK_SIZE (0x800), group=pico_multicore
|
||||
#ifndef PICO_CORE1_STACK_SIZE
|
||||
#ifdef PICO_STACK_SIZE
|
||||
#define PICO_CORE1_STACK_SIZE PICO_STACK_SIZE
|
||||
|
|
|
|||
|
|
@ -66,8 +66,10 @@ bool multicore_fifo_pop_timeout_us(uint64_t timeout_us, uint32_t *out) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#if PICO_CORE1_STACK_SIZE > 0
|
||||
// Default stack for core1 ... if multicore_launch_core1 is not included then .stack1 section will be garbage collected
|
||||
static uint32_t __attribute__((section(".stack1"))) core1_stack[PICO_CORE1_STACK_SIZE / sizeof(uint32_t)];
|
||||
#endif
|
||||
|
||||
static void __attribute__ ((naked)) core1_trampoline(void) {
|
||||
#ifdef __riscv
|
||||
|
|
@ -153,11 +155,15 @@ void multicore_launch_core1_with_stack(void (*entry)(void), uint32_t *stack_bott
|
|||
}
|
||||
|
||||
void multicore_launch_core1(void (*entry)(void)) {
|
||||
#if PICO_CORE1_STACK_SIZE > 0
|
||||
extern uint32_t __StackOneBottom;
|
||||
uint32_t *stack_limit = (uint32_t *) &__StackOneBottom;
|
||||
// hack to reference core1_stack although that pointer is wrong.... core1_stack should always be <= stack_limit, if not boom!
|
||||
uint32_t *stack = core1_stack <= stack_limit ? stack_limit : (uint32_t *) -1;
|
||||
multicore_launch_core1_with_stack(entry, stack, sizeof(core1_stack));
|
||||
#else
|
||||
panic("multicore_launch_core1() can't be used when PICO_CORE1_STACK_SIZE == 0");
|
||||
#endif
|
||||
}
|
||||
|
||||
void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vector_table) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue