Building & Programming
Note: This is if you want to use Circuit Dojo's Zephyr Tools extension.
Building
In VSCode you can build a project with the
Zephyr Tools: Build
or
Zephyr Tools: Build Pristine
commands.
You can also build manually by running this in your application root:
west build -b circuitdojo_feather_nrf9151/nrf9151/ns -p -d build/circuitdojo_feather_nrf9151 --sysbuild
Note: the board target name has changed in NCS 2.7 for usage with west it's now: circuitdojo_feather_nrf9151/nrf9151/ns
Programming
probe-rs
While not required, it's recommended to have the rust toolchain installed before you install probe-rs. Install rustup first by following the instructions here. This is useful for installing probe-rs and other Rust tools from source.
To install use:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/probe-rs/probe-rs/releases/latest/download/probe-rs-tools-installer.sh | sh
You will also need to set up udev rules on Linux. See here for more info.
For the nRF9160, you can program using:
probe-rs download --chip nRF9160_xxAA --binary-format hex path/to/merged.hex
For the nRF9151, you can program using:
probe-rs download --chip nRF9151_xxAA --binary-format hex path/to/merged.hex
And once the probe-rs runner has made its way to NCS:
west flash --runner probe-rs
More info on probe-rs can be found on their website.
Securing the Bootloader
By default, MCUboot uses a built-in signing key that is not secure. You'll see this warning during build:
WARNING: Using default MCUboot signing key file, this file is for debug use only and is not secure!
To deliver secure over-the-air updates, you need to generate your own signing key. Here's the process:
-
Generate an ECDSA-P256 key using
imgtool:pip install imgtool imgtool keygen -k your-signing-key.pem -t ecdsa-p256 -
Place the
.pemfile in your application root directory (next toprj.conf). -
In your
sysbuild.conf, point to the key file:SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="${APPLICATION_CONFIG_DIR}/your-signing-key.pem" -
Then start a pristine build using west:
west build -b circuitdojo_feather_nrf9151/nrf9151/ns -p --sysbuildMake sure you're building with
--sysbuildor have it enabled in the VSCode extension (on by default).
A pristine build should happen before releasing so the version data is up to date. For newer versions of the SDK, the update artifact is located at build/dfu_application.zip instead of app_update.bin.
It's critical not to lose your-signing-key.pem as it's the key for (secure) OTA updates to succeed.