Prepare to Build

If you want to compile your own build of CircuitPython, follow these steps instead

If you followed the Quick Start page and just want to load the latest build, you can skip this page and the next one as well and go straight to Testing!

We have an excellent guide that we maintain with details on how to build Circuitpython here:

https://learn.adafruit.com/building-circuitpython

There are a few differences for the CircuitPython build of nRF52 since we have to fetch special files from Nordic!

Sync your fork

nRF52 support is changing almost daily. If you are using the adafruit repo as your git repository dont forget to do a git pull.

If and only if you're working on a fork don't forget to

git pull --rebase upstream master
git push --force-with-lease origin master

Check your branch

There are various branches of work - the latest version may not be in master.

Prepare Build!

Here's things you only have to do once

Initialize submodules & mpy-cross

As documented here start with

Download: file
    cd circuitpython
git submodule sync
git submodule update --init --recursive
make -C mpy-cross
  

Download Nordic SoftDevice files

You then need to download the soft devices from Nordic, download the files by running:

Download: file
cd ports/nrf
./bluetooth/download_ble_stack.sh
This script relies on wget, which must be available from the command line.

You should see sucessful downloads and when done, you can list the *softdevice*hex's you downloaded - there may be a few different version numbers.

Install adafruit-nrfutil

OK now you're going to install our helper to program the firmware over the bootloader. Note that above we installed the software for burning the bootloader, but you'll only want to do that once and then just rely on the bootloader.

adafruit-nrfutil is on PyPI, and you can install it on the command line with

pip3 install --upgrade adafruit-nrfutil

nrfutil is requires Python 3 - So use pip3 and/or set up your python environment for v3
Verify you installed 0.5.3.post9 or later
This guide was first published on Aug 29, 2018. It was last updated on Aug 29, 2018. This page (Prepare to Build) was last updated on Dec 05, 2019.