Adding custom STM32 board


I want to use pio with a custom board with a STM32L072RB which is not yet part of the supported boards.
My definition file is like this :

  "build": {
    "cpu": "cortex-m0plus",
    "extra_flags": "-DSTM32L0 -DSTM32L072xx",
    "f_cpu": "32000000L",
    "framework_extra_flags": {
      "arduino": "-D__CORTEX_SC=0"
    "mcu": "stm32l072rb",
    "variant": "DISCO_L072CZ_LRWAN1"
  "debug": {
    "default_tools": [
    "jlink_device": "STM32L072RB",
    "openocd_target": "stm32l0",
    "svd_path": "STM32L07x.svd"
  "frameworks": [
  "name": "GOUACH BMS",
  "upload": {
    "maximum_ram_size": 20480,
    "maximum_size": 131072,
    "protocol": "stlink",
    "protocols": [
  "url": "",
  "vendor": "ST"

and in platformio.ini i have

platform = ststm32
framework = arduino
board = gouach_bms
debug_tool = stlink
upload_protocol = stlink

the code compiles and is flashed but nothing happens. Once, in debug mode the leds that i try to control lit up. But I reflashed again and it stopped.

Is there a sequence, some kind of signal i should send to tell the stm32 to start running ?

any help appreciated.

Are you sure you put your board’s BOOT0/BOOT1 pins in the correct position so that it will start executing the firmware from flash and not go into bootloader mode?

1 Like

thanks pointing this out. I’ll try on monday.

that was the problem, we had to solder a jumper so that the stm boot correctly. thanks a lot