How to initiate project for RobotDyn MCU-PRO Mega 2560

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.

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino

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:

  1. Create a new project for a megaatmega2560
  2. Create a new folder variants in the project folder’s root
  3. Copy the mcupro folder from the downloaded MCU-PRO_Lib.rar into the variants folder
  4. Adapt the platformio.ini to say
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
; repoint variant & variant folder to the project-local one.
board_build.variants_dir = variants
board_build.variant = mcupro
  1. Create a new file src\main.cpp and copy the Cycle_blink.ino code from the library download into it, but add #include <Arduino.h> at the top
  2. Compile.

Max,
I very much appreciate your time and expertise. Thank you for your detailed explanation. I will pursue this.
All the best,
Pete