I would like to know what is the procedure for adding a custom board to the Arduino IDE?
My custom board is similar to the Arduino Zero. Instead of using the ATSAMD21G18, my board is based around the ATSAMC21G18. I also have the Atmel/Microchip SAMC21 Xplained development board.
I have found some open source code where the author has adapted/forked the Arduino SAMD21 code and made it work for the SAMC21 Xplained board (here). The author has stuck to the Arduino hardware folder structure and has added the SAMC21 Xplained to the board.txt
file.
As a test, when I install the Arduino SAMD21 from the Arduino Board Manager, I noticed that it installed the hardware files in the following directory:
%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\samd1円.6.19\
I have read that to add hardware files to the board manager I need to create a .json
file with the appropriate details. More information here. However, as far as I can tell, this requires me to zip the SAMC21 hardware files into a tarball and provide a URL to that tarball. I also need to generate and insert a SHA in the .json
file.
Am I on the right path with the .json
file?
Or should I just download the SAMC21 hardware files and place them in the %LOCALAPPDATA%\Arduino15\packages\arduino\hardware\samd\
folder next to the 1.6.19
folder?
My last resort would be to just copy the files into the existing SAMD21 hardware folder?
I have looked into the following Arduino SE questions but they do not answer the question satisfactorily.
- upload.tool not used in custom boards.txt?
- Arduino Due custom platform for school and library installation (I would prefer not to use the Arduino IDE in portable mode.)
-
I think the .json file is just for publishing so the board manager can find it; you can edit boards.txt to add your own based on zero if its just for you.esoterik– esoterik07/16/2018 20:26:23Commented Jul 16, 2018 at 20:26
-
do you want to publish it or only for your use? for your use it is simpler to add it into hardware subfolder of your sketches folderJuraj– Juraj ♦01/15/2019 08:05:25Commented Jan 15, 2019 at 8:05
-
@Juraj This would be just for my own use but I would need to replicate it on a couple of machines. I would appreciate if people could add answers for both scenarios.sa_leinad– sa_leinad01/15/2019 08:35:13Commented Jan 15, 2019 at 8:35
-
@Juraj Thanks. I will look into the link shortly.sa_leinad– sa_leinad01/15/2019 08:35:48Commented Jan 15, 2019 at 8:35
1 Answer 1
The simplest clean way to add your board using an existing core is to add the variant to your sketches folder's hardware subfolder. Only boards.txt and files for the board variant are added.
In your sketches folder create a 'hardware' folder. In this folder create a folder with the name of your boards package and a subfolder with the architecture name and a subfolder for variant and a name of the variant. for example hardware/my_boards/samd/variants/samc21x
In your variant folder (variants/samc21x
) put the files for your variant based on variant files of the closet variant in the referenced hardware package. In your case perhaps a mkrzero would be a good example.
In your package's root (hardware/my_boards/samd/
) add boards.txt file with entries for your board.
For boards.txt take the options for a similar board in referenced package. Change the names and settings and prefix build.core
value with the name of the vendor of the referenced package. For arduino/samd it would be arduino:
. For example samc21x.build.core=arduino:arduino
My custom and customized boards definitions https://github.com/jandrassy/my_boards
-
1and
samc21x.build.extra_flags=-D__SAMC21G18A__ {build.usb_flags}
or similar. the Arduino SAMD core supports compilation for SAMC01/16/2019 08:24:41Commented Jan 16, 2019 at 8:24 -
1success story: forum.arduino.cc/index.php?topic=602377.msg4089655#msg408965503/09/2019 06:03:33Commented Mar 9, 2019 at 6:03