This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Combining SD, DFU and Application .hex and Programming

Hi guys,

First issue: is that the mergehex.exe fails everytime when trying to Write the merged file. The Error is ERROR: An error occured while writing the file. this has occurred on every attempted combination of SD, DFU and Application.

Second issue: If I try and simply program all three .hex files with nrfjprog.exe I get several warnings. "WARNING: Since the option "--dfu" was not given, the SoftDevice will include UICR settings. Please be aware that Device Firmware Update of the SoftDevice will be possible with these settings." This does not occur if I program the two with nRFgo Studio and I can update the SD just fine.

Third issue: When trying to use nrfjprog.exe the DFU does not detect a valid application. I know this question has been address before, but all references to solutions were based on older code which I don't use. I am using bootloader_util_gcc which is coded differently that bootloader_util_arm. Therefore I don't know how to apply any of the solutions to have the DFU validation the application when programmed.

  • 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

  • Hi tim,

    I made sure that I placed the files in the same folder as mergehex.exe, and that the folder was a Windows User folder. This means that non-administrators can write/create files in that folder. An example would be User\My Documents\Merge Firmware\mergehex.exe

Related