How do I stop my stm32 from halting my code when it gets it?

I recently got an stm32 board, and right now I am just trying to establish communication with it by turning on the LD2 light, using platformio. Right now when I try to upload the code the board seems that it is immediately halted, giving a warning message and yellow that I will leave below.

I found this threadthat says the issue is that I needed to include a debugger with my program so I added the line

debug_tool = stlink

to my platformio.ini file, but the problem persists. I pictures and text for what I think is relevant below but if there is anything else needed let me know and I will try and add it to the post.


The code

#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>

#define LED_PORT (GPIOA)
#define LED_PIN (GPIO6)


static void rcc_setup(void){
    rcc_clock_setup_pll(&rcc_hsi_configs[RCC_CLOCK_3V3_84MHZ]);

}

static void gpio_setup(void){
    rcc_periph_clock_enable(RCC_GPIOA);
    gpio_mode_setup(LED_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_PIN);
}
static void delay_cycles(uint32_t cycles){
    for(uint32_t i = 0; i < cycles; i++){
        __asm__("nop");
    }

}

int main(void){
    rcc_setup();
    gpio_setup();
    gpio_toggle(LED_PORT, LED_PIN);
    while(true){
        delay_cycles(8400000 / 4);
    }

    return 0;
}

The yellow messages from OpenOCD are perfectly normal and not a warning. It shows that the program was actually uploaded succcesfully.

Also if your board is nucleo_f446re then you don’t need to set your debug_tool and upload_protocol because it’s already that value.

What happens when you go to the debugging sidebar and press “Play” next to “PIO Debug”? Do you reach the main() function at all? Can you pause the code and see where it is?