chore: add documentation for CMake

In this repository CMake and Make co-exists. Unfortunately there was no
documentation on how to properly use CMake so this is a starting point.

Signed-off-by: Andreas Kurz <info@akurz.net>
This commit is contained in:
Andreas Kurz 2025-05-09 10:31:05 +02:00
parent 73020f3567
commit ddcb2dba8c
No known key found for this signature in database
GPG key ID: 5C2FD457001654DD

View file

@ -114,14 +114,20 @@ You must have have a J-Link available to "unbrick" your device.
### Build:
Firstly clone this repo with following commands
Firstly clone this repo including its submodules with following command:
```
git clone --recurse-submodules -j8 https://github.com/adafruit/Adafruit_nRF52_Bootloader
```
For git versions before `2.13.0` you have to do that manually:
```
git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
cd Adafruit_nRF52_Bootloader
git submodule update --init
```
#### Build using `make`
Then build it with `make BOARD={board} all`, for example:
```
@ -137,6 +143,21 @@ Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
Makefile:90: *** BOARD not defined. Stop
```
#### Build using `cmake`
Firstly initialize your build environment by passing your board to `cmake` via `-DBOARD={board}`:
```
cmake -DBOARD=feather_nrf52840_express -S . -B _build -GNinja
```
And then build it with:
```
cd _build
ninja
```
You can also use the generator of your choice. For example omit the `-GNinja` and then you can invoke `make` from inside `_build` instead of `ninja`
### Flash
To flash the bootloader (without softdevice/mbr) using JLink: