Module Core Software Guide

The Module Core uses the STM32F407ZET6 Cortex-M4 processor, and can be programmed either via the onboard Tag-Connect port, or an application-specific expansion board. While any software setup compatible with this microcontroller can be used, we provide libraries and programming scripts in our embedded software repository to make it easy to program the Module Core.

Developing with the standard libraries

The standard libraries contains software designed to allow easy access to all hardware functionality. The structure of the repository is described in the sections below. All paths are referenced to the root of the repository.

Additive Robotics library

The Additive Robotics library, located in common/ar_lib provides convenient c++ interfaces to the underlying hardware, as well as drivers for external devices commonly connected to a Module Core. It also supplies expansion-board-specific classes for easy software development when using standard hardware.

Board-specific application classes

The common/ar_lib/include/boards directory contains classes that tailor the software to specific board hardware. The most basic application class is the CoreApplication, which works with the Module Core hardware. All other board classes subclass from the CoreApplication, adding functionality specific to an expansion board’s hardware.

The easiest way to use the library is through these board-specific application classes. Using a subclass of the appropriate application for your hardware ensures that the applicable peripherals and drivers are available and correctly configured for the hardware. Examples using this method are available in the examples directory.

Peripheral classes

The peripheral classes (common/ar_lib/include/peripherals) are c++ wrappers that interface to STM32F407 peripherals, including digital and analog pin I/O, as well as communication busses.

Driver classes

The driver classes (common/ar_lib/include/drivers) use the peripherals to interface to specific external hardware. This includes interfaces to things like motor submodules, servos, and sensors.

Management singletons and other utilities

The Additive Robotics library also provides many utilities (common/ar_lib/include/utils) for easier software development. These include a “loop manager” useful for creating multiple fixed-rate periodic loops, a “time manager” that manages the system clock, an “interrupt manager” that handles all interrupts, and template-based function pointers to link them together.

Low-level drivers

The lowest-level access to the hardware is provided via CMSIS and STM HAL, in the common/cmsis and common/stm32f4xx directories respectively. This software provides register-level access to the hardware (basically as fine-grained of control as you can get) for when the other libraries do not allow for sufficient customization. The Additive Robotics library is built on top of these low-level drivers.


The common/scripts directory provides scripts useful for programming / debugging the Module Core. This includes a linker script, a generic Makefile, and configuration files for OpenOCD. These scripts can be used as-is (see the Projects section below), or can be modified for custom applications.

External libraries

The repository also contains several other libraries that may be useful for application development. The first is the ARM Digital Signal Processing library (common/dsp_lib), which provides code that efficiently performs DSP operations like signal filtering and FFTs. The second is FreeRTOS, (common/free_rtos), which provides threads, semaphores, and other operating-system constructs. The last is LwIP, which is useful for generating custom network packets for use with the Ethernet interface.


The examples directory contains example code for using the Module Core with most of the PRLS hardware. Visit the PRLS examples page for more information on what each project does.


The projects directory is where user-developed projects are stored. Create a new project, run

./make_new_project [NewProjectName]

from within the projects directory. The script will generate a new directory “new_project_name” under projects, with source / header files for the class “NewProjectName.” The project should compile as is (see instructions below), and should cause the status LEDs to flash at 1hz (on for half a second, off for half a second) when executed.

Programming the Module Core

Command line

To compile the code, run


in the project directory. To compile and then load or debug the code, run

make load


make debug

Note that both of these options will not automatically start the program. If the load command is used, the program can be started by pressing the reset button on the module core. If the debug command is used, a command-line debugger (GDB) will be launched, from which the program can be started. Common GDB commands can be found in this cheat sheet.

Note that loading and debugging the code will require the Module Core to be connected to the computer via the USB programming hardware.


Program loading / execution can also be done using Eclipse CDT along with the GNU ARM Eclipse plugin. Instructions for setting up the GNU ARM Eclipse plugin can be found here. Once configured, you should be able to import the program into eclipse as an existing C++ makefile program. You can then debug the program by adding a new OpenOCD debugging configuration, using “-f ../../common/scripts/board.cfg” for the config options of the debugging configuration.

Note that loading and debugging the code will require the Module Core to be connected to the computer via the USB programming hardware.