Nordic nRF52 firmware update example from secondary MPU
For details, see our blog post: https://blog.classycode.com/updating-the-firmware-on-an-nrf52-from-another-microcontroller-b513080dc0cd
- sdk/nRF5_SDK_15.2.0_9412b96
- toolchain/gcc-arm-none-eabi-7-2018-q2-update
The nRF52 SDK is available on the Nordic web site: https://www.nordicsemi.com/Software-and-tools/Software/nRF5-SDK/Download
To download the ARM toolchain, visit the ARM developer web site: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads
Patch the SDK:
$ patch -p0 < nrfx_uart.patch
Install the uECC library:
$ pushd sdk/nRF5_SDK_15.2.0_9412b96/external/micro-ecc
$ export GNU_INSTALL_ROOT="$PWD/../../../../toolchain/gcc-arm-none-eabi-7-2018-q2-update/bin/"
$ git clone https://github.com/kmackay/micro-ecc.git
$ make -C nrf52hf_armgcc/armgcc
$ make -C nrf52nf_armgcc/armgcc
$ popd
$ cd 02_Bootloader
$ make clean
$ make
$ make hex
$ make flash_hex
A serial console connected to the nrf52 should now display @@BOOTLOADER
$ cd ..
$ cd 01_Demo_App
$ make clean
$ make v1
$ cd dfu_zip
$ make clean
$ make v1
$ make dfu <-- replace the serial device in the Makefile first!
$ cd ..
$ cd 01_Demo_App
$ make clean
$ make v2
$ cd dfu_zip
$ make clean
$ make v2
$ cp app_dfu_package.zip /tmp
$ pushd /tmp
$ unzip app_dfu_package.zip
$ popd
$ cd ../..
$ cd 05_Firmware_Converter
$ gcc fwconvert.c
$ ./a.out /tmp/nrf52832_xxaa.bin dfu_firmware_bin.h gFirmwareBin
$ ./a.out /tmp/nrf52832_xxaa.dat dfu_firmware_dat.h gFirmwareDat
$ cd ..
$ cd 04_Demo_Host_Application
$ cp ../05_Firmware_Converter/dfu_firmware_bin.h .
$ cp ../05_Firmware_Converter/dfu_firmware_dat.h .
$ make
Press the button on the target board to trigger the DFU process.
$ ./fwu "/dev/tty.usbserial-DN009NQG" 57600 <-- configure for your serial device