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){


static void gpio_setup(void){
static void delay_cycles(uint32_t cycles){
    for(uint32_t i = 0; i < cycles; i++){


int main(void){
    gpio_toggle(LED_PORT, LED_PIN);
        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?