I'm just getting started with the RP2040 so I might be overlooking something really basic here.
I'm in Linux using VS Code with the official plugin and SDK 2.1.
I have a really basic program that I just want to see use both cores. Core0 just writes a counter to serial, and core1 increments the counter. When I run this in debug, or I use the "Run Project (USB)" button it works as expected. However, if I use the "Flash Project (SWD)" option, core1 seems to increment once and then stop.
What might explain why the behavior is different?
run/debug output:flash output:
I'm in Linux using VS Code with the official plugin and SDK 2.1.
I have a really basic program that I just want to see use both cores. Core0 just writes a counter to serial, and core1 increments the counter. When I run this in debug, or I use the "Run Project (USB)" button it works as expected. However, if I use the "Flash Project (SWD)" option, core1 seems to increment once and then stop.
What might explain why the behavior is different?
Code:
#include <stdio.h>#include "pico/stdlib.h"#include "pico/multicore.h"int x = 0;/// Entry point for core1void main1(){ while (true) { x += 5; // yes, I understand that this is not thread-safe sleep_ms(500); }}int main(){ stdio_init_all(); multicore_launch_core1(main1); while (true) { printf("Hello, world! %d\n", x); sleep_ms(1000); }}
Code:
Hello World! 5Hello World! 15Hello World! 25
Code:
Hello World! 5Hello World! 5Hello World! 5
Statistics: Posted by aaronmj — Tue Dec 31, 2024 8:29 pm — Replies 0 — Views 20