Adding USB capability to secure DFU BLE bootloader

Hi,

I'd like to add the capability to perform secure DFU over USB with the secure DFU BLE bootloader as a baseline. What needs to be done to achieve this? In addition to adding the USB transport, do I need to add USB CDC in the bootloader to be able to send the DFU using nrfutil?

I'm using sdk v17 as the baseline for the secure DFU bootloader.

Thanks

  • Hi Einar,

    How to I determine the size of the bootloader?  If I adjust the start and length so it builds and links I get

    Linking target: _build/nrf52840_xxaa_s140.out
       text    data     bss     dec     hex filename
      41008     200   29404   70612   113d4 _build/nrf52840_xxaa_s140.out

    Regarding the two empty pages, is that saying that flash start + length must be at least two pages lower than the total flash available?

    So for a nRF52840 the max address is 0x10000 so the bootloader must end at 0xFE000 (0x10000 - 0x2000)? 

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0xF3000, LENGTH = 0xFE000-0xF3000
      RAM (rwx) :  ORIGIN = 0x20005978, LENGTH = 0x3a688
      uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
      bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000
      uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4
      mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000
    }

  • And regarding RAM, since I have not modified the base BLE example, does this mean RAM is unchanged?

  • Hi,

    EvDog said:
    How to I determine the size of the bootloader?

    You can often see it by the output of your IDE/toolchain, but the simplest is probably to take the hex file and add it to nRF Connect Programmer. Then you can easily see where it ends. (It might show up a multiple regions, then take the last/highest address of the last/highest region. The sizes is then the end address - start address).

    EvDog said:
    Regarding the two empty pages, is that saying that flash start + length must be at least two pages lower than the total flash available?

    Yes, correct.

    EvDog said:
    So for a nRF52840 the max address is 0x10000 so the bootloader must end at 0xFE000

    Yes, it must end before 0xFE000.

    EvDog said:
    And regarding RAM, since I have not modified the base BLE example, does this mean RAM is unchanged?

    Yes, that is correct. It will not change in this case.

  • OK thanks.  nRF connect reports 41200 bytes, so if I use

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0xF3000, LENGTH = 0xA0F0
      RAM (rwx) :  ORIGIN = 0x20005978, LENGTH = 0x3a688
      uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
      bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000
      uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4
      mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000
    }

    it compiles and links.  I will test tomorrow and provide a finalised patch.

  • Hi EvDog,

    I'd like to do the same thing. Could you share your final patches?

    Much appreciate!

Related