PlatformIO always works in the context of boards, not pure MCUs. Here’s the documentation for board definitions, though it helps even more to look at existing board definitions that are close to the boards you want, e.g., teensylc.json and nucleo_g031k8.
In short, a PlatformIO board definition does not only contain the name of the MCU you’re working with, but more information, regarding e.g. the nominal clock speed the board runs at (f_cpu
), macros that are always present (extra_flags
), the name of the Arduino variant to be used with (variant
), the supported debug methods and meta-info for that (debug
), supported frameworks (frameworks
) and supported upload methods and parameters (upload
).
Note that you can always have your own board definitions in the boards/
folder of the project and use those if the standard board definition are not applicable for your usecase.
PlatformIO does not have built-in support for framework = cmsis
on platform-teensy at the moment, and nobody has yet requested it in here, but it is very easy to add it yourself for the moment being. The general gist is to create a baremetal project (aka, no external stuff is compiled) and then add the CMSIS code and necessary build settings. I’ve taken the liberty to fork a TeensyLC CMSIS project and make it PlatformIO-compilable at GitHub - maxgerhardt/teensylc-baremetal: GCC Bare Metal Toolchain with CMSIS for the Teensy-LC Board (KL26Z64 Cortex-M0+).
In the case of using a STM32G031K8 MCU within a CMSIS project, you can just use the Nucleo G031K8 board definition because there would be no difference in the build, upload or debug settings compared to if you created your own board definition for a generic STM32G031K8 board.
[env:nucleo_g031k8]
platform = ststm32
board = nucleo_g031k8
framework = cmsis
; for cmsis-blink/src/main.c to identify series
build_flags = -DSTM32G0
as a platformio.ini
and the cmsis-blink project can be used as a starting point there.
Note that the default boards do contain a lot of genericSTM32xxxx.json
definitions otherwise, which use the generic Arduino board variants.