How to add a different arduino core

I’ve been working on adding an STM32L0 arduino core from GitHub - GrumpyOldPizza/ArduinoCore-stm32l0: Arduino Core for STM32L0 to platformio. I have it working but am wondering what the best way to integrate is. It lives in a separate framework-arduinostm32l0 package but I need to insert it somehow into the ststm32 platform. What I did was to add to platform.json, add a build script into builder/frameworks/arduino and then extend the hokey matching at the end of

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()

if "stm32f1" in env.BoardConfig().get("build.variant"):
    env.SConscript('maple/', exports="env")
if "stm32l0" in env.BoardConfig().get("build.mcu"):
    env.SConscript('stm32l0/', exports="env")

Notice the last two lines, which I added.

  • is there no cleaner way to do this?
  • how do I do this in my environment such that it doesn’t get wiped the next time I upgrade platformio?

One thing I tried is to create a different framework, e.g. arduino-stm32l0 in order to avoid having the hokey if "stm32l0" in env.BoardConfig().get("build.mcu"): condition, but there are a number of things that are hard-coded in platformio for a framework called arduino. Is there a way to “enable” these special things for a framework that is called differently?

Hi, I am trying to do the same…did you find a better / automatic solution?

We work on the bug update for ST STM32 dev/platform which will allow switching between cores. See

You can try upstream version ST STM32 — PlatformIO latest documentation

Can you share some more detailed information about how you got it working in PlatformIO? I don’t mind a complicated solution, as long as it works.

This was released today as stable 5.2.0. Update your platforms (pio platform update) and try the instructions from the documentation linked above.

I think there is a little miscommunication here. I was referring to the STM32L0 core mentioned at the beginning of this thread. The updated platforms and docs you are referring to, are all about two different cores: STM32duino and STM32Duino and Arduino STM32 (maple).

To be more specific: I want to be able to use the STM32L0 arduino core from .

Ah, now that’s a different thing. For that you’d need to update the platform-ststm32 again with new builder scripts for your core and the new core itself of course. I can’t give you a step-by-step explanation out of my head but if you want to start working, then you’d look into the builder script, specifically the code which distinguishes the cores, and the invoked sub-scripts (e.g. framework-arduinoststm32-maple\tools\

Thanks for our prompt answers! Maybe topic starter tve will return to this topic with some more detailed information, or I will dive into this myself later.

1 Like