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

Creating my own bootloader for nrf52810

Hi,

I want to create my own bootloader for the nrf52810.
If i don't want to update my softdevice i just put my bootloader code just after my softdevice. 

But it is not that easy if want to update the softdevice with my own bootloader.
Then i need to let the MBR know where my bootloader is. Where can i find more information on this topic?

The first question i have are:

  1. is the MBR part of the softdevice always the same?
    1. this part is never erased?
  2. if i program the vector table address of my boot loader at address MBR_BOOTLOADER_ADDR  will it always jump to boot loader?
    1. How does this work?
      1. what does the MBR all do. The page size is 4k. So i think it does more than just jump to bootloader or softdevice
    2. What is the best way to program a value at address MBR_BOOTLOADER_ADDR? are there other safe ways?
    3. how do i let the MBR now to forward all the ISR to bootsoftware? or do i just change the VTOR register?
    4. Are there others things to consider?
    5. ...

Best regard

Mathias

Parents
  • Hi Mathias, 

    Could you please explain a little bit more about your bootloader ? Have you made one ? Or just planing to make ?  I'm not sure I understand why your bootloader should be located right next to the softdevice. 

    Regarding your questions: 

    1

    - The MBR is hardly change between softdevice. Even if it's changed it usually backward compatible. We had only one MBR change that is not backward compatible. The MBR part is never erase by doing DFU. 

    2

    - If you program an address to the MBR_BOOTLOADER_ADDR, then the MBR will always jump to this address when booting. 

    a - Besides forwarding the vector table, the MBR also does replacing bootloader and init softdevice. See here.

    b - You can program MBR_BOOTLOADER_ADDR like a normal flash word. There is nothing special about that. But if you want to modify the value, you must reprogram the MBR as erasing the page will erase the MBR. 

    c - I don't understand what you meant

    d - So basically what happens is The MBR forward the vector table to the bootloader, the bootloader check if the softdevice is OK, then check if application is OK. If they are, the bootloader forward back the vector table to the softdevice (located right at 0x1000) and then the softdevice boot the application (forward to the end address of the softdevice)

  • Hi,

    Today i took my first step to making my own bootloader. I will put the bootloader at the end of my flash.

    I programmed MBR_BOOTLOADER_ADDR to jump to my bootloader. this seems to work great :).
    But i have problems to jump to my application.

    In my bootloader i change VTOR register so all interrupts go to my bootloader. Is this correct?
    When i want to jump to my application i make a jump to my softdevice address: 0x1004 and set the vector table to address 0x1000.


    I see in my assembly code that the program steps into the softdevice. The softdevice makes a jump to address 0x000186X and my controller resets.

    Could you say what i'm missing or doing wrong? 

    Thx!

     

     

     

  • SP => was set to stackpointer application 

    R2 => 0xCAFEBABE 

    Maybe this rings a bell?

Reply Children
No Data
Related