Skip to content

Commit ebf1522

Browse files
committed
build tweaks for trying to get a working SDK17 bootloader
1 parent bf293ba commit ebf1522

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

make/common/NRF5X.make

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ ifdef USE_BOOTLOADER
268268
ifdef BOOTLOADER
269269
DEFINES += -DBOOTLOADER -DNRF_DFU_SETTINGS_VERSION=1
270270
DEFINES += $(BOOTLOADER_DEFINES)
271+
DFU_BOOTLOADER_SETTINGS ?= --bootloader-version 0xff --hw-version 52 --sd-req 0x8C,0x91
271272
ifdef BOOTLOADER_ASFLAGS
272273
ASFLAGS += $(BOOTLOADER_ASFLAGS)
273274
endif
@@ -341,7 +342,6 @@ else # !NRF5X_SDK_12
341342
-I$(ROOT)/gen \
342343
-I$(ROOT)/src \
343344
-I$(ROOT)/targets/nrf5x_dfu \
344-
-I$(ROOT)/targets/nrf5x_dfu/sdk15 \
345345
-I$(NRF5X_SDK_PATH)/external/micro-ecc \
346346
-I$(NRF5X_SDK_PATH)/components/libraries/sha256 \
347347
-I$(NRF5X_SDK_PATH)/components/libraries/crypto/backend/micro_ecc \
@@ -387,26 +387,44 @@ else # !NRF5X_SDK_12
387387
-I$(NRF5X_SDK_PATH)/external/nano-pb \
388388
-I$(NRF5X_SDK_PATH)/components/libraries/queue \
389389
-I$(NRF5X_SDK_PATH)/components/libraries/experimental_memobj
390-
ifdef NRF5X_SDK_15_3
390+
ifdef NRF5X_SDK_17
391+
DEFINES += -DPB_FIELD_16BIT=1
391392
INCLUDE += \
393+
-I$(ROOT)/targets/nrf5x_dfu/sdk17 \
392394
-I$(NRF5X_SDK_PATH)/components/libraries/crypto/backend/optiga \
393395
-I$(NRF5X_SDK_PATH)/components/libraries/log \
394396
-I$(NRF5X_SDK_PATH)/components/libraries/log/src
395397
else
398+
ifdef NRF5X_SDK_15_3
399+
INCLUDE += \
400+
-I$(ROOT)/targets/nrf5x_dfu/sdk15 \
401+
-I$(NRF5X_SDK_PATH)/components/libraries/crypto/backend/optiga \
402+
-I$(NRF5X_SDK_PATH)/components/libraries/log \
403+
-I$(NRF5X_SDK_PATH)/components/libraries/log/src
404+
else # NRF5X_SDK_15
396405
INCLUDE += \
406+
-I$(ROOT)/targets/nrf5x_dfu/sdk15 \
397407
-I$(NRF5X_SDK_PATH)/components/libraries/experimental_log \
398408
-I$(NRF5X_SDK_PATH)/components/libraries/experimental_log/src
409+
endif
410+
endif
411+
ifdef NRF5X_SDK_17
412+
TARGETSOURCES += \
413+
$(NRF5X_SDK_PATH)/components/libraries/timer/drv_rtc.c \
414+
$(NRF5X_SDK_PATH)/components/libraries/timer/app_timer2.c
415+
else
416+
TARGETSOURCES += \
417+
$(NRF5X_SDK_PATH)/components/libraries/timer/experimental/drv_rtc.c \
418+
$(NRF5X_SDK_PATH)/components/libraries/timer/experimental/app_timer2.c
399419
endif
400420
TARGETSOURCES += \
401421
$(NRF5X_SDK_PATH)/external/micro-ecc/uECC.c \
402422
$(NRF5X_SDK_PATH)/components/libraries/sha256/sha256.c \
403423
$(NRF5X_SDK_PATH)/components/libraries/crypto/backend/nrf_sw/nrf_sw_backend_hash.c \
404424
$(NRF5X_SDK_PATH)/components/libraries/util/app_error_weak.c \
405425
$(NRF5X_SDK_PATH)/components/libraries/scheduler/app_scheduler.c \
406-
$(NRF5X_SDK_PATH)/components/libraries/timer/experimental/app_timer2.c \
407426
$(NRF5X_SDK_PATH)/components/libraries/util/app_util_platform.c \
408427
$(NRF5X_SDK_PATH)/components/libraries/crc32/crc32.c \
409-
$(NRF5X_SDK_PATH)/components/libraries/timer/experimental/drv_rtc.c \
410428
$(NRF5X_SDK_PATH)/components/libraries/mem_manager/mem_manager.c \
411429
$(NRF5X_SDK_PATH)/components/libraries/util/nrf_assert.c \
412430
$(NRF5X_SDK_PATH)/components/libraries/atomic_fifo/nrf_atfifo.c \
@@ -518,7 +536,7 @@ $(PROJ_NAME).hex: $(PROJ_NAME).app_hex
518536
else
519537
@echo Merging SoftDevice and Bootloader
520538
@# build a DFU settings file we can merge in... family can be NRF52840 or NRF52
521-
nrfutil settings generate --family $(BOOTLOADER_SETTINGS_FAMILY) --application $(PROJ_NAME).app_hex --app-boot-validation VALIDATE_GENERATED_CRC --application-version 0xff --bootloader-version 0xff --bl-settings-version 2 $(OBJDIR)/dfu_settings.hex
539+
nrfutil settings generate --family $(BOOTLOADER_SETTINGS_FAMILY) --application $(PROJ_NAME).app_hex --app-boot-validation VALIDATE_GENERATED_CRC --application-version 0x01 --bootloader-version 0x01 --bl-settings-version 2 $(OBJDIR)/dfu_settings.hex
522540
@echo FIXME - had to set --overlap=replace
523541
python scripts/hexmerge.py --overlap=replace $(SOFTDEVICE) $(NRF_BOOTLOADER) $(PROJ_NAME).app_hex $(OBJDIR)/dfu_settings.hex -o $(PROJ_NAME).hex
524542
endif
@@ -542,8 +560,8 @@ else
542560
@echo Creating DFU ZIP
543561
# nrfutil pkg generate --help
544562
@cp $(PROJ_NAME).app_hex $(PROJ_NAME)_app.hex
545-
ifdef BOOTLOADER
546-
nrfutil pkg generate $(PROJ_NAME).zip --bootloader $(PROJ_NAME)_app.hex --bootloader-version 0xff --hw-version 52 --sd-req 0x8C,0x91 --key-file $(DFU_PRIVATE_KEY)
563+
ifdef BOOTLOADER
564+
nrfutil pkg generate $(PROJ_NAME).zip --bootloader $(PROJ_NAME)_app.hex $(DFU_BOOTLOADER_SETTINGS) --key-file $(DFU_PRIVATE_KEY)
547565
else
548566
nrfutil pkg generate $(PROJ_NAME).zip --application $(PROJ_NAME)_app.hex $(DFU_SETTINGS) --key-file $(DFU_PRIVATE_KEY)
549567
endif

0 commit comments

Comments
 (0)