Custom framework? or platform?

I want to experiment with a beta version of the Arduino mbed core for nano33ble.
I’ve hacked it by replacing .platformio/packages/framework-arduino-nrf52-mbedos with the beta version and copying the package.json from the original.

Now I’d like to do something that is more maintainable: I’d like to be able to choose on a per-project basis whether to use the release framework or the beta framework.

I’d appreciate some guidance on how to set that up. I’ve been trying to grok how platforms, packages, etc all fit together but I haven’t quite gotten it yet.

If you have just making changes to the framework, use platform_packages to make the project use that new version of the framework package, which you e.g. upload to a Github repo or some other server. You can also place this in the [env] section which is auto-inherited by all other environments, so you only need to place it once in the platformio.ini. E.g.:

; global overrides
[env]
platform_packages =
  framework-arduino-nrf52-mbedos @ https://github.com/myuser/my-modded-repo.git

[env:nano33ble]
platform = nordicnrf52
board = nano33ble
framework = arduino

; other board environments with spcial settings..

Refer to the general documentation. Basically:

  • package: A general package containing some data. Mainly defined by its package.json. Installed in the <user home path>\.platformio\packages folder. PlatformIO provided packages are at bintray. Example of packages are: toolchain-atmelavr, framework-arduino-stm32, tool-openocd (aka toolchains, frameworks and tools)
  • platform: the general microcontroller platform. e.g. platform-atmelavr, platform-ststm32, platform-nordicnrf52. It is mainly defined by its platform.json, platform.py, board JSON files and builder scripts for target frameworks. The platform.json defines which packages are needed for this platform (like a compiler, framework, upload tools…) and points to a manifest.json that has download links these packages.
  • framework: Pre-provided programming environment / APIs; examples are Arduino (or to be exact, the Arduino core for the target platform you’re using), mbed-os, Zephyr, STM32Cube, etc
1 Like

Thank you, Max. Based on your guidance I got this working, and I have a better understanding of the PlatformIO architecture.