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.
-
Construct a CMake build expression (generally by calling a build script).
-
Scan selected modules using
setup.cmake
files.- Each module may define multiple sub-modules.
- Sub-modules may have KLL files that are overridden by the overall KLL layout files.
- Some modules override weak symbols in sub-modules, this is common with Output Modules.
- Some modules define additional files to be generated (e.g. Python files for host builds).
-
Run KLL compiler on all the scanned KLL files.
-
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.
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.
Useful files to consider when working with host builds.
- Lib/CMake/host.cmake - Host build CMake build specifications.
- Lib/host.c/h - Host specific registers and functions.
- Lib/host.py - General host specific Python library.
- Scan/TestIn/host.py - TestIn Scan module Python library.
- Scan/TestIn/interface.py - Build template that defines where to locate all the host Python libraries.
- Scan/TestIn/setup.cmake - Defines which Python files to template into the build.
- Scan/TestIn/Tests/common.py - Common test library for host-side tests.
- Output/TestOut/host.py - TestOut Output module Python library.