@@ -268,6 +268,7 @@ ifdef USE_BOOTLOADER
268268ifdef 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
271272ifdef BOOTLOADER_ASFLAGS
272273 ASFLAGS += $(BOOTLOADER_ASFLAGS )
273274endif
@@ -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
391392INCLUDE += \
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
395397else
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
396405INCLUDE += \
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
399419endif
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
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)
547565else
548566 nrfutil pkg generate $(PROJ_NAME).zip --application $(PROJ_NAME)_app.hex $(DFU_SETTINGS) --key-file $(DFU_PRIVATE_KEY)
549567endif
0 commit comments