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

How to read FLASH_START address of bootloader in application

Hello

my setup is sdk 15.3, nrf52840, s140, open bootloader and an application.

Everything is merged, flashed and running and no changes are made at the standard addresses.

In the Memory layout nRF52840 (S140 v6.1.x) the bootloader address range is 0x000F 8000 - 0x000F E000 ?

In the project settings of the example open_bootloader the flash_start address is 0x000e0000 and this i want to read from inside application.

How can i read and store this in a variable ?

Thanks in advance for any hint....

twittich

  • See the file app_util.h for a list of defines which could contain what you want.

    An example of use can be found in nrf_bootloader_info.h which again is used in nrf_bootloader_info.c

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello

    thank you for the quick response but at this address / definition

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    is the start address of the application

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And i need the start of the bootloader....

    open_bootloader the flash_start address is 0x000e0000
  • Then I would write it to a UICR register (as is done in nrf_bootloader_info.c) and read that value from the application. AFAIK this is exactly the way it is done in the regular bootloader.

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    In the fds module, they check the value of this UICR register to decide whether or not the bootloader is active. (or at least how it was done previously ((they use MBR now))

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • They are empty...

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I'm testing this with the regular open_bootloader example without changes.

    How can i write the address to the uicr ?

  • By default MBR is used in SDK 15.3, and not UICR. (i.e. the bootloader addr is stored in 0xFF8 (MBR_BOOTLOADER_ADDR))

    Check the file app_util.c in SDK_folder\components\libraries\util

    Snippet:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1 2