-
Notifications
You must be signed in to change notification settings - Fork 151
How to Build the Firmware Samples
Each firmware sample in the code/nrf-connect/ directory is a nRF Connect SDK project.
This is the usual way of building the nRF Connect SDK samples. The only caveat is that, for each sample here, you also need to add the code/nrf-connect/prstlib/
directory to your workspace in addition to the sample directory itself. The prstlib/
contains common source code for reading sensors and also common board definitions. There is a .code-workspace
file inside each sample that does this automatically.
We support different nRF52 SoCs in different hardware versions, and you can select them as normally done in the nRF Connect VSCode extension:
For example, let's build the ble
sample for the nRF52840
, revision 2.0.0
.
From the repo's root directory:
docker run --rm -v ${PWD}:/repo nordicplayground/nrfconnect-sdk:v2.5-branch west build --pristine --board [email protected] --build-dir /repo/code/nrf-connect/samples/ble/build /repo/code/nrf-connect/samples/ble
The output will be in code/nrf-connect/samples/ble/build/zephyr/zephyr.hex
. To build other samples, replace ble
with the other sample's name.
GitHub Codespaces let you run an instance of VS Code directly in your browser. More importantly, it also supports plugins, including nRF Connect for VS Code! This PR introduces .devcontainer/devcontainer.json
, which configures a Codespace with both the nRF VS Code plugin, as well as the whole nRF Connect SDK + toolchain. This lets you edit code and build the sample straight in your browser.
- Go to Codespaces and click "New codespace"
- Select
rbaron/b-parasite
, branchnrf-connect
- Wait. The underlying Docker image is pretty big and the build might fail. It worked on the second try for me
- Once the codespace is ready, navigate to
code/nrf-connect/samples/ble
, selectble.code-workspace
and click on "Open workspace". This makes sure both theble
sample and theprstlib
are present in the workspace - Build the sample normally, as described in the nRF Connect SDK docs
- Download the built sample from
ble/build/zephyr/zephyr.hex