Written by Anish Bhatt

Compiling ergodox firmware

make keyboard

This post covers compiling ergodox firmware from scratch, and loading it via teensy loader cli

Massdrop has a nice ErgoDox layout configurator you can use to make your own layout. However, their code base is outdated and is closed source, so there is no easy way to fix this. You can directly use Benblazak’s github repo to compile your own ergodox firmware, but manually editing the layout directly in code is a bit cumbersome. There is an easy way however to use the layout generated by the configurator and compile it into Benblazaks’ repo. First, clone the github repo

# git clone https://github.com/benblazak/ergodox-firmware.git

The default layout used is called qwerty-kinesis-mod, and can be found under ergodox-firmware/src/keyboard/ergodox/layout. Create a layout you like at the configurator and download the source instead of the compiled firmware by ticking the “Source Code” checkbox next to the Download link. Here’s mine for example. Extract the resultant zip file into a predetermined location, say massdrop_layout. Copy the required files as follows:

# ls
  ergodox_firmware/	massdrop_layout/
# cd massdrop_layout/keyboard/ergodox/layout/
# cp default--layout* ../../../../ergodox-firmware/src/keyboard/ergodox/layout/.

Next, install the make dependencies for the ergodox firmware. On ArchLinux, you need avr-binutils, avr-gcc & avr-libc. They might be named slightly differently depending on your distro.

Now we actually compile the firmware by overriding the default target of qwerty-kinesis-mod with our custom layout as follow:

# cd ergodox-firmware/src
# make LAYOUT=default--layout
# ls firmware*
  firmware.eep  firmware.elf*  firmware.hex  firmware.map

Next, we compile and fire up the cli teensy loader to actually load the firmware. You can use the GUI version as well, but it turned out to be a little flaky for me

# wget https://www.pjrc.com/teensy/teensy_loader_cli.2.1.zip
# unzip teensy_loader_cli.2.1.zip 
# cd teensy_loader_cli/
# make
# sudo ./teensy_loader_cli -mmcu=atmega32u4 -w ../ergodox-firmware/src/firmware.eep -v
# sudo ./teensy_loader_cli -mmcu=atmega32u4 -w ../ergodox-firmware/src/firmware.hex -v

And your Teensy should be up and running at the end of this.<p> The -w parameter indicates that the loader should wait for the device to appear, -v indicates verbose output. The -mmcu parameter depends on the version of the Teensy you have. atmega32u4 indicates a Teensy 2.0 (The one included in the Massdrop kits), full list available here. Note: the teensy loader does not flash until you press the reset button on the Teensy (or press the reset key on the ergodox, if you have that as part of an already flashed layout)

comments powered by Disqus