Good morning everyone, and thanks in advance for any help or advice that I could receive.
I am currently in need of setting up two different development environments on my PC, one for a custom board with a SAM3X8E and another one for a custom board with an AtMega2560.
Currently, I am using Visual Studio with the Visual Micro extension, and changing the Arduino IDE path everytime I need to compile a new release for the different boards.
However, I would like to utilize PlatformIO on Visual Studio Code as my main IDE for the AtMega2560 firmwares.
For the AtMega board, I needed to create a new “pins_arduino.h” file for assigning different functions to the microcontroller pins, and also created a few libraries which are specific for my application.
Is there a way to “point” PlatformIO to my current development environment, so that I only need to perform the classic build operations?
Yes. Both the Atmel-SAM and Atmel AVR platform, to which your SAM3X8E and AtMega2560 belong respectively, have support for a special platformio.ini instruction with which you can re-point the variant folder: board_build.variants_dir. Take e.g. the variants folder of the standard Arduino AVR core, in there are all the subfolders for each board (mega, standard, etc.). Which variant folder it takes is determined in the standard case by the board’s JSON manifest, which has a build.variant value
However, as the documentation tells you, every one of these fields can be overriden in the platformio.ini.
So, let’s say you have a folder my_custom_variants somewhere on your computer (for simplicity sake we say it’s in the project directory), which contains the folder my_custom_mega folder which contains the pins_arduino.h. Then the platformio.ini
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
; set where the folder with all the board variants is
board_build.variants_dir = my_custom_variants
; change which exact variant to use
board_build.variant = my_custom_mega
will use that custom folder while still using PlatformIO’s standard Arduino core package (in this case C:\Users\<user>\.platformio\packages\framework-arduino-avr).
Thanks for the prompt and very clear reply.
Unfortunately, due to my lack of looking deep enough, I did not find the discussions you cited.
Thanks for responding to me anyways!