Building OpenDeck code
This document will explain how to build OpenDeck code.
- Getting the packages
- Cloning OpenDeck repository
- Building the code
- Uploading the compiled code
Getting the packages
The commands listed below are used to install necessary packages in order for the OpenDeck project to be buildable.
It is assumed here Ubuntu 16.04 or higher is used, or alternatively, same versions using Windows subsystem for Linux on Windows 10.
Run the following commands from terminal to download the necessary packages:
cd sudo apt-get install -y wget make srecord git avrdude wget http://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en605750 -O avrtoolchain.tar.gz tar xzf avrtoolchain.tar.gz rm avrtoolchain.tar.gz sudo ln -s $(pwd)/avr8-gnu-toolchain-linux_x86_64/ /usr/local/avr echo 'export PATH="/usr/local/avr/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
Notes if using Ubuntu 18.04:
Due to the following bug, following commands should also be used on Ubuntu 18.04 for the time being:
echo 'export LANG=C' >> ~/.bashrc source ~/.bashrc
Run the following commands from terminal to download the necessary packages (assuming Homebrew is installed):
cd brew install wget make srecord git avrdude grep coreutils wget http://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en605765 -O avrtoolchain.tar.gz tar xzf avrtoolchain.tar.gz rm avrtoolchain.tar.gz sudo ln -s $(pwd)/avr8-gnu-toolchain-darwin_x86_64/ /usr/local/avr echo 'export PATH="/usr/local/avr/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile
Cloning OpenDeck repository
OpenDeck repository uses several Git sub-modules. Therefore, running
git clone url won't work since those sub-modules won't be cloned. Use the following command to clone an entire repository with sub-modules:
git clone --recursive https://github.com/paradajz/OpenDeck.git
Building the code
OpenDeck build process uses Makefile. Using that file, code can be compiled for several targets. In general, targets starting with
fw_ are used to compile the firmware, and targets starting with
boot_ are used to compile bootloaders. The following targets are available:
fw_opendeck- Firmware for the official OpenDeck board.
fw_leonardo- Firmware for the Arduino Leonardo board.
fw_pro_micro- Firmware for the Arduino Pro Micro board.
fw_teensy2pp- Firmware for the Teensy++ 2.0 board.
fw_mega- Firmware for the Arduino Mega board (Main MCU - ATmega2560).
fw_uno- Firmware for the Arduino Uno board (Main MCU - ATmega328).
fw_16u2- Firmware for the ATmega16u2 MCU usually found on Arduino Mega and Uno boards.
fw_8u2- Firmware for the ATmega8u2 MCU found on older Arduino Mega and Uno boards.
fw_kodama- Firmware for the custom OpenDeck-based board.
boot_opendeck- HID bootloader for the official OpenDeck board.
boot_leonardo- HID bootloader for the Arduino Leonardo board.
boot_16u2- HID bootloader for the ATmega16u2 MCU usually found on Arduino Mega and Uno boards. Note: this bootloader can't be currently be used to update firmware.
boot_kodama- HID bootloader for the custom OpenDeck-based board.
The following syntax must be used:
To compile the code for Arduino Leonardo as an example, first change directory to
OpenDeck/src. Next, run the following command:
If the command run was successful, output should look like the following:
paradajz@paradajz-xubuntu:~/Documents/OpenDeck/src$ make TARGETNAME=fw_leonardo Cleaning up. Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/ConfigDescriptors.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/DeviceStandardReq.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/Events.c Finished building: modules/lufa/LUFA/Drivers/USB/Core/USBTask.c Finished building: application/board/avr/usb/Descriptors.c Finished building: modules/lufa/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c Finished building: modules/lufa/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c Finished building: application/OpenDeck.cpp Finished building: modules/core/src/HAL/avr/reset/Reset.cpp Finished building: application/database/Database.cpp Finished building: modules/dbms/src/DBMS.cpp Finished building: application/interface/analog/Analog.cpp Finished building: application/interface/analog/FSR.cpp Finished building: application/interface/analog/Potentiometer.cpp Finished building: application/interface/cinfo/CInfo.cpp Finished building: application/interface/digital/input/DigitalInput.cpp Finished building: application/interface/digital/input/buttons/Buttons.cpp Finished building: application/interface/digital/input/encoders/Encoders.cpp Finished building: application/interface/digital/output/leds/LEDs.cpp Finished building: application/sysExConf/Handling.cpp Finished building: modules/midi/src/MIDI.cpp Finished building: modules/sysex/src/SysEx.cpp Finished building: application/board/avr/variants/leonardo/Init.cpp Finished building: application/board/avr/variants/leonardo/ISR.cpp Finished building: application/board/avr/variants/Common.cpp Finished building: application/board/common/analog/input/Common.cpp Finished building: application/board/common/digital/input/encoders/Common.cpp Finished building: application/board/common/digital/input/direct/Direct.cpp Finished building: application/board/common/digital/input/buttons/DirectIn.cpp Finished building: application/board/common/digital/input/encoders/DirectIn.cpp Finished building: application/board/common/digital/output/leds/DirectOut.cpp Finished building: application/board/avr/usb/USB_MIDI.cpp Finished building: application/board/avr/uart/UART.cpp Finished building target: build/fw_leonardo.elf AVR Memory Usage ---------------- Device: atmega32u4 Program: 22672 bytes (69.2% Full) (.text + .data + .bootloader) Data: 1007 bytes (39.3% Full) (.data + .bss + .noinit)