Skip to content

Building the OpenDeck firmware

paradajz edited this page Jun 1, 2023 · 38 revisions

This document will explain how to build the OpenDeck firmware. Building the firmware is needed only when creating own board variants since compiled binaries are the part of OpenDeck releases.

Getting the packages

The commands listed below are used to install necessary packages for the build process of OpenDeck firmware.

Ubuntu/WSL

It is assumed here Ubuntu 22.04 is used, or alternatively, same version using Windows subsystem for Linux. Earlier versions are not supported, and newer versions aren't tested.

Run the following commands from terminal to download the necessary packages (select the entire block and paste in into terminal):

cd && \
sudo apt-get update && \
sudo apt-get install -y cmake make srecord git git-lfs curl wget gcc g++ gdb imagemagick dfu-util ccache unzip bsdmainutils xz-utils && \
wget https://github.com/TomWright/dasel/releases/download/v1.27.3/dasel_linux_amd64 && \
chmod +x dasel_linux_amd64 && \
sudo mv $(pwd)/dasel_linux_amd64 /usr/local/bin/dasel && \
wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -O arduino.tar.xz && \
tar -xf arduino.tar.xz && \
rm arduino.tar.xz && \
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 && \
tar -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 && \
rm gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 && \
echo 'export PATH=~/arduino-1.8.19/hardware/tools/avr/bin:~/gcc-arm-none-eabi-10.3-2021.10/bin:${PATH}' >> ~/.bashrc && \
sudo cp $(pwd)/arduino-1.8.19/hardware/tools/avr/etc/avrdude.conf /etc/avrdude.conf && \
source ~/.bashrc

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:

cd && \
GIT_LFS_SKIP_SMUDGE=1 git clone --recursive https://github.com/shanteacontrols/OpenDeck.git && \
cd OpenDeck/src

Several binaries are stored with Git LFS, but are not needed for the build, hence the GIT_LFS_SKIP_SMUDGE part.

Building the firmware

The firmware can be compiled for several targets. To see which targets are available, open config/target directory in root directory of repository.

The following syntax must be used:

make TARGET=<target>

To compile the firmare for Arduino Mega2560 as an example, make sure the current directory is OpenDeck (root directory of the repository). Next, run the following command:

make TARGET=mega2560

If the command run was successful, output should look like the following:

paradajz@desktop ~/dev/git/OpenDeck master
> make TARGET=mega2560
Generating CMake files
-- Required executable awk found at: /usr/bin/awk
-- Required executable git found at: /usr/bin/git
-- Required executable srec_cat found at: /usr/bin/srec_cat
-- Required executable objcopy found at: /usr/bin/objcopy
-- Required executable dasel found at: /usr/local/bin/dasel
-- Required executable sha256sum found at: /usr/bin/sha256sum
Generating MCU definitions...
Generating project MCU definitions...
Generating target definitions...
Generating HW test config...
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/paradajz/dev/toolchain/arduino-1.8.19/hardware/tools/avr/bin/avr-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/paradajz/dev/toolchain/arduino-1.8.19/hardware/tools/avr/bin/avr-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /home/paradajz/dev/toolchain/arduino-1.8.19/hardware/tools/avr/bin/avr-gcc
-- Configuring done (1.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/paradajz/dev/git/OpenDeck/build/mega2560
[88/89] Linking CXX executable application.elf
Memory region         Used Size  Region Size  %age Used
            text:       68966 B       256 KB     26.31%
            data:        5044 B      65024 B      7.76%
          eeprom:          0 GB        64 KB      0.00%
            fuse:          0 GB          3 B      0.00%
            lock:          0 GB         1 KB      0.00%
       signature:          0 GB         1 KB      0.00%
 user_signatures:          0 GB         1 KB      0.00%
Converting elf file to hex
Appending firmware metadata to hex file
Adding firmware CRC at the end of application flash
Converting hex file to bin
[89/89] Generating merged.hex, merged.bin
-- Merging all firmware binary files into a single hex file
-- Appending: /home/paradajz/dev/git/OpenDeck/build/mega2560/application.elf.hex
-- Converting mergex hex file to bin

Build process creates binaries in build directory. For instructions on how to flash compiled binary to the board, follow this page.

Clone this wiki locally