Adding a new board from Arduino IDE to PlatformIO

That’s not just “adding a board”, that’s “adding a whole forked Arduino core with supporting packages and a board definition”.

You will need advanced PlatformIO knowledge if you want to do this yourself, regarding platform-atmelsam code, PlatformIO packages (package.json, platform.json), compiler settings, etc.

Recommended reading is also Arduino Due (or other SAM3/4) upload fails with ATMEL ICE JTAG on VSCode with PlatformIO - #8 by maxgerhardt.

I recently wrote the repo GitHub - maxgerhardt/pio-samd51n19-test that adds support for a not-yet supported chip type, you can see some things regarding board JSON files there.

More concretely, you will need to modify or add a framework-arduino-samd-XYZ (with XYZ e.g. naming canfduino packages, also a framework-cmsis-atmel-canfduino (since they have their own special) packages, reference those in the platform.json and in the platform’s python code, and in your board file reference those forked cores.

So basically what I did with Add 5G-NB-IoT Board + Arduino Core Support by maxgerhardt · Pull Request #187 · platformio/platform-atmelsam · GitHub for a different board.