I’ve followed the documentation to create a custom board Custom Embedded Boards — PlatformIO v6.1 documentation My board is based on an existing board that already works and I have not done major changes. I’m using the option to put a “boards” folder within my project (to keep the project portable between machines).
My custom board shows up when I list it with
pio boards --installed
… but when I try to compile my project, it fails to compile since I need to define a pins_arduino.h file as well:
/Users/jensa/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-gpio.h:29:10: fatal error: pins_arduino.h: No such file or directory
I’ve created (or rather duplicated) this file and tried putting this file in several locations in my project with no result. I’ve also tried making a variant-folder with this file within at the location where all the other boards do this (/Users/username/Documents/PlatformIO/Projects/arduino-esp32/variants/myCustomPCB/ on my Mac)
The pins_arduino.h is usually a part of the variants folder of the framework, that is, if a board declares "variant":"xyz" in its board JSON file, then <package dir>/framework-arduinoespressif32/variants/xyz/pins_arduino.h is expected to exist.
As you can see in
the builder script however also allows a redirection of the variants directory from the framework package to a project-local folder. I.e., if your project has a variants folder, you can do
Thanks for the swift reply. This almost resolved my problem. Using the “global” variants directory did not work. I then created the “variants” folder and dropped “pins_arduino.h” inside it. That still failed. I then made a subfolder in the “variants” folder with the name of my custom board and then it complied as expected. So in order to use a custom board locally, you’ll need to do the following:
Installing locally (in a single project)
Create boards directory in your project folder (if it doesn’t exist).
Create myboard.json file in this boards directory.
Search available boards via pio boards command. You should see myboard board.
Create variants directory in your project folder (if it doesn’t exist).
Append the following line to your platformio.ini board_build.variants_dir = variants