Skip to content

Compiling The Project

Alex Rogers edited this page Nov 21, 2024 · 27 revisions

The AudioMoth library and example application in this repository can be downloaded and compiled using simple command line tools.

Building From The Command Line

The project contains a build folder with a Makefile and linker script to build the firmware from the command line in macOS, Linux or within the Windows Subsystem for Linux.

To use this approach first download the required GNU Arm Embedded Toolchain. Current and previous versions for all operating systems are available here, and even older versions are available here.

We typically use multiple versions of this toolchain and thus we link to the appropriate version within the Makefile rather than adding its executables to PATH. To do so, save the extracted toolchain somewhere convenient, and then update the Makefile to determine the location and version.

# Set the toolpath parameter to the location of the GNU Arm Embedded Toolchain

TOOLCHAIN_PATH = /Library/Toolchains/

TOOLCHAIN_VERSION = gcc-arm-none-eabi-10.3-2021.10

# Determine the path to the toolchain binary

TOOLPATH = $(TOOLCHAIN_PATH)/$(TOOLCHAIN_VERSION)/bin/

We currently build all standard AudioMoth releases using version gcc-arm-none-eabi-10.3-2021.10.

> make

If running on macOS, the first time you run this command you will be issued with a sequence of security warnings as each of the sub-programs (the actual compiler and the linker) are executed. Each time, you will need to allow the program in the 'Security and Privacy' controls within the System Preferences, and then re-run the command. You only need to do this once the first time you execute the command.

You can remove the resulting binary file and the object files that were created using:

> make clean

The Makefile tracks dependencies appropriately and will only re-compile files that have been changed, or whose dependencies have changed, since the audiomoth.bin binary file was created.

You can use the AudioMoth Flash App to write the firmware to an AudioMoth device.

Clone this wiki locally