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

Merged Hex File

Hello,

Softdevice: 7.0.1, SDK: 16.0, Device: nRF52840

In the production, we want to save time programming the devices. So I'm using following command to combine bootloader, softdevice and app into unified/merged hex file then program it through bootloader. But my device gets stuck in the "DfuTarg" status and reseting puts it again into same state. Please let me know what can go wrong?

@echo off

SET BOOTLD=bootloader.hex
SET APPHEX=app.hex
SET SOFTDV=s140_nrf52_7.0.1_softdevice.hex

echo "## Merging SD, bootloader and app files"
mergehex -m %BOOTLD% %SOFTDV% %APPHEX% -o complete_file.hex
echo.

echo "## Erasing complete chip..."
nrfjprog --family nRF52 --eraseall
echo.

echo "## Programming existing merged file"
nrfjprog --program complete_file.hex --chiperase
echo.


echo "## Making device to reset"
nrfjprog --reset
echo.

:end
pause

Parents
  • Hello,

    You need to generate and merge the Bootloader settings page as well. The settings page contains the information needed by the bootloader to verify and boot the application.

    Here's an example of how you can generate it with nrfutil:

     nrfutil settings generate --family NRF52^
     --application %APPHEX%^
     --application-version-string "%APP_VERSION_STRING%"^
     --bootloader-version %BL_VERSION%^
     --bl-settings-version 2^
     --app-boot-validation VALIDATE_GENERATED_CRC^
     bl_settings.hex

  • I tried this, created bl_settings.hex file but still the issue remains same. What should be the BL_VERSION or bootloader version value should be? I have taken the bootloader from SDk16.0 secure bootloader example.

  • Did you use pass the same %APPHEX% file as the one you used in the merged image? The bootloader will only boot the application image if it its computed CRC is the same as the one that is stored in the bootloader settings. You could also try to replace VALIDATE_GENERATED_CRC with NO_VALIDATION to skip the boot validation check and see if it makes any difference.

    The Bootloader versioning is up to you to decide. You can start with version 1 if you want.

Reply
  • Did you use pass the same %APPHEX% file as the one you used in the merged image? The bootloader will only boot the application image if it its computed CRC is the same as the one that is stored in the bootloader settings. You could also try to replace VALIDATE_GENERATED_CRC with NO_VALIDATION to skip the boot validation check and see if it makes any difference.

    The Bootloader versioning is up to you to decide. You can start with version 1 if you want.

Children
Related