This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Remove Softdevice over USB DFU update

I have a number of devices that currently have an S132 softdevice, USB enabled DFU bootloader and application.

I am intending on updating the application, which removes bluetooth functionality, and as result I no longer require the softdevice to be on the device any more. Is it possible to remove this over a sequence of DFUs?

I'm expecting to be updating the Bootloader and Application at the same time as this, to ensure they are compatible without the softdevice present.


Rough flow of what I'm hoping to do:

Update Bootloader and erase softdevice + application

Update Application 

Parents
  • Hi Chris,

    The way the bootloader detect if there is a softdevice or not in the chip is to check the magic hex at the beginning of the softdevice area (right after MBR) , this is snipped from nrf_bootloader_info.h 

    So what you need to do is to make a new bootloader version that has SD_PRESENT forced to 0 . You will need first to update this bootloader. After that it's most likely the bootloader will stay in DFU mode because the softdevice will be recognized as invalid application and you can now update your application into the space of the softdevice. Please make sure your application is compiled with start address = 0x1000 which is the start address of the softdevice (right after the MBR). 


    I haven't tested this myself but as far as I can see it should work. 

  • You are right, I was forcing SD_PRESENT to 0 the wrong way. Previously doing this in main.c:

    #undef SD_PRESENT
    #define SD_PRESENT 0

    I've now changed this to setting SD_PRESENT in preprocessor symbols, which does the job: 

    <info> app: ***** NEW BOOTLOADER *****
    <info> app: SD_PRESENT: 0
    <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 0x7E000.
    <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: crc_on_valid_app_required returning: 1
    <info> app: SD_PRESENT: 0
    <info> nrf_dfu_validation: nrf_dfu_validation_boot_validate() VALIDATE_CRC. address: 0x00001000
    <debug> nrf_dfu_validation: CRC check of app failed. Return 1
    <debug> app: App is valid

    This revealed a new problem - the crc check failing, but app_is_valid still reporting the app is valid.
    This was due to NRF_DFU_DEBUG being set to true in the makefile.

    Removing that, and it all works as expected - thanks for the help Hung!

Reply
  • You are right, I was forcing SD_PRESENT to 0 the wrong way. Previously doing this in main.c:

    #undef SD_PRESENT
    #define SD_PRESENT 0

    I've now changed this to setting SD_PRESENT in preprocessor symbols, which does the job: 

    <info> app: ***** NEW BOOTLOADER *****
    <info> app: SD_PRESENT: 0
    <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 0x7E000.
    <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: crc_on_valid_app_required returning: 1
    <info> app: SD_PRESENT: 0
    <info> nrf_dfu_validation: nrf_dfu_validation_boot_validate() VALIDATE_CRC. address: 0x00001000
    <debug> nrf_dfu_validation: CRC check of app failed. Return 1
    <debug> app: App is valid

    This revealed a new problem - the crc check failing, but app_is_valid still reporting the app is valid.
    This was due to NRF_DFU_DEBUG being set to true in the makefile.

    Removing that, and it all works as expected - thanks for the help Hung!

Children
No Data
Related