Skip to content

Instantly share code, notes, and snippets.

@asmallteapot
Created June 7, 2019 01:06
Show Gist options
  • Save asmallteapot/367fb7582951cf767d2c8e615f4ccaae to your computer and use it in GitHub Desktop.
Save asmallteapot/367fb7582951cf767d2c8e615f4ccaae to your computer and use it in GitHub Desktop.
Updating your keyboardio Model 01's firmware with arduino-cli

Updating your keyboardio Model 01's firmware with arduino-cli

0. Download the Model 01 firmware:

$ git clone https://github.com/keyboardio/Model01-Firmware.git
$ cd Model01-Firmware

1. Download and install arduino-cli:

$ wget https://downloads.arduino.cc/arduino-cli/arduino-cli-latest-osx.zip
$ unzip arduino-cli-latest-osx.zip
$ mv arduino-cli-0.3.6-alpha.preview-macosx /usr/local/bin/arduino-cli
$ which arduino-cli
/usr/local/bin/arduino-cli

2. Find the arduino-cli configuration:

$ arduino-cli config init
Config file PATH: /Users/ellen/Library/arduino15/arduino-cli.yaml

3. Replace the board_manager stanza with the following:

board_manager:
  additional_urls:
  - https://raw.githubusercontent.com/keyboardio/boardsmanager/master/package_keyboardio_index.json

4. Update the index of available cores (board SDKs):

$ arduino-cli core update-index
Updating index: package_index.json downloaded
Updating index: package_keyboardio_index.json downloaded

5. Install the keyboardio:avr core:

$ arduino-cli core install keyboardio:avr
Downloading arduino:avr-gcc@4.8.1-arduino5...
arduino:avr-gcc@4.8.1-arduino5 downloaded
Downloading arduino:avrdude@6.0.1-arduino5...
arduino:avrdude@6.0.1-arduino5 downloaded
Downloading keyboardio:avr@1.94-beta...
keyboardio:avr@1.94-beta downloaded
Installing arduino:avr-gcc@4.8.1-arduino5...
arduino:avr-gcc@4.8.1-arduino5 installed
Installing arduino:avrdude@6.0.1-arduino5...
arduino:avrdude@6.0.1-arduino5 installed
Installing keyboardio:avr@1.94-beta...
keyboardio:avr@1.94-beta installed

6. Find your Model 01's fully qualified board name (FQBN) and serial port: In this example, the FQBN is keyboardio:avr:model01:

$ arduino-cli board list
FQBN                  	Port                     	ID       	Board Name
keyboardio:avr:model01	/dev/cu.usbmodemCkbio01E1	1209:2301	Keyboardio Model 01

In this example, the fully qualified board name (FQBN) is keyboardio:avr:model01, and the serial port is /dev/cu.usbmodemCkbio01E1:

$ MODEL01_FQBN="keyboardio:avr:model01"
$ echo $MODEL01_FQBN
keyboardio:avr:model01

$ MODEL01_PORT="/dev/cu.usbmodemCkbio01E1"
$ echo $MODEL01_PORT
/dev/cu.usbmodemCkbio01E1

7. Compile the Model 01 firmware:

$ arduino-cli compile --fqbn $MODEL01_FQBN Model01-Firmware.ino
Build options changed, rebuilding all
Error: fork/exec /Users/ellen/Library/arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++: bad CPU type in executable
Compilation failed.

8. Upload the compiled firmware to your Model 01:

$ arduino-cli upload -p $MODEL01_PORT --fqbn $MODEL01_FQBN Model01-Firmware.ino
Error: stat Model01-Firmware.ino/Model01-Firmware.ino.keyboardio.avr.model01.hex: not a directory
Could not open compiled sketch.
@asmallteapot
Copy link
Author

asmallteapot commented Jun 7, 2019

The Compilation failed. and Could not open compiled sketch. error messages are because the current macOS release doesn't include a 64-bit AVR keychain, which is necessary to run on macOS 10.15 Catalina.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment