download hex files by nrfjprog.exe

From: HERE

Hi

I have successfully merged softdevice S110 7.0.0, the bootloader from nRF51 SDK 6.1.0, and application from SDK 6.1.0 with using the mergehex.exe tool. Additionally, the attached app_valid_setting_apply.hex file must be merged into the final .hex file to create valid bootloader settings. The mergehex.exe tool can only merge two files at a time, so you need to merge three times in order to merge together the four .hex files. The procedure is:

  • Merge softdevice and bootloader: mergehex -m s110_nrf51822_7.0.0_softdevice.hex bootloader.hex -o SD_BL.hex
  • Merge softdevice+bootloader and application: mergehex -m SD_BL.hex ble_app_hrs_dfu.hex -o SD_BL_APP.hex
  • Merge softdevice+bootloader+application and bootloader settings file: mergehex -m SD_BL_APP.hex app_valid_setting_apply.hex -o SD_BL_APP_Settings.hex

I attach the files that I merged to gether:

app_valid_setting_apply.hex
ble_app_hrs_dfu.hex
bootloader.hex
s110_nrf51822_7.0.0_softdevice.hex

The following steps are:

  • Erase the nRF51 chip: nrfjprog --eraseall
  • Program the merged file: nrfjprog --program SD_BL_APP_Settings.hex
  • Then power-reset the device
  • or combine all three above into one command: nrfjprog --eraseall --program SD_BL_APP_Settings.hex --pinreset

Now the nRF51 device should be advertising as Nordic_HRM. Press Button_7 on the nRFgo motherboard while power-resetting in order to enable bootloader mode, or enable bootloader mode from the central device (buttonless) with the procedure described here in the "Testing" section.

Update 5.12.2014 for gcc compiler If using gcc to compile the bootloader and application the above method will not work. The gcc compiler writes the .hex files a little differently than the Keil compiler. The best method to merge the files when compiling with gcc is to merge the softdevice, bootloader and application with mergehex and then manually add the contents of the app_valid_settings_apply.hex file into the softdevice+bootloader+application merged file. Actually, only line 2 should be copied from app_valid_settings_apply.hex into the correct location of the merged file as shown in the image below:

image description

The "FC00" code in the selected line in the image above represents the flash address the data is written to (see intel hex format) and you should replace the line with the same "FC00" address code in the merged file.

Update 5.12.2014 for 128kB flash (QFAB) nRF51x22QFAB chips have 128kB flash and the above method will not work for those chips. Included below is a new setting file that works for 128kB flash and the bootloader provided on this thread for 128kB nRF51 chips. I include also the other hex files I used for the merge and the three output files. The ble_app_hrs_dfu_16kB.hex is the heart rate example with DFU service, compressed to take only 16 kB. If not compressed, it will take 25kB and will therefore not fit in the application space for the 128kB chip.

app_valid_setting_apply_QFAB.hex
ble_app_hrs_dfu_16kB.hex
bootloader_QFAB.hex
s110_nrf51822_7.0.0_softdevice.hex
SD_BL_APP_QFAB.hex
SD_BL_APP_Settings_QFAB.hex
SD_BL_QFAB.hex

Update 20.4.2015 Flash files seperately It is also possible to upload the files separately without merging them. Flash it in the following order:

s110_nrf51822_7.0.0_softdevice.hex
bootloader.hex
ble_app_hrs_dfu.hex
app_valid_setting_apply.hex

Update 20.4.2015 for softdevice 8 This also works with the same app_valid_setting_apply.hex file for softdevice 8 if you flash first S110 v8 and the bootloader and application from SDK 8.

Update 28.10.2015 Procedure and example files for S110 7 With S110 7 and bootloader from SDK 7, softdevice and bootloader updates were possible with an over the air update. This means that if you have i.e. S110 7 + bootloader from SDK 7, it is possible to update the device over the air (via Master Control Panel for Windows PC or nFR Toolbox app for Android, IOS or Windows phone) to contain S110 8 and bootloader from SDK 8 or SDK 9.

You can merge e.g. the following files with mergehex.exe

s110_nrf51822_7.3.0_softdevice.hex
BL7_1.hex
ble_app_bps_SDK_7_1_0.hex
app_valid_setting_apply.hex

into one file

SD_BL_APP_valid.hex

with the following command sequence:

mergehex --merge s110_nrf51822_7.3.0_softdevice.hex BL7_1.hex --output SD_BL.hex
mergehex --merge SD_BL.hex ble_app_bps_SDK_7_1_0.hex --output SD_BL_APP.hex
mergehex --merge SD_BL_APP.hex app_valid_setting_apply.hex --output SD_BL_APP_valid.hex

and then flash the file onto your nRF51-DK board (PCA10028) using nrfjprog.exe with

nrfjprog --program SD_BL_APP_valid.hex

then the ble_app_bps application should be advertising on your nRF51-DK.

Another method of obtaining the same thing without merging the files is with flashing the 4 files directly with the following command sequence:

nrfjprog --eraseall
nrfjprog --dfu --programs s110_nrf51822_7.3.0_softdevice.hex
nrfjprog --program BL7_1.hex
nrfjprog --program ble_app_bps_SDK_7_1_0.hex
nrfjprog --program app_valid_setting_apply.hex

Update 6.5.2016 If you want to merge nRF52832 hex files into one, then you need to use the following app valid setting file:

app_valid_setting_apply_nRF52832.hex

