mirror of
https://github.com/oltaco/Adafruit_nRF52_Bootloader_OTAFIX.git
synced 2026-10-22 21:54:10 +00:00
Merge pull request #354 from andreaskurz/askz/fix-cmake-build
fix: CMake build producing too large binaries
This commit is contained in:
2 files changed
+51
-3
No files matched your search
+13
-2
@@ -34,6 +34,10 @@ set(TINYUSB_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb/src)
|
||||
set(UF2CONV_PY ${CMAKE_CURRENT_LIST_DIR}/lib/uf2/utils/uf2conv.py)
|
||||
set(UF2_FAMILY_ID_BOOTLOADER 0xd663823c)
|
||||
|
||||
if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
|
||||
endif ()
|
||||
|
||||
#-------------------
|
||||
# Bootloader
|
||||
#-------------------
|
||||
@@ -131,7 +135,6 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_include_directories(bootloader PUBLIC
|
||||
lib/SEGGER_RTT/RTT
|
||||
)
|
||||
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
CFG_DEBUG
|
||||
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
@@ -175,6 +178,7 @@ target_compile_options(bootloader PUBLIC
|
||||
)
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
SOFTDEVICE_PRESENT
|
||||
CONFIG_GPIO_AS_PINRESET
|
||||
)
|
||||
|
||||
if (TRACE_ETM STREQUAL "1")
|
||||
@@ -333,4 +337,11 @@ add_custom_target(flash-mbr
|
||||
|
||||
add_custom_target(flash-erase
|
||||
COMMAND ${NRFJPROG} -f nrf52 --eraseall
|
||||
)
|
||||
)
|
||||
|
||||
# flash skip crc magic ( app valid = 0x0001, crc = 0x0000 )
|
||||
#add_custom_target(flash-skip-crc
|
||||
# #COMMAND ${NRFJPROG} --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f nrf52
|
||||
# COMMAND ${NRFJPROG} --memwr 0xFF000 --val 0x00000001 -f nrf52
|
||||
# #COMMAND ${NRFJPROG} --memwr 0x7F000 --val 0x00000001 -f nrf52
|
||||
# )
|
||||
@@ -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 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,37 @@ 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}`:
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBOARD=feather_nrf52840_express
|
||||
```
|
||||
|
||||
And then build it with:
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
You can also use the generator of your choice. For example adding the `-GNinja` and then you can invoke `ninja build` instead of `make`.
|
||||
|
||||
To list all supported targets, run:
|
||||
|
||||
```bash
|
||||
cmake --build . --target help
|
||||
```
|
||||
|
||||
To build individual targets, you can specify it directly with `make` or using `cmake --build`:
|
||||
|
||||
```bash
|
||||
make bootloader
|
||||
cmake --build . --target bootloader
|
||||
```
|
||||
|
||||
### Flash
|
||||
|
||||
To flash the bootloader (without softdevice/mbr) using JLink:
|
||||
|
||||
Reference in new issue
Block a user