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

Programming Blinky app with nrfjprog

Hello,

I'm struggling programming the Blinky app from examples to my NRF52 DK (pca10040)

Here is my script:


# 1. Generate settings
nrfutil settings generate --application ./sdk16.0.0/examples/ble_central/ble_app_blinky_c/hex/ble_app_blinky_c_pca10040_s132.hex --application-version-string 2.4.2 --family NRF52 --bootloader-version 2 --bl-settings-version 2 --app-boot-validation VALIDATE_GENERATED_CRC settings.hex

# 2. Merge blink app with bootloader and settings
mergehex -m ./sdk16.0.0/examples/ble_central/ble_app_blinky_c/hex/ble_app_blinky_c_pca10040_s132.hex ./sdk16.0.0/examples/dfu/secure_bootloader/pca10040_s132_ble_debug/hex/secure_bootloader_ble_s132_pca10040_debug.hex settings.hex -o tmp.hex

There are other steps but it fails here :

+++ nrfutil settings generate --application ./sdk16.0.0/examples/ble_central/ble_app_blinky_c/hex/ble_app_blinky_c_pca10040_s132.hex --application-version-string 2.4.2 --family NRF52 --bootloader-version 2 --bl-settings-version 2 --app-boot-validation VALIDATE_GENERATED_CRC settings.hex

Note: Generating a DFU settings page with backup page included.
This is only required for bootloaders from nRF5 SDK 15.1 and newer.
If you want to skip backup page generation, use --no-backup option.

Generated Bootloader DFU settings .hex file and stored it in: settings.hex

Bootloader DFU Settings:
* File: settings.hex
* Family: nRF52
* Start Address: 0x0007F000
* CRC: 0x1360FE10
* Settings Version: 0x00000002 (2)
* App Version: 0x00004FB2 (20402)
* Bootloader Version: 0x00000002 (2)
* Bank Layout: 0x00000000
* Current Bank: 0x00000000
* Application Size: 0x0002B738 (177976 bytes)
* Application CRC: 0xA488797C
* Bank0 Bank Code: 0x00000001
* Softdevice Size: 0x00000000 (0 bytes)
* Boot Validation CRC: 0x2801247F
* SD Boot Validation Type: 0x00000000 (0)
* App Boot Validation Type: 0x00000001 (1)

+++ mkdir -p ./Release_52pca10040/2.4.2
+++ mergehex -m ./sdk16.0.0/examples/ble_central/ble_app_blinky_c/hex/ble_app_blinky_c_pca10040_s132.hex ./sdk16.0.0/examples/dfu/secure_bootloader/pca10040_s132_ble_debug/hex/secure_bootloader_ble_s132_pca10040_debug.hex settings.hex -o tmp.hex
Parsing input hex files.
Merging files.
ERROR: The hex files cannot be merged since there are conflicts.

What am is missing ?

Parents
  • Hi,

    The problem here is that both the application hex you are using and the bootloader hex you are using have been merged with the SoftDevice from before (SDK is shipped with merged hex files). So you are getting a conflict there. You need to use a bootloader hex which is not merged with the SoftDevice in this case.

    Another key point is that the pre-built bootloader hex file is useless to you in case as you want to generate your own DFU upgrade package. Then you must also build the bootloader with your own public key. See bootloader example documentation for how to use your own key.

  • Ok, I'm no further, with these steps :

    # Build
    emBuild -config 'Release' sdk16.0.0/examples/dfu/secure_bootloader/pca10040_s132_ble_debug/ses/secure_bootloader_ble_s132_pca10040_debug.emProject
    emBuild -config 'Release' sdk16.0.0/examples/peripheral/blinky/pca10040/s132/ses/blinky_pca10040_s132.emProject
    
    # Settings.hex generate
    nrfutil settings generate --application ./sdk16.0.0/examples/peripheral/blinky/pca10040/s132/ses/Output/Release/Exe/blinky_pca10040_s132.hex --application-version-string ${APPLICATION_VERSION} --family NRF52 --bootloader-version 2 --bl-settings-version 2 --app-boot-validation VALIDATE_GENERATED_CRC settings.hex
    
    # Merge hex
    mergehex -m ./sdk16.0.0/examples/peripheral/blinky/pca10040/s132/ses/Output/Release/Exe/blinky_pca10040_s132.hex ./sdk16.0.0/examples/dfu/secure_bootloader/pca10040_s132_ble_debug/ses/Output/Release/Exe/secure_bootloader_ble_s132_pca10040_debug.hex settings.hex -o tmp.hex
    mergehex -m tmp.hex ./sdk16.0.0/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex -o merged_app_bootloader_softdevice_settings.hex
    
    nrfjprog --eraseall
    nrfjprog --program merged_app_bootloader_softdevice_settings.hex --verify
    nrfjprog --reset


    Programing goes fine, but it doesn't blink :( which I guess means that app doesn't run 

    I guess I'm missing something, but what ?

Reply
  • Ok, I'm no further, with these steps :

    # Build
    emBuild -config 'Release' sdk16.0.0/examples/dfu/secure_bootloader/pca10040_s132_ble_debug/ses/secure_bootloader_ble_s132_pca10040_debug.emProject
    emBuild -config 'Release' sdk16.0.0/examples/peripheral/blinky/pca10040/s132/ses/blinky_pca10040_s132.emProject
    
    # Settings.hex generate
    nrfutil settings generate --application ./sdk16.0.0/examples/peripheral/blinky/pca10040/s132/ses/Output/Release/Exe/blinky_pca10040_s132.hex --application-version-string ${APPLICATION_VERSION} --family NRF52 --bootloader-version 2 --bl-settings-version 2 --app-boot-validation VALIDATE_GENERATED_CRC settings.hex
    
    # Merge hex
    mergehex -m ./sdk16.0.0/examples/peripheral/blinky/pca10040/s132/ses/Output/Release/Exe/blinky_pca10040_s132.hex ./sdk16.0.0/examples/dfu/secure_bootloader/pca10040_s132_ble_debug/ses/Output/Release/Exe/secure_bootloader_ble_s132_pca10040_debug.hex settings.hex -o tmp.hex
    mergehex -m tmp.hex ./sdk16.0.0/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex -o merged_app_bootloader_softdevice_settings.hex
    
    nrfjprog --eraseall
    nrfjprog --program merged_app_bootloader_softdevice_settings.hex --verify
    nrfjprog --reset


    Programing goes fine, but it doesn't blink :( which I guess means that app doesn't run 

    I guess I'm missing something, but what ?

Children
  • Hi,

    Looking at your set of commands I do not see anything wrong. I see you wisely used the debug bootloader project now, and that has very good RTT logging. Can you observe the RTT log output and copy it here? That should show if the application is started or not, and if not, why.

  • 00> <info> app: Inside main
    00>
    00> <debug> app: In nrf_bootloader_init
    00>
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00>
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00>
    00> <debug> nrf_dfu_settings: Using settings page.
    00>
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    00>
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00>
    00> <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    00>
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00>
    00> <debug> app: Enter nrf_bootloader_fw_activate
    00>
    00> <info> app: No firmware to activate.
    00>
    00> <debug> app: App is valid
    00>
    00> <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    00>
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00>
    00> <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
    00>
    00> <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0

  • I see. Then we are back in this thread, I guess. I suggest we continue there.

Related