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;
}