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

merged hex for production

Hi, I have NRF52 issues creating one hex file containing softdevice + app + bootlader + settings. The device does not boot up. But if I have flashed the softdevice first then flash my merged app + bootlader + settings everything works as it should. What do I do wrong?

  • It would be helpful if you gave the entire script you use to create the package and flash it. 

    Here's what works for me:

    #!/bin/bash
    MODE="Debug"
    NAME="dev"
    VERSION="0.0.1"
    
    while getopts "m:n:v:" option;
    do
    case "${option}"
    in
    m) MODE=${OPTARG};;
    n) NAME=${OPTARG};;
    v) VERSION=${OPTARG};;
    esac
    done
    
    if [ -z "${MODE+x}" ]; 
      then echo "MODE is unset"; 
      else echo "MODE is set to '$MODE'"; 
    fi
    
    if [ -z "${NAME+x}" ]; 
      then echo "NAME is unset"; 
      else echo "NAME is set to '$NAME'"; 
    fi
    
    if [ -z "${VERSION+x}" ]; 
      then echo "VERSION is unset"; 
      else echo "VERSION is set to '$VERSION'"; 
    fi
    
    bootloader="ruuvitag_b_bootloader_3.0.1_s132_6.1.0_debug.hex"     
    if [ -f $bootloader ]; then
       echo "Found bootloader."
    else
       wget https://github.com/ruuvi/ruuvi.nrf5_sdk15_bootloader.c/releases/download/3.0.0/ruuvitag_b_bootloader_3.0.1_s132_6.1.0_debug.hex
    fi
    
    key="ruuvi_open_private.pem"     
    if [ -f $key ]; then
       echo "Found key"
    else
       wget https://github.com/ruuvi/ruuvi.nrf5_sdk15_bootloader.c/releases/download/3.0.0/ruuvi_open_private.pem
    fi
    
    nrfutil settings generate --family NRF52 --application Output/${MODE}/Exe/ruuvi.firmware.c.hex --application-version 1 --application-version-string "$VERSION" --bootloader-version 1 --bl-settings-version 1 settings.hex
    mergehex -m ../../../../nRF5_SDK_15.2.0_9412b96/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex ruuvitag_b_bootloader_3.0.1_s132_6.1.0_debug.hex settings.hex -o sbc.hex
    mergehex -m sbc.hex Output/${MODE}/Exe/ruuvi.firmware.c.hex -o packet.hex
    nrfjprog --family nrf52 --eraseall
    nrfjprog --family nrf52 --program packet.hex
    nrfjprog --family nrf52 --reset

  • Hi Otso, Thanks for the quick help, below is part of the original bat file:

    nrfutil settings generate --family NRF52 --application nrf52832_qfaa.hex --application-version 47 --bootloader-version 1 --bl-settings-version 1 settings.hex
    mergehex -m nrf52832_xxaa_s132.hex settings.hex -o bootloader_and_setting.hex
    mergehex -m nrf52832_qfaa.hex bootloader_and_setting.hex -o app_bootloader_and_setting.hex
    mergehex -m s132_nrf52_6.1.0_softdevice.hex app_bootloader_and_setting.hex -o softdevice_app_bootloader_and_setting.hex
    
    nrfjprog --family NRF52 --program softdevice_app_bootloader_and_setting.hex --sectorerase
    

    to 

    nrfutil settings generate --family NRF52 --application nrf52832_qfaa.hex --application-version 47 --bootloader-version 1 --bl-settings-version 1 settings.hex
    mergehex -m nrf52832_xxaa_s132.hex settings.hex -o bootloader_and_setting.hex
    mergehex -m nrf52832_qfaa.hex bootloader_and_setting.hex -o app_bootloader_and_setting.hex
    mergehex -m s132_nrf52_6.1.0_softdevice.hex app_bootloader_and_setting.hex -o softdevice_app_bootloader_and_setting.hex
    
    nrfjprog --family nrf52 --eraseall
    nrfjprog --family NRF52 --program softdevice_app_bootloader_and_setting.hex --sectorerase
    nrfjprog --family nrf52 --reset
    

    That did the trick! Thank you!

    I wish I have put this question here earlier

    /Martin

Related