pico_multicore

Adds support for running code on the second processor core (core1) More...

Modules

 fifo
 Functions for inter-core FIFO.
 

Functions

void multicore_reset_core1 (void)
 Reset Core 1.
 
void multicore_launch_core1 (void(*entry)(void))
 Run code on core 1. More...
 
void multicore_launch_core1_with_stack (void(*entry)(void), uint32_t *stack_bottom, size_t stack_size_bytes)
 Launch code on core 1 with stack. More...
 
void multicore_launch_core1_raw (void(*entry)(void), uint32_t *sp, uint32_t vector_table)
 Launch code on core 1 with no stack protection. More...
 

Detailed Description

Adds support for running code on the second processor core (core1)

Example

#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/multicore.h"
#define FLAG_VALUE 123
void core1_entry() {
if (g != FLAG_VALUE)
printf("Hmm, that's not right on core 1!\n");
else
printf("Its all gone well on core 1!");
while (1)
}
int main() {
printf("Hello, multicore!\n");
multicore_launch_core1(core1_entry);
// Wait for it to start up
if (g != FLAG_VALUE)
printf("Hmm, that's not right on core 0!\n");
else {
printf("It's all gone well on core 0!");
}
}

Function Documentation

◆ multicore_launch_core1()

void multicore_launch_core1 ( void(*)(void)  entry)

Run code on core 1.

Reset core1 and enter the given function on core 1 using the default core 1 stack (below core 0 stack)

Parameters
entryFunction entry point, this function should not return.

◆ multicore_launch_core1_raw()

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

Launch code on core 1 with no stack protection.

Reset core1 and enter the given function using the passed sp as the initial stack pointer. This is a bare bones functions that does not provide a stack guard even if USE_STACK_GUARDS is defined

◆ multicore_launch_core1_with_stack()

void multicore_launch_core1_with_stack ( void(*)(void)  entry,
uint32_t *  stack_bottom,
size_t  stack_size_bytes 
)

Launch code on core 1 with stack.

Reset core1 and enter the given function on core 1 using the passed stack for core 1

multicore_fifo_push_blocking
void multicore_fifo_push_blocking(uint32_t data)
Push data on to the FIFO.
Definition: multicore.c:29
multicore_fifo_pop_blocking
uint32_t multicore_fifo_pop_blocking(void)
Pop data from the FIFO.
Definition: multicore.c:57
stdio.h
multicore_launch_core1
void multicore_launch_core1(void(*entry)(void))
Run code on core 1.
Definition: multicore.c:120
multicore.h
stdio_init_all
void stdio_init_all(void)
Initialize all of the present standard stdio types that are linked into the binary.
Definition: stdio.c:246
stdlib.h
tight_loop_contents
static void tight_loop_contents(void)
Definition: platform.h:130