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

Sequence for Bootloader to configure SoftDevice

Hi,

In our existing project, it has a Bootloader and MBR, but no SoftDevice. Transport is UART for DFU.

I need to port the Bootloader to work on another project that uses SoftDevice.

I read that Bootloader needs to configure SoftDevice by calling the APIs.

I have 2 questions:

1. What are the things in SoftDevice that need to be configured by the Bootloader? Or, what is the right sequence for Bootloader to initialize and configure SoftDevice?

2. In the Bootloader sct file, the start address is 0xD6000, and the size is 0x1A000. But when I checked the hex file, the address ended at 0xE7000, while according the sct file, it ends at 0xF0000. The Bootloader settings location is at 0xEF000. Should I move it to be higher than 0xF0000?

Thanks.

Parents
  • Hi,

    Are you using your own bootloader design or the bootloader from the nRF5 SDK (with or without modifications)? I am assuming that you use a nRF5 SDK bootloader variant for now.

    The bootloader in the nRF5 SDK is designed to work both with and without SoftDevice, and there are abstraction libraries that handle the differences between having a SoftDevice, so there should be very little modification needed.

    1. What are the things in SoftDevice that need to be configured by the Bootloader? Or, what is the right sequence for Bootloader to initialize and configure SoftDevice?

    If you refer to the nRF5 SDK 16 example bootloader, you will see that the main.c file is identical for all bootloader variants, both those using a SoftDevice and those not. That is because the difference in having a SoftDevice or not is handled by drivers and libraries, and of course by the transport layer implementation, where the BLE transport layer uses a lot of BLE features from the bootloader. The SoftDeice is initialized when the BLE transport layer is initialized. So, to add the SoftDevice to the bootloader project you need to do the following:

    • Add the BLE backed source files and dependencies to the project
    • Add relevant defines to the project (e.g. SOFTDEVICE_PRESENT, NRF_SD_BLE_API_VERSION=7, ...)
    • Add any missing configurations to the bootloader sdk_config.h.
    • Move the start address of the bootloader down and increase the size, so that it can fit even though it becomes larger.

    All of the above include a lot of details, so the easiest is to compare/diff your bootloader project /Makefile to an example project/Makefile using the SoftDevice to see what you need to add.

    2. In the Bootloader sct file, the start address is 0xD6000, and the size is 0x1A000. But when I checked the hex file, the address ended at 0xE7000, while according the sct file, it ends at 0xF0000. The Bootloader settings location is at 0xEF000. Should I move it to be higher than 0xF0000?

    I am not sure bout this scatter (.sct) file you are referring to. Can you clarify? Which toolchain do you use, and what does it say? In any case, the bootloader location is simply at the end of the flash, but not overlapping the two last pages. It can start further down, but then you will wast flash at the end. The bootloader start address is programmed to the UICR and/or the last word in the MBR page (depending on SDK version), and that is part of the bootloader .hex. This lets the MBR know where the bootloader is located. See Memory layout for details.

Reply
  • Hi,

    Are you using your own bootloader design or the bootloader from the nRF5 SDK (with or without modifications)? I am assuming that you use a nRF5 SDK bootloader variant for now.

    The bootloader in the nRF5 SDK is designed to work both with and without SoftDevice, and there are abstraction libraries that handle the differences between having a SoftDevice, so there should be very little modification needed.

    1. What are the things in SoftDevice that need to be configured by the Bootloader? Or, what is the right sequence for Bootloader to initialize and configure SoftDevice?

    If you refer to the nRF5 SDK 16 example bootloader, you will see that the main.c file is identical for all bootloader variants, both those using a SoftDevice and those not. That is because the difference in having a SoftDevice or not is handled by drivers and libraries, and of course by the transport layer implementation, where the BLE transport layer uses a lot of BLE features from the bootloader. The SoftDeice is initialized when the BLE transport layer is initialized. So, to add the SoftDevice to the bootloader project you need to do the following:

    • Add the BLE backed source files and dependencies to the project
    • Add relevant defines to the project (e.g. SOFTDEVICE_PRESENT, NRF_SD_BLE_API_VERSION=7, ...)
    • Add any missing configurations to the bootloader sdk_config.h.
    • Move the start address of the bootloader down and increase the size, so that it can fit even though it becomes larger.

    All of the above include a lot of details, so the easiest is to compare/diff your bootloader project /Makefile to an example project/Makefile using the SoftDevice to see what you need to add.

    2. In the Bootloader sct file, the start address is 0xD6000, and the size is 0x1A000. But when I checked the hex file, the address ended at 0xE7000, while according the sct file, it ends at 0xF0000. The Bootloader settings location is at 0xEF000. Should I move it to be higher than 0xF0000?

    I am not sure bout this scatter (.sct) file you are referring to. Can you clarify? Which toolchain do you use, and what does it say? In any case, the bootloader location is simply at the end of the flash, but not overlapping the two last pages. It can start further down, but then you will wast flash at the end. The bootloader start address is programmed to the UICR and/or the last word in the MBR page (depending on SDK version), and that is part of the bootloader .hex. This lets the MBR know where the bootloader is located. See Memory layout for details.

Children
No Data
Related