-
1Overview
To use these tools, you need to:
- make sure you have the necessary software installed on your system
- download the code from github
- provide basic board information
- run the makeboard.py script
- upload the created package archive and index.json file to a webpage (e.g. you own github repository)
Additionally, you will also need to flash the bootloader to the board.
-
2Installing required software
- Install GNU make (if you do not have it already):
Windows: install from https://gnuwin32.sourceforge.net/packages/make.htm. Do not worry about adding it to PATH, we will do it later.
mac OS: install Xcode; it comes with GNU make
Linux: most likely, make is already installed. If not, run- Debian/Ubuntu – sudo apt install make
- Fedora/RHEL – sudo yum install make
- Install Python 3 (if you do not have it already): https://www.python.org/downloads/
Alternatively, install Thonny IDE, it comes with Python 3 built into it. - Make sure you have Arduino IDE (version 1.8.2 or later) installed.
- Install the latest version of Adafruit's SAMD board support package, following instructions here:
https://learn.adafruit.com/add-boards-arduino-v164/setup - Download the whole github repository https://github.com/shurik179/SAMD-custom-board. You can do it by either cloning it to your computer, or by downloading the zip file and extracting it.
- Install GNU make (if you do not have it already):
-
3Providing board configuration
This is the most important step.
In the downloaded SAMD-custom-board repository, find directory board_data. In this directory, you will need to enter info about your board. There are 3 files you need to provide:
- board-config.ini. This file is already in the directory; just edit it and enter your info. The file is amply commented. This is where you enter basic info about your board.
- variant.h and variant.cpp files. These files contain descriptions of pins used by Arduino IDE, various interfaces (I2C, UART, I2S...) and more. The easiest way to create such files is copy and paste from one of existing boards, see https://github.com/arduino/ArduinoCore-samd/tree/master/variants or
https://github.com/adafruit/ArduinoCore-samd/tree/master/variants
For your convenience, the board_data directory contains variant.h and variant.cpp files for Arduino Zero - you can edit them as you see fit to create your own. Note: the files must be saved with names exactly variant.h, variant.cpp, no modification allowed!
-
4Running the script
Once you have provided all the board info, change into root SAMD-custom-board directory and run makeboard.py script:
python makeboard.py
If everything is OK, it will give an output like this:
Reading board config... Copying sources to build directory... Removing old build directory Creating config files for the board bootloader Building bootloader... Found GCC compiler at /Users/shurik/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin Starting GNU make... Bootloader successfully built Writing boards.txt file Created package archive, size 117517 bytes, SHA256 hash: 03f5c9f4c19744a80e7a07010a39956c9917642bb87d07157461ad46d276eaf7 Creating json index file
If there are any errors, you will need to fix them and try again.
If everything was successful, the SAMD-custom-board/build directory will contain three files you will need:
- bootloader-xxxx.bin file, containing the bootloader for the board
- board_name-version.zip - the zip archive of arduino board support package
- package_xxxx_index.json - the json file with info about this package.
The build directory will also contain subdirectories used by the script to build the bootloader and the support package - you can inspect them if you are curious, or just delete them.
-
5Uploading the package
To make this package available for installation in Arduino IDE, you need to:
- Upload the package zip archive file to a website. You can use your own website, or a github repository. Record the URL of the uploaded file. Note: you need a URL to the raw file itself - for github, you can get it by navigating to the file inside your repository and copying the Raw link.
- edit the package_xxxx_index.json file created by the makeboard.py script. Find the line
"url": "FIXME",
and replace "FIXME" by the actual url (keep the quotes), e.g.
"url": "https://github.com/shurik179/yozh/raw/main/board_support_package/yozh_m0-3.0.2.zip",
- Now, upload the json fie to website/github; again, copy the URL of the (raw) file.
-
6Using the package
Finally, to use the package with your board, you - or anyone who wants to use the board -- - should follow instructions here: https://support.arduino.cc/hc/en-us/articles/360016466340-Add-or-remove-third-party-boards-in-Boards-Manager
Note: so created board package relies on tools provided by Adafruit SAMD board package, so before installing this package, make sure that Adafruit's package is also installed.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.