I’ve read quite some topics and site about how to solve this, but I’m unable to find the right info. I’m trying to program a STM32L052R8T6 using STM32Duino via Platform.IO, but I’m unable to get it working. In Arduino, I’m able to use a generic STM32L0 series board with Generic L052R8Tx part number and compile a simple blink program and upload it with ST-link. I’m not sure how to do the same with Platform.IO.
I tried to use the following as a custom board definitions in a json file:
{
"build": {
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32L0 -DSTM32L052xx",
"f_cpu": "16000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32l052r8t6",
"product_line": "STM32L052xx",
"variant": "STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32L052R8",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32l0",
"svd_path": "STM32L052.svd"
},
"frameworks": [
"arduino",
"cmsis",
"mbed",
"stm32cube",
"libopencm3",
"zephyr"
],
"name": "GDMS Main board",
"platform": "ststm32",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 65536,
"protocol": "stlink",
"protocols": [
"jlink",
"cmsis-dap",
"stlink",
"mbed"
]
},
"url": "https://developer.mbed.org/platforms/ST-Nucleo-L053R8/",
"vendor": "ST"
}
My platformio.ini file looks like this:
[env:gdms-main]
platform = ststm32
board = gdms-main
framework = arduino
build_flags =
-Os
-D SERIAL_RX_BUFFER_SIZE=200 ;Increase USART RX buffer size
When trying to compile my files, I get the following error:
Building in release mode
Compiling .pio\build\gdms-main\FrameworkArduinoVariant\PeripheralPins.c.o
Compiling .pio\build\gdms-main\FrameworkArduinoVariant\generic_clock.c.o
Compiling .pio\build\gdms-main\FrameworkArduinoVariant\variant_NUCLEO_L053R8.cpp.o
Compiling .pio\build\gdms-main\FrameworkArduinoVariant\variant_generic.cpp.o
<command-line>: warning: ISO C99 requires whitespace after the macro name
Compiling .pio\build\gdms-main\SrcWrapper\src\HAL\stm32yyxx_hal.c.o
<command-line>: warning: ISO C99 requires whitespace after the macro name
<command-line>: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\gdms-main\SrcWrapper\src\HAL\stm32yyxx_hal_adc.c.o
<command-line>: fatal error: variant_GDMS-MAIN.h: No such file or directory
What do I need to do?