This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NRF52 S132 and application with custom address

Hi Nordic

I have some questions regarding switch to Application on custom address.

The memory layout in flash is like this:

0x00000000 - MBR
0x00000000 - softdevice (s132_nrf52_7.2.0)
0x00026000 - Custom bootloader
0x0002B000 - Application 1
0x00050800 - Application 2
0x00076000 - Configuration


Queries:
1. can we have application other than 0x26000(APP_CODE_BASE) is hardcoded inside the SoftDevice.
2. Is there any way to modify the application starting address.

  • Hi,

    The answer to both questions is yes.

    The method used to start the application from the bootloader in recent nRF5 SDK versions (>= 15.0.0) does not involve specifying an address, as the bootloader just branches to the SoftDevice, which in turn starts the application which must then be located immediately after. You can see how this is implemented in <nRF5 SDK>\components\libraries\bootloader\nrf_bootloader_app_start.c where the start address is always 0x1000.

    However, it is possible to do this differently, using any application start address, and this approach was used up to nRF5 SDK version 14.2. If you refer to the implementation of <nRF5 SDK 14.2>\components\libraries\bootloader\nrf_bootloader_app_start.c you can see that nrf_bootloader_app_start() here takes any application start address and the way it configures the MBR and SoftDevice is different. So in short you should use the approach used in SDK 14.2, which can also be used with later SDK versions.

    To be more specific, In SDK >= 15.0.0, the boot process consists of forwarding interrupts to the SoftDevice using SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET (nrf_dfu_mbr_irq_forward_address_set()), and then always jumping to address 0x1000 (SoftDevice start) instead of the application start address. The old approach is to use the SD_MBR_COMMAND_INIT_SD and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET command, and start the application at a specific address. This is what you should use for a dual boot scenario when the application is not always immediately after the SoftDevice.

    You can compare components\libraries\bootloader\nrf_bootloader_app_start.c in SDK 14.2 and a newer SDK to see both approaches.

    TLDR: You need to use the approach from components\libraries\bootloader\nrf_bootloader_app_start.c in SDK 14.2. With that, the application start can be anything (it does not have to start on the first page after the SoftDevice).

Related