Notizbl0g.

h4cking, ham radio, fire fighting and m0re

Headless Building MMDVM Firmware

A while ago I was looking for a way to build the MMDVM firmware on a bare Debian Jessie system running on a Raspberry Pi. It has no X installed and thus I need a way to build the Arduino Due firmware without installing tons of GUI packages. I copied parts of a Makefile for the Arduino IDE as it is just executing command line binaries under the hood.

I added some support for building the MMDVM firmware using a Makefile to the github project a while ago. The only problem left was finding a way to “install” the Arduino IDE in command line mode.

Turns out that this is a realtively easy task. It is more or less downloading the package and install support for ARM Cortex M3 boards (as the Arduino Due is). Execution of the install.sh script contained in the directory is not needed (it only creates nice desktop icons). Instead you can directly execute the IDE in command line mode to install the SAM package.

I made a little bash script that should to all the tasks needed. Afterwards I could compile the MMDVM firmware for Arduino Due using “make -f Makefile.Arduino compile”.

The BASH script is:

#!/bin/bash

# Try to auto detect latest Arduino IDE version
FILE=$(wget "https://www.arduino.cc/en/Main/Software" -qO - | grep "arduino-[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}-linuxarm.tar.xz" | sed -e 's/.*\(arduino-.*-linuxarm\.tar\.xz\).*/\1/')

# Uncomment next line and set version manually if auto detection does not work
# FILE=arduino-1.8.2-linuxarm.tar.xz

if [ -z "$FILE" ]; then
      echo "Error detecting latest Arduino version."
         echo "Please set version manually!"
            exit 1
            fi

            DIR=$(echo $FILE | sed -e 's/-linuxarm\.tar\.xz//')

# Now get the Arduino IDE archive
wget "https://downloads.arduino.cc/$FILE" -O $FILE

# Extract the Arduino software
tar -xvf $FILE

# Install latest version for ARM M3 boards
cd $DIR
./arduino --install-boards "arduino:sam"

exit 0