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 stm32duino.py:
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
if "stm32f1" in env.BoardConfig().get("build.variant"):
if "stm32l0" in env.BoardConfig().get("build.mcu"):
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?
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).
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 arduino.pybuilder script, specifically the code which distinguishes the cores, and the invoked sub-scripts (e.g. framework-arduinoststm32-maple\tools\platformio-build-stm32f1.py)