earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards
GNU Lesser General Public License v2.1
2.03k stars 422 forks source link

core1 not starting when uploading via CMSIS-DAP and FreeRTOS tasks not starting #1687

Closed Robbie-W1 closed 1 year ago

Robbie-W1 commented 1 year ago

Probably related to #676 and #402.

When using this platformio.ini, core1 (i.e. setup1() and loop1()) do not start until the board is reset (by unplugging and re-plugging usb)

[env:pico-debug]
build_type = debug
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
platform_packages =
   framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#master
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m

monitor_speed = 115200
monitor_port = /dev/ttyACM0
upload_protocol = cmsis-dap
debug_tool = cmsis-dap

Similarly FreeRTOS tasks don't run with when uploaded via CMSIS-DAP, when using this code in setup()

xTaskCreate(ledBlinkTask, "ledBlinkTask", 4096, NULL, configMAX_PRIORITIES - 1, NULL);
vTaskStartScheduler();

Using the debugger, the code gets to rtosFatalError(), but the onboard LED does not blink

/*  ---------------------------------------------------------------------------*\
    Usage:
    called on fatal error (interrupts disabled already)
    \*---------------------------------------------------------------------------*/
extern "C"
void rtosFatalError(void) {
    prvSetMainLedOn(); // Main LED on.

    for (;;) {
        // Main LED slow flash
        sleep_ms(100);
        prvBlinkMainLed();
        sleep_ms(2000);
        prvBlinkMainLed();
    }
}

The other issues have been fixed via a PR, but it looks like this is the same problem

earlephilhower commented 1 year ago

Interesting, and reproducible using the IDE upload as well on the Multicore-FreeRTOS example. Other upload methods all run fine, so this looks like a problem w/the PicoProbe itself in some way.