Based on the documentation of BLE Secure DFU example, it supports on the BLE / ANT/Serial UART DFU.

This blog would mainly focus on the Serial (UART) DFU.  Inside the Nordic official example, it would use the nrfutil (written in Python script) as the host application for device firmware upgrade.

I would use another alternative host application (in C code, based on nRFutil 3.5 version) to show how to do the application FW upgrade only.  This example is tested at the SDK 15.2 under Window or Linux Ubuntu environment.


nrfutil is a Python package that includes the nrfutil command line utility and the nordicsemi library.


Here are the procedure how to run on the serial DFU on NRF SDK.

Step 1

Download the Nordic NRF5 15.2 SDK (http://developer.nordicsemi.com/nRF5_SDK/)

Step 2

Prepare the GCC compiler Install the GNU ARM Embedded compiler / Linker


For example,  this compiler is installed at C:\Tools\gcc-arm-none-eabi-7-2018-q2-update-win32

Modify the corresponding makefile inside the Nordic SDK (e.g. window — nRF5_SDK_15.2.0_9412b96\components\toolchain\gcc\Makefile.windows)

Step 3

Download / Compile the micro-ecc library (because secure DFU requires to use the micro-ecc 3rd party library)

Under Window:

  • Install the Chocolatey (Software Management Automation) 
  • Install the make package under chocolatey tool (run the command prompt terminal as administrator right)

  • Install the git at the terminal (recommended to use cmder terminal or download from choco install git)
  • Run the batch file (build_all.bat) under nRF5_SDK_15.2.0_9412b96\external\micro-ecc folder

Step 4

Generate the private key and public key (Make sure the version of nRFUtil is 3.5 if you are using the SDK 15.2 DFU,  nrfutil version)

You can download the pre-compiled execute file at https://github.com/NordicSemiconductor/pc-nrfutil/releases.  nRFUtil works on the Python 2.7.x currently.

@echo generate the private key
nrfutil keys generate demo_private.key

@echo generate the public_key from private key
nrfutil keys display --key pk --format code demo_private.key --out_file demo_public_key.c

Step 5

Update the public key at the bootloader project (dfu_public_key.c)

Recompile the bootloader (secure_bootloader\pca10040_uart_debug in this case) on the SES project file.

Step 6

Prepare two difference application firmware files and generate corresponding zip package for testing by using the private key.

nrfutil pkg generate --hw-version 52 --application-version 1 --application ble_app_uart_pca10040_s132_FW1.hex --sd-req 0xB7 --key-file demo_private.key app_uart_fw1.zip

nrfutil pkg generate --hw-version 52 --application-version 1 --application ble_app_uart_pca10040_s132_FW2.hex --sd-req 0xB7 --key-file demo_private.key app_uart_fw2.zip

The softdevice version (sd-req) can be found at nrfutil github (https://github.com/NordicSemiconductor/pc-nrfutil).

In this case, S132v6.1.1 (version 0xB7) is used. You can check the softdevice version at


Thanks for your interests on my blog. Since 2019, I have created this blog and shared the idea how to do some funny stuffs. I am very pleasure that I get quite a lot of positive feedback. I really hope that this blog helps your own embedded solution development. May I get support from you to keep it in order to maintain the wordpress host service? Your appreciation would be very helpful.