所需文件已经编译完毕,直接放入指定目录。
**\nRF5_SDK_17.0.2_d674dde\external\micro-ecc
micro-ecc.rar
BootLoader工程位置
xx\nRF5_SDK_17.0.2_d674dde\examples\dfu\secure_bootloader
使用keil编译完成后,直接烧录,是无法运行的,因为[mbr_nrf52_2.4.1_mbr.hex]引导文件没有烧录。
xx\nRF5_SDK_17.0.2_d674dde\components\softdevice\mbr\hex\mbr_nrf52_2.4.1_mbr.hex
将文件复制到工程根目录
写一个脚本,命名[program.bat]
@echo off
@echo eraseall
nrfjprog --eraseall
@echo program boot.hex
nrfjprog --program .\out\nrf52_boot_usb_dfu.hex --verify
@echo program mbr_nrf52_2.4.1_mbr.hex
nrfjprog --program .\mbr_nrf52_2.4.1_mbr.hex --verify
@echo reset chip
nrfjprog --reset
=====================================================
APP部分,如何一次性烧录boot+mbr+app
- 生成settings文件
- 合并3个hex文件(boot+settings+app)
- 擦除芯片
- 烧录合并文件
- 烧录mbr_nrf52_2.4.1_mbr.hex
- 复位芯片
脚本如下:
@echo off
set app_hex=%1
set nrf_tool_path=..\..\..\..\tool\nrf_tool\nrf-command-line-tools
set nrf_tool_path1=..\..\..\..\tool\nrf_tool\
set nrf_boot_path=..\nrf52_boot\out\nrf52_boot_usb_dfu.hex
@echo nrfutil settings generate
%nrf_tool_path1%\nrfutil settings generate --family NRF52QFAB --application .\out\%app_hex%.hex --application-version 0 --bootloader-version 0 --bl-settings-version 2 ..\dfu\settings.hex
@echo merge file
%nrf_tool_path%\mergehex -m %nrf_boot_path% ..\dfu\settings.hex .\out\%app_hex%.hex -o ..\dfu\prog.hex
@echo eraseall
%nrf_tool_path%\nrfjprog --eraseall
@echo program prog.hex
%nrf_tool_path%\nrfjprog --program ..\dfu\prog.hex --verify
@echo program mbr_nrf52_2.4.1_mbr.hex
%nrf_tool_path%\nrfjprog --program ..\dfu\mbr_nrf52_2.4.1_mbr.hex --verify
@echo reset chip
%nrf_tool_path%\nrfjprog --reset