I have been trying to move a project to the RobotDyn MCU-PRO Mega 2560 (mini board based on Mega 2560 ( https://robotdyn.com/mcu-pro-mega-2560-atmega2560-16au-usb-ch340c-with-pinheaders-2-lines-pinheaders-pitch-0-1.html ) . Certain ports (I have found a few so far and there might be more) are not mapping to the PlatformIO megaatmega2560 environment. (Below is my platformio.ini). Has anyone worked with this board in PlatformIO who might have some advice on the environment settings? There is a “RobotDyn MCU-PRO” board library for the Arduino IDE ( https://robotdyn.com/pub/downloads/comp_docs/MCUPROXPRO/MCU-PRO_Lib.rar ), but I am clueless on how to integrate that into PlatformIO. Given such a library, is there doc on how to create a PlatformIO environment from that Arduino IDE board library? Thank you for any advice.
As can be seen in the e.g. megaatmega2560 board definition, an Arduino variant is selected through the build.variant attribute. As documented here, you can override attributes for a board definition on-the-fly in the board definition. As can be seen in the builder script, you can override the folder where variants are found through build.variants_dir.
The MCU-PRO_lib.rar gives you the the variant folder for the mcupro board definition (aka, the pin definition). Other existing variants can be seen here.
So, integrating the new variant into PlatformIO is quite easy:
Create a new project for a megaatmega2560
Create a new folder variants in the project folder’s root
Copy the mcupro folder from the downloaded MCU-PRO_Lib.rar into the variants folder