something about MBR

env:

     SDK:   nRF5_SDK_17.0.2_d674dde

     KEIL- ARM

    SoftDevice: s140_nrf52_7.2.0_softdevice

i can't understand how MBR jump to bootloader,  and how MBR konw the start address about bootloader.

or it's a fixed value at MBR. UICR.NRFFW[0]  ,default value 0x78000?

but i change the value to 0x77000 in keil ide, like below

                                                                     

amazing!it also can jump to bootloader (0x77000)。

for the first ,turn on mcu, MBR run, how it detect if a bootloader is present, and bootloader start addr, and what's the range about bootloader address

  • Hi Grandpa, 

    The compiler can automatically detect the start address of the bootloader from your configuration using this: 

    #define CODE_START ((uint32_t)&Load$$LR$$LR_IROM1$$Base)

    This CODE_START is assigned to BOOTLOADER_START_ADDR in nrf_bootloader_info.h

    Then the BOOTLOADER_START_ADDR is written to 2 places in flash: 

    1. To UICR (UICR_BOOTLOADER_ADDR address 0x10001014)  using __attribute__ syntax , see nrf_bootloader_info.c

    2. To MBR internal setting page at 0xFF8, using a flash write inside nrf_bootloader_mbr_addrs_populate() function in the same file. 

    The MBR internal setting has higher priority compare to the UICR. 

    Every time you change the start address of the bootloader, make sure you do a chip erase so that these information can be written with a new value. 

Related