Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multicore_launch_core1 cause debugging to melfunction on RP2040 #2249

Open
AlexanderHD27 opened this issue Feb 9, 2025 · 0 comments
Open

Comments

@AlexanderHD27
Copy link

AlexanderHD27 commented Feb 9, 2025

TLDR Breakpoints, in code run on core 1, are ignored after resetting via multicore_reset_core1()

Hi, I'm trying to debug some function on core1.
But when I set a breakpoint and start debugging, nothing happens. Only when I pause the execution and then resume it, the breakpoint gets hit.

Details

I have notices this only occurs when I call the multicore_reset_core1().
When I leave this multicore_reset_core1() out and just run multicore_launch_core1(core1_entry); everything works just fine.
Also, when this issue occurs, gdb throws this error:

Error: Failed to select multidrop rp2040.dap1
Polling target rp2040.core1 failed, trying to reexamine

This happens when starting to flashing or debugging.
This Error goes away when I leave out the multicore_reset_core1()-call.

Thank you in advance. This issue is plaguing me for a good month.
I first stubbled on this while using FreeRTOS, but it turned out this is a native sdk/debugger -issue and NOT a problem of FreeRTOS.

Minimal working Example

My setup/Versions:

  • PicoSDK Version: 2.1.0
  • Board: pico_w (also tested on pico)
  • MCU: RP2040
  • Toolchain: 13.3 Rel1
  • OpenOCD: 0.12.0+dev-gebec950-dirty (2024-09-27-16:25)
  • Vscode Version: 1.96.2
  • Vscode Raspberry Pi Pico Version: 0.17.3
  • Host OS: Ubuntu 24.04.1 LTS
  • Debugger: PicoProbe https://www.raspberrypi.com/products/debug-probe/
    • Firmware Version: Debugprobe release v2.2.1

I'm using the VSCode-Plugin to set up the Project.

To reproduce, set a breakpoint at printf("Core 1\n"); and hit F5 to Debug and hit continue. Nothing will happen.
Open up a serial-monitor: Both Cores are printing something to serial monitor.

Then comment out multicore_reset_core1();, recompile, Reflash.
Debug again and now the breakpoint gets hit.

issue-multicore-debug.cpp:

#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/multicore.h"

void core1_entry() {
    while (true) {
        printf("Core 1\n");
        sleep_ms(250);
    }
}

int main()
{
    stdio_init_all();

    multicore_reset_core1();
    multicore_launch_core1(core1_entry);
    
    while (true) {
        printf("Hello AAA, world!\n");
        sleep_ms(1000);
    }
}

Here is the entire Project Directory for reproduction:
issue-multicore-debug.zip

Thank you in advance for helping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant