How to use a different Framework


I am completely new to PlatformIO, but I am stuck…

In order to use the VID28 library of GewoonGijs he recommends using the his own build of Arduino, where he corrects a timer issue. This is the this package: GitHub - GewoonGijs/platformio-pkg-framework-arduinoavr: Package: Atmel AVR / Arduino framework for PlatformIO

I am using an Arduino Nano ATmega328

My config file looks like this:
platform = atmelavr
board = nanoatmega328
framework = GitHub - GewoonGijs/platformio-pkg-framework-arduinoavr: Package: Atmel AVR / Arduino framework for PlatformIO
lib_deps =

However when I try to upload I get the error that my board is not compatible with the this framework.
Error: This board doesn't support arduinoavr@ framework!

So I am just a little lost on how to define a different platform code. The only thing he actually did was adapthing the wiring.c methods to solve an issue when you set the 0th prescaler.

sorry if this is not a clear question, but I am really lost here :slight_smile:

framework only accepts the name of the framework, not a direct URL.

PlatformIO will read the framework name and then look what ‘package’ it is associated with. In this case, due to this logic, it will be looking for framework-arduino-avr. Together with additional information from the platform manifest, it then figures out where to download the framework files (from PlatformIO’s CDN) or whether you have it already installed.

Note that PlatformIO also tells you the used packages and their version at the start of compilation.

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Atmel AVR (3.2.0) > Arduino Nano ATmega328
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
 - framework-arduino-avr 5.1.0
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder ->

To modify the used Arduino core, you want to tell PlatformIO to use a different source for the pacakge framework-arduino-avr, that is, your linked repository. This is possible per platform_packages.

So you would write

platform_packages =

at the bottom of the platformio.ini. And it will then attempt to download it via git and use it.

Note that this only works if the repo or whatever you’re linking to has package.json for PlatformIO. But if you look into

the linked repo has exactly that.



thanks for your reply and explanation. I am not sure if I understand it all but it gives me a start.

Maybe not the correct spot, but if I understand well you have:
From lower to top
frameworks → the base code of what will be running on your machine
libraries → extra toolbelt you can add (but it has to match the framework)

Is it possible I use several frameworks for Arduino for example?

I am now going to test if it works!

Basically, yes. The Arduino core / framework are the pieces of code that implement the Arduino APIs like digitalWrite() etc and give the basis for all Arduino libraries. You can e.g. inspect the core implementation for AVR here.

The post Frameworks, platforms, and boards, oh my! has some more in-depth info.

You can only use one Arduino core implementation, as it will be conflicinting with another core implementation regarding the implementation of functions if you put another one in there. There exists however one very special case where two frameworks can be used apparanently simultaneously, which is because one is actually the basis of another. That framework = espidf, arduino case for ESP32’s is also mentioned in the last post. For all others, you can only choose one framework.

Just to confirm that it works!

I am now doubting to fork the latest arduino-avr and adapt his changes, but this already works.

my biggest appreciation for this really responsive forum!