and merge it together with the softdevice, bootloader and application with mergehex.exe in the same way as has been described for nRF51. I have merged the following hex files with the app_valid_setting_apply_nRF52832.hex file, i.e. S132 2.0.0 softdevice, bootloader and heart rate example from SDK 11.0.0:

s132_nrf52_2.0.0_softdevice.hex
dfu_test_bootloader_b_s132.hex
dfu_test_app_hrm_s132.hex

when they are merged, they create the following combined file that can be flashed directly to the nRF52832:

SD_BL_APP_valid_nRF52832.hex

  • The merge issue was a Windows issue, the OS wasn't giving file write permission to mergehex. Thanks for the help

  • I still cannot seem to merge with the Setting.hex files you provided with my own Bootloader.hex file. ERROR: Merge not possible due to conflict in files. I know the bootloader settings should be set to 0x0003FC00. I believe I have done this properly.

    - dfu_types.h - #define BOOTLOADER_REGION_START 0x0003FC00
    #define BOOTLOADER_SETTINGS_ADDRESS 0x0003FC00

    / Linker script to configure memory regions. / SEARCH_DIR(.) GROUP(-lgcc -lc -lnosys)

    MEMORY { FLASH (rx) : ORIGIN = 0x00035000, LENGTH = 44K
    RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 8K
    BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0003FC00, LENGTH = 1K

    } SECTIONS { /* placing my named section at given address: */ .bootloaderSettings 0x0003FC00 : {

    } .uicrBootStartAddress 0x10001014 : {

    } /* other placements follow here... / } / .bootloaderSettings (NOLOAD): { *(.bootloaderSettings) } > BOOTLOADER_SETTINGS */ INCLUDE "gcc_nrf51_common.ld"

    Is there anything else I'm missing? Thanks

  • Apparently, gcc creates the hex file differently from Keil. The bootloader compiled with gcc writes to the last flash page where the bootloader settings are stored and where the app_valid_setting_apply.hex is writing as well, and that is why the two files conflict. I tried to have the gcc bootloader not write to the last page but some other conflicts come up. I will have to investigate this further next week in order to find a solution that works for gcc.

  • Thanks for the update Stefan. The Manual edit of the merged file did fix my problem. I created a Batch file to merge the images and everything works perfectly. Thank you for the assistance.

  • Locky, I think I may have as similar problem with mergehex

    C:\Users\timw\nordic\src\SofM\dfu\bootloader [v6master]> mergehex -m arm_build
    bootloader.hex .\bootloader_settings.hex -o bootloadercrc.hex Parsing arm_build\bootloader.hex file. Parsing .\bootloader_settings.hex file. Merging files. ERROR: Merge not possible due to conflict in files.

    How did you resolve the windows problem you had

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: hex2bin.exe是一款十六进制转二进制的工具。它可以将十六进制数转换成二进制数,同时也支持将二进制数转换成十六进制数。 如果你需要进行二进制与十六进制数的转换,可以通过对hex2bin.exe的下载来实现。下载之后,通过命令行输入“hex2bin.exe”工具名称,再输入所需要的操作命令,即可进行数据转换。 在实际使用中,这款工具可以非常方便地用于嵌入式系统开发、网络通信、数据传输、编程调试等场景。同时,hex2bin.exe操作简单,无需安装,只需下载即可使用,所以备受开发者们的喜爱。 需要注意的是,在使用hex2bin.exe进行数据转换时,应当注意数据的位数是否相同。如果数位不同,在转换过程中可能会出现错误,影响数据的正确性。 总之,hex2bin.exe是一款非常好用的十六进制转二进制工具,下载后即可方便地实现十六进制与二进制数据的转换。 ### 回答2: Hex2bin.exe是一款十六进制转二进制工具,可以将十六进制编码转换为二进制编码。它可以帮助开发人员将一个十六进制值转换为一个二进制值来进行程序开发与调试。使用Hex2bin.exe可以大大提高开发效率。 想要下载Hex2bin.exe非常简单,只需要在搜索引擎中输入“Hex2bin.exe下载”即可找到相关的下载链接。用户可以选择适合自己操作系统版本的Hex2bin.exe下载安装。在下载与安装过程中,要注意安全性,避免下载带有病毒的版本。 在使用Hex2bin.exe时,用户需要先将要转换的十六进制编码输入Hex2bin.exe程序中,程序会自动将其转换为二进制编码并显示出来。用户可以将转换后的二进制编码用于程序设计与测试等方面。 总的来说,Hex2bin.exe是一款非常实用的工具,对于需要进行十六进制到二进制转换的人群来说是不可或缺的。通过下载Hex2bin.exe,用户可以轻松地进行编码转换,提高自己的工作效率。 ### 回答3: Hex2bin.exe是一个十六进制转二进制的转换工具,它可以将十六进制代码转换为二进制代码。这个工具可以在网上下载,非常方便实用,对于很多开发人员来说,十六进制转二进制是非常重要的。由于计算机存储数据采用二进制方式,因此十六进制数要在计算机内部存储或进行计算时需要转换成二进制数。Hex2bin.exe只需要简单地输入十六进制代码即可将其转换为二进制代码,十分方便快捷。虽然现代编程语言提供了十六进制与二进制转换的工具,但是有些特定的应用或情况下,使用Hex2bin.exe仍是更为方便和高效的选择。因此,有必要了解该工具,以便在需要的时候使用。同时,在下载Hex2bin.exe时,需要注意下载源的可靠性,以避免下载到病毒或恶意软件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值