Fetching contributors…
Cannot retrieve contributors at this time
59 lines (38 sloc) 3.13 KB

Build Architecture

The main purpose of this git repository is to build firmware for ARM Cortex-based microcontrollers. The main compiler is arm-none-eabi-gcc; however, there is some support for clang as well on some platforms (primarily Linux).

In addition, this repository supports host builds of key portions of the firmware. The intention here is to be able to test key portions of the logic (e.g. KLL) while using tools such as Python, gdb and memory monitors.

The goal of this document is to describe how code is constructed from the various parts and where to look for various components.

Build Process

  1. Construct a CMake build expression (generally by calling a build script).

  2. Scan selected modules using setup.cmake files.

    1. Each module may define multiple sub-modules.
    2. Sub-modules may have KLL files that are overridden by the overall KLL layout files.
    3. Some modules override weak symbols in sub-modules, this is common with Output Modules.
    4. Some modules define additional files to be generated (e.g. Python files for host builds).
  3. Run KLL compiler on all the scanned KLL files.

  4. Compile source files into binary.


Each type of build has files dedicated to it. ARM targets may have specific configurations depending on the vendor (e.g. Kinetis, SAM4S, etc.). Host builds require additional infrastructure in order to handle loading the generated shared library.

ARM Firmware Build Files

Here is a list of useful ARM specific files to consider.

  • Lib/CMake/arm.cmake - arm-none-eabi specific CMake build specifications.
  • Lib/CMake/kinetis.cmake - Kinetis ARM Cortex CMake build specifications.
  • Lib/CMake/nrf5.cmake - Nordic nRF5 ARM Cortex CMake build specifications.
  • Lib/CMake/sam.cmake - Microchip SAM ARM Cortex CMake build specifications.
  • Lib/kinetis.c/h - Kinetis ARM Cortex specific registers and functions.
  • Lib/nrf5.c/h - Nordic nRF5 ARM Cortex specific registers and functions.
  • Lib/sam.c/h - Microchip SAM ARM Cortex specific registers and functions.

Host Build Build Files

Useful files to consider when working with host builds.