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
).
This exact method has been discussed in the forum multiple times, see e.g. Programm SAMD21 directly and How use a same chip but with different environment? with the example projects
- GitHub - maxgerhardt/pio-custom-samd21e17a-board: An example on how to define a custom board for the Atmel SAM platform and the Arduino (Adafruit variant) framework
- GitHub - maxgerhardt/pio-custom-stm32duino-variants: A short example of how to use a custom variant folder for the PlatformIO + STM32Duino environment