PlatformIO Community

How to use a custom arduino board and package it? (ftDuino)


#1

I’m currently working on adding support for the ftDuino Board to platformio (it’s based on a ATmega32u4, AFAIK). When I install the board in the Arduino IDE, I need to add a custom URL to “Additional Board Manager URLs”.

It’s a package_xxx_index.json file. The format of this is specified by Arduino (here).

At packages/platforms there are multiple versions of the package and packages/platforms/[latest version]/url points to an ZIP file that has the following structure:

ftduino-0.0.xx.zip
├── avrdude.conf
├── boards.txt
├── bootloaders
│   └── caterina
│       └── Caterina.hex
├── libraries
│   └── Ftduino [Arduino library structure]
│    [more libraries]
├── platform.txt
└── variants
    └── ftduino
        └── pins_arduino.h

How would I add support for this board? I know I could just put a custom “variant” in HOME_DIR/packages/framework-arduinoavr, but I want to package everything properly so I can redistribute the package properly.

Does Platformio support adding such a package_xxx_index.json file directly?
If not, what do I need to do to create a custom “platform” so that anyone could install the board easily?

Is there even a chance to get a pull request accepted at platformio-pkg-framework-arduinoavr to add the board? It’ll be the easiest solution I guess.

Thanks in advance


#2

We are not “Arduino” where charge makers to be listed in their official registry. Just make a PR to https://github.com/platformio/platformio-pkg-framework-arduinoavr and we would be happy to merge it. Also, don’t forget with PR to https://github.com/platformio/platform-atmelavr/tree/develop/boards


#3

I have exactly the same problem with exactly the opposite requirement - I have a custom board I’d like to package Arduino support for, but explicitly do NOT want to distribute it (it’s a proprietary board, and at a minimum would represent clutter, besides that I don’t want to do the paperwork to get dissemination approved).

Is there a way to package a framework variant in the project dir, the same way I can simply add a “boards/myboard.json”?

Way back in 2016 there was a mention here that PIO 3.x would support this, but the documentation is very sparse and extends only to the board.json file, not any underlying variant that might be necessary.

Another suggestion was to define custom preprocessing scripts to copy the board variant into the proper framework directory, such that when it gets overwritten by an update, that won’t matter for future builds. But that seems like a tedious/messy way to do things. Is it still the only practical option?


#4

You will be able to pass a custom local path to a package with upcoming PlatformIO Core 4.0. See


#5

So the idea, then, is to have a complete copy of the package “package-framework-arduinosam”, with my board added, thats then referenced in platformio.ini?

That’s not a LOT less cumbersome to set up than creating and installing a custom package from git, but it IS I think a good middle ground between ease-of-use and doing-dumb-hacks-to-make-an-easy-solution-work.

Does the platformio.ini package override an existing one? If I could have the sanctioned “framework-arduinosam” installed, and a custom version ONLY for my specific project, that’d probably be ideal.


#6

It will work as

[env:myenv]
board = ...
platform_packages =
  framework-arduinosam@http://github.com/user/mycustomarduinosam.git