File tree Expand file tree Collapse file tree 2 files changed +51
-3
lines changed Expand file tree Collapse file tree 2 files changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ set(TINYUSB_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb/src)
3434set (UF2CONV_PY ${CMAKE_CURRENT_LIST_DIR} /lib/uf2/utils/uf2conv.py)
3535set (UF2_FAMILY_ID_BOOTLOADER 0xd663823c)
3636
37+ if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "" )
38+ set (CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
39+ endif ()
40+
3741#-------------------
3842# Bootloader
3943#-------------------
@@ -131,7 +135,6 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
131135 target_include_directories (bootloader PUBLIC
132136 lib/SEGGER_RTT/RTT
133137 )
134-
135138 target_compile_definitions (bootloader PUBLIC
136139 CFG_DEBUG
137140 SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
@@ -175,6 +178,7 @@ target_compile_options(bootloader PUBLIC
175178 )
176179target_compile_definitions (bootloader PUBLIC
177180 SOFTDEVICE_PRESENT
181+ CONFIG_GPIO_AS_PINRESET
178182 )
179183
180184if (TRACE_ETM STREQUAL "1" )
@@ -333,4 +337,11 @@ add_custom_target(flash-mbr
333337
334338add_custom_target (flash-erase
335339 COMMAND ${NRFJPROG} -f nrf52 --eraseall
336- )
340+ )
341+
342+ # flash skip crc magic ( app valid = 0x0001, crc = 0x0000 )
343+ #add_custom_target(flash-skip-crc
344+ # #COMMAND ${NRFJPROG} --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f nrf52
345+ # COMMAND ${NRFJPROG} --memwr 0xFF000 --val 0x00000001 -f nrf52
346+ # #COMMAND ${NRFJPROG} --memwr 0x7F000 --val 0x00000001 -f nrf52
347+ # )
Original file line number Diff line number Diff line change @@ -114,14 +114,20 @@ You must have have a J-Link available to "unbrick" your device.
114114
115115### Build:
116116
117- Firstly clone this repo with following commands
117+ Firstly clone this repo including its submodules with following command:
118118
119+ ```
120+ git clone --recurse-submodules https://github.com/adafruit/Adafruit_nRF52_Bootloader
121+ ```
122+
123+ For git versions before `2.13.0` you have to do that manually:
119124```
120125git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
121126cd Adafruit_nRF52_Bootloader
122127git submodule update --init
123128```
124129
130+ #### Build using `make`
125131Then build it with `make BOARD={board} all`, for example:
126132
127133```
@@ -137,6 +143,37 @@ Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
137143Makefile:90: ** * BOARD not defined. Stop
138144```
139145
146+ #### Build using `cmake`
147+
148+ Firstly initialize your build environment by passing your board to `cmake` via `-DBOARD={board}`:
149+
150+ ```bash
151+ mkdir build
152+ cd build
153+ cmake .. -DBOARD=feather_nrf52840_express
154+ ```
155+
156+ And then build it with:
157+
158+ ``` bash
159+ make
160+ ```
161+
162+ You can also use the generator of your choice. For example adding the ` -GNinja ` and then you can invoke ` ninja build ` instead of ` make ` .
163+
164+ To list all supported targets, run:
165+
166+ ``` bash
167+ cmake --build . --target help
168+ ```
169+
170+ To build individual targets, you can specify it directly with ` make ` or using ` cmake --build ` :
171+
172+ ``` bash
173+ make bootloader
174+ cmake --build . --target bootloader
175+ ```
176+
140177### Flash
141178
142179To flash the bootloader (without softdevice/mbr) using JLink:
You can’t perform that action at this time.
0 commit comments