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

nrf52811, custom bootloader and softdevice

Hello, I am trying to implement my own custom bootloader in the nRF52811.  I have the softdevice loaded, which then jumps to address 0x19000.  This is where I put my bootloader.  Once the bootloader is complete it jumps to my application located at 0x1b000.  Everything in my my main application works fine, except for the ble.  I suspect the ble does not know that the interrupt vector table has been moved using SCB->VTOR =0x1b000 (this was required for my main app).  How can I get the ble stack to operate correctly under this condition

Any help will be greatly appreciated

thanks

Jeff

  • Hello,

    I am not sure whether it will work to have the bootloader directly after the softdevice, but of course you can give it a go. If it doesn't work, I would suggest you try to have the bootloader in the top of the flash, like it is in our bootloader implementation. 

    Looking at our bootloader implementation (SDK\examples\dfu\secure_bootloader\

    I see that the bootloader sets the softdevice vector table using sd_softdevice_vector_table_base_set(). Perhaps you can try using that?

    Also, see how the application is started from the bootloader in the nrf_bootloader_app_start() and it clears the interrupts.

    By default the softdevice sets the interrupt table directly after itself, so this is why this isn't an issue when you don't have a bootloader, but the application directly after the softdevice. However, in our bootloader, we set the softdevice interrupt address to the bootloader start address. When the application starts later, the softdevice is initialized again, and it uses the default softdevice interrupt vector.

    Try using sd_softdevice_vextor_table_base_set() in your application, since it is not directly after the softdevie. 

    Best regards,

    Edvin

  • Hello Edvin,

    thank you for the detailed response

    When you stated "However, in our bootloader, we set the softdevice interrupt address to the bootloader start address. When the application starts later, the softdevice is initialized again, and it uses the default softdevice interrupt vector.".  This was the clue to my problems

    The solution to my problem was in this routine nrf_bootloader_mbr_addrs_populate().  This routine allows me to tell the softdevice to run my bootloader first (do not run code at 0x19000).  So I moved my bootloader to the end of flash, placed the app back at 0x19000.  So now the softdevice goes to bootloader first, and once it is complete it goes to the softdevice for reinitialization and then my app runs fine.  I knew there must be a way to have the softdevice do this but I just couldn't find the answer until today

    thanks for the help

    Jeff

Related