Skip to content

Setting up a build environment

Prerequisites

In order to build programs with CODAL, you will need the following programs on your computer. They are available on Windows, Mac OS and Linux.

Note

If you're on Linux, you can likely install these directly with your package manager.

Program Purpose Link
git To fetch our repositories. http://www.git-scm.com/
cmake This will configure your builds. https://cmake.org/
ninja This interfaces with CMake to configure builds. https://ninja-build.org/
arm-none-eabi This will build your programs. https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/

Downloading the base project

micro:bit provides a base project which you can use to make programs. You need simply clone it via git. If you've not used git before, use the HTTPS variant.

Execute one of the following command in your terminal, command prompt, or equivalent:

Method Command
HTTPS git clone https://github.com/lancaster-university/microbit-v2-samples.git
SSH git clone git@github.com:lancaster-university/microbit-v2-samples.git
GH CLI gh repo clone lancaster-university/microbit-v2-samples

Building with "build.py"

There is a Python script in the main directory which will build your program for you.

Requires Python

This requires a Python 3 installation. See here if you don't have one.

Simply run python build.py in the root of the project and your outputted hex will be placed in the same folder.

Building with VS Code

Alternatively, you can build directly from VS Code.

Learn to use VS Code with CODAL

You're all set

You're ready to start programming the micro:bit.

Write and build your first program