How can I use a Custom Framework?

I know that I can use a “custom platform” using (for MSP430, for example)

platform =

instead of

platform = timsp430

Is there a similar option for frameworks? I would like to use some modified code in my fork of the Energia (Arduino) framework that is used by PIO when using the Arduino API with MSP430. I could theoretically modify the code directly in.platformio/packages/framework-energiamsp430 which looks awfully similar to the Energia GitHub and which gets downloaded by PIO automagically. However, I was not able to find an option to let PIO download my custom fork of the framework. Is there even such an option?

Thanks in advance

If you just have an updated version of the energia framework which platform-timsp430 already supports building for, then you can just use a platform_packages instruction in the platformio.ini to override the source for

aka framework-energiamsp430.

platform_packages =
  framework-energiamsp340 @

Be aware that the source you point it at (e.g., a git repository) needs to have a package.json in it. You can copy the current one in <home folder>/.platformio/packages/framework-energiamsp430 and adapt the version field accordingly.

Add a new custom framework (that does not build on anything else) requires the appropriate declarations in the platform.json (which declares where to get the framework files, packaged as a “package” and where the builder script is within the platform) and an appropriate builder script.

Ahh, great. Thank you. Completely missed the platform_packages option. I will give it a try.

Out of curiosity: Where does the code behind platformio/framework-energiamsp430 and the package.json reside at? Does PIO have custom forks for every framework? If so, are they publically available on GitHub or somewhere else? I can only seem to find the platform-timsp430 on GH.

PlatformIO staff publishes these packages and there might be some internal system for generating / storing the package.json there, I have no knowledge of that.

You can however inspect the download links for each package more closely by going to the API, e.g., The PlatformIO core will request the PlatformIO API for a package and get back this data with a download link (possibly OS-specific) and then download + extract it etc.

Reference package.json is

  "name": "framework-energiamsp430",
  "version": "1.10810.210219",
  "description": "Energia Wiring-based Framework for Texas Instruments MSP430 microcontrollers",
  "keywords": [
    "texas instruments",
  "homepage": ""

(10810 being SemVer for 1.8.10 and the last bit being the datecode for (20)21, February 19th.)