PlatformIO Community

Custom arduino framework

Is there anyway to make adjustments to the arduino framework that’s being used? I have a system that’s programmed through usbasp and does not have a physical serial. I’d like to remove the Serial object and it’s hardware serial library including buffers etc to save the 157 bytes it’s using.

You need to fork https://github.com/platformio/platform-atmelavr and https://github.com/platformio/platformio-pkg-framework-arduinoavr. Update the last repo and it’s core files.

Then, replace Semantic Version with full path to patched repo here

In platformio.ini please use

[env:my]
platform = http://url/to/forked/platform.git

Thanks Ivan, see my other post, it’s working now after some struggling. But replacing the package version with a git repo breaks the arduino.py because it doesn’t receive a version from the package.

Yes this generates an error in arduino.py. Has anyone worked around this? I want to use a forked version in a travis build and am blocked.

And my workaround was to add the following to detect when FRAMEWORK_VERSION is a commit id:

diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py
index 8746e3b..5e61f66 100644
--- a/builder/frameworks/arduino.py
+++ b/builder/frameworks/arduino.py
@@ -33,6 +33,12 @@ FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoavr")
 FRAMEWORK_VERSION = platform.get_package_version("framework-arduinoavr")
 assert isdir(FRAMEWORK_DIR)
 
+# hack the version when it has no dots and is probably a commit id
+# not great to hard code the arduino version but there is no where
+# else to put it
+if "." not in FRAMEWORK_VERSION:
+    FRAMEWORK_VERSION = "~1.10620."+FRAMEWORK_VERSION
+
 # USB flags
 ARDUINO_USBDEFINES = [
     "ARDUINO_ARCH_AVR",

Hi @ivankravets,

How do I change to use a forked repo of the official arduino? I followed the steps above but they seems outdated.

I have cloned the platformio repo and changed the version string to my custom github repo url but something goes terrible wrong. Is this supported or is there any other approach?

Often it’s sufficient to add a line as below to platformio.ini.

platform_packages = framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.6.3

Of course, it depends on the platform you are using. Before you add it, check the build output to see what the package is called (framework-arduinoespressif8266 in the above example).

Hi, thanks for the response. I’m using the STM32 arduino core and from what I understand it doesn’t include everything platformio needs to build. platformio seems to have repacked that repo and added CMSIS/HAL + build files to it.

If I update platform_packages with STM’s repo I end up without the CMSIS/HAL/build files and the build fails. It feels like the dependencies between these repos make it difficult to specify custom arduino core repo.
Is there any easy solution?
I guess everything would work if stm’s repo contained all stuff for platformio but it doesn’t. What to make this work out of the box? Should STM add the necessary files to their repo?