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

Combining app + bootloader + sd + settings page on v15.3

Using: Linux (Ubuntu 18.04), gcc/Eclipse, nrf52840, v15.3.0 SDK, SD 6.1.1

It has been a real bear of time using the SDFU in the newest version of the SDK.  There were a lot of "breaking changes" and limitations.  

1.  The linker directive for SDFU changed from previous revs, as discussed here.  Because of the MBR changes, and how nrfjprog erases 0x0, you MUST program the SD and the bootloader together.  I got this working, and the bootloader runs reliably.

2.  To be able to program an application, you need to generate a bootloader settings page, and then use mergehex to put in with the BL + SD created above.  The bootloader settings page is created against the application you want to build, as described here and may other posts.  To use on the 840, on 15.3, you must use --family NRF52840 (not just NRF52), and you must set --bl-settings-version 2 (not 1).  Generating the settings is fine, I get:

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

Bootloader DFU Settings:
* File:                     ../_build/bootloader_settings.hex
* Family:                   NRF52840
* Start Address:            0x000FF000
* CRC:                      0x98F5B7F4
* Settings Version:         0x00000002 (2)
* App Version:              0x00000000 (0)
* Bootloader Version:       0x00000000 (0)
* Bank Layout:              0x00000000
* Current Bank:             0x00000000
* Application Size:         0x00012808 (75784 bytes)
* Application CRC:          0x15C84F37
* Bank0 Bank Code:          0x00000001
* Softdevice Size:          0x00000000 (0 bytes)
* Boot Validation CRC:      0xACDA1BA2
* SD Boot Validation Type:  0x00000000 (0)
* App Boot Validation Type: 0x00000000 (0)

3.  After merging the settings page in, I merge in my application.  I flash the whole pile onto my board, and the bootloader runs, but doesn't see a valid app.

<info> app: Inside main
<debug> app: In nrf_bootloader_init
<debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
<debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
<debug> nrf_dfu_settings: Using settings page.
<debug> nrf_dfu_settings: Copying forbidden parts from backup page.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<debug> app: Enter nrf_bootloader_fw_activate
<info> app: No firmware to activate.
<info> app: Boot validation failed. No valid app to boot.
<debug> app: DFU mode because app is not valid.
<info> nrf_bootloader_wdt: WDT is not enabled
<debug> app: timer_stop (0x200057C4)
<debug> app: timer_activate (0x200057C4)
<info> app: Entering DFU mode.
<debug> app: Initializing transports (found: 1)
<debug> nrf_dfu_ble: Initializing BLE DFU transport
<debug> nrf_dfu_ble: Setting up vector table: 0x000F1000
<debug> nrf_dfu_ble: Enabling SoftDevice.
<debug> nrf_dfu_ble: Configuring BLE stack.
<debug> nrf_dfu_ble: Enabling the BLE stack.
<debug> nrf_dfu_ble: No advertising name found
<debug> nrf_dfu_ble: Using default advertising name
<debug> nrf_dfu_ble: Advertising...
<debug> nrf_dfu_ble: BLE DFU transport initialized.
<debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
<debug> app: Enter main loop

4.  I run nrfutil to look at the settings of the combined (BL + SD + settings + app), it looks weird... no Start Address, and some weird message saying "Bad access at 0x7F000".

nrfutil settings display --------.hex 
Bad access at 0x7F000: not enough data to read 4 contiguous bytes

Bootloader DFU Settings:
* File:                     ----------.hex
* Family:                   NRF52840
* Start Address:            0x00000000
* CRC:                      0x98F5B7F4
* Settings Version:         0x00000002 (2)
* App Version:              0x00000000 (0)
* Bootloader Version:       0x00000000 (0)
* Bank Layout:              0x00000000
* Current Bank:             0x00000000
* Application Size:         0x00012808 (75784 bytes)
* Application CRC:          0x15C84F37
* Bank0 Bank Code:          0x00000001
* Softdevice Size:          0x00000000 (0 bytes)
* Boot Validation CRC:      0xACDA1BA2
* SD Boot Validation Type:  0x00000000 (0)
* App Boot Validation Type: 0x00000000 (0)

I'm out of steam, this has been a real pain.  Any thoughts on why my integrated app won't work?

Thanks,

M

Parents Reply Children
  • No problem, I created it because I needed it and it could be useful for other as well.   Just recently that you are allow to use the DK to flash external board.  It wasn't the case before.  The IDAP was created initially for that purpose and also allows parallel flashing for production and it is not limited to nRF.  I am not forcing you to use it, just give you an alternative.  The choice is yours to make.

Related