Skip to content

Instantly share code, notes, and snippets.

@hieuv
Created August 31, 2023 15:04
Show Gist options
  • Save hieuv/c57d5a9ba158c6fda385bcfe80e19395 to your computer and use it in GitHub Desktop.
Save hieuv/c57d5a9ba158c6fda385bcfe80e19395 to your computer and use it in GitHub Desktop.
Generate bootloader settings and generate merged hex file in nRF5 SDK DFU work
@set app_hex=C:\_AAA\nRF5_SDK_17.1.0_ddde560\_AAA\_AAA\project\ble_app_buttonless_dfu\pca10040\s132\ses\Output\Debug\Exe\ble_app_buttonless_dfu_pca10040_s132.hex
@set bl_hex=C:\_AAA\nRF5_SDK_17.1.0_ddde560\_AAA\_AAA\secure_bootloader\pca10040_uart_debug\ses\Output\Release\Exe\secure_bootloader_uart_mbr_pca10040_debug.hex
@set sd_hex=C:\_AAA\nRF5_SDK_17.1.0_ddde560\components\softdevice\s132\hex\s132_nrf52_7.2.0_softdevice.hex
@call :CheckExist %app_hex% || exit
@call :CheckExist %bl_hex% || exit
@call :CheckExist %sd_hex% || exit
nrfutil settings generate --family NRF52 --application %app_hex% --application-version 0 --bootloader-version 0 --bl-settings-version 1 bootloader_setting.hex
mergehex --merge %app_hex% %bl_hex% %sd_hex% .\bootloader_setting.hex --output merged_sd_bl_app_blsettings.hex
@REM nrfjprog --program merged_sd_bl_app_blsettings.hex --chiperase
@exit
:CheckExist
@REM echo %~1
@if exist %~1 (
echo CheckExist OK
@exit /B 0
) else (
echo CheckExist ERROR cannot find %~1
@exit /B -1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment