Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Fixed flash memory location for BLE stack (Softdevice)

Hello Nordic support,

I understand that BLE stack is provided in nRF5 SDK as SoftDevice hex file and the flash area is fixed for the softdevice. I would like to understand if it is possible to provide SoftDevice hex file that can be flashed in another area of flash memory.

The reason for asking this is we already have a Zigbee coordinator application which is already deployed to devices on field. Now, we are  planning to add BLE capability to this application. Our existing Zigbee application is present in flash area that overlaps with the Softdevice. Therefore, wanted to check if there is a way to update the application with BLE capability without making much changes to application code with respect to flash area. If you have any other suggestions for our problem statement, that would be helpful.

Thanks in advance,

Anusha

  • Hi,

    The SoftDevice is not built with position independent code, so it must be located at the beginning of the flash (with the MBR at 0x0 and the SoftDevice itself at 0x1000). It is not possible to move the SoftDevice (or parts of it). So if you want to use the SoftDevice, you need to relocate your application to make room for it.

  • Hi Einar,

    Thanks for your response. I would like to understand a bit more about MBR and how I would need to relocate my application.

    To give you a background, in my current application, there is a custom bootloader starting at memory location 0x00 followed by application. If I need to add SoftDevice, then:

    1. MBR + SoftDevice will start from memory location 0x00. In the flash memory, after Softdevice, do I need to place my custom bootloader followed by application?

    2. From what I understand, MBR is required for performing updates to SoftDevice or application. If I don't require to update SoftDevice and use my custom bootloder for updating my application do I still require MBR?

    3. When the Nordic device boots up, how does it start executing my custom bootloader? The reason for asking this is as follows: In our application, we will either use Bluetooth or Zigbee which depends on a value in a certain variable. 

    If you have any documentation links that could give more details on MBR and how to add BLE SoftDevice to an existing application, it would be helpful.

    Regards,

    Anusha

  • anusha_14 said:
    1. MBR + SoftDevice will start from memory location 0x00.

    Yes.

    anusha_14 said:
    after Softdevice, do I need to place my custom bootloader followed by application?

    You have two options. Either place your bootloader at the first page after the SoftDevice. This way that will automatically be started by the SoftDevice. Alternatively, you can use the same approach as is used by the nRF5 SDK bootloader. This places the bootloader at the end of the flash and is started by the MBR. This works by the MBR checking a special word (in UICR or at the end of page 0), to see if it is set. If it is all FF (meaning no bootloader), the MBR will jump to the SoftDevice, which in turn jumps to whatever is after the SoftDevice (typically an application in the SDK examples, but it could also be your custom bootloader). If it is some thing else, than it is assumed to be the start address of a bootloader, and the MBR jumps there. So there are two possible options here. The advantage of the approach used in the SDK is that you can add a bootloader without having to relocate the application (so the same example applications can be used with and without a bootloader). For a custom design I do not see any obvious reasons why one of the approaches would be better than the other.

    anusha_14 said:
    2. From what I understand, MBR is required for performing updates to SoftDevice or application. If I don't require to update SoftDevice and use my custom bootloder for updating my application do I still require MBR?

    Your understanding is correct. However, there are some dependencies on the MBR in the SoftDevice, so you cannot just use the SoftDevice without the MBR.

    anusha_14 said:
    3. When the Nordic device boots up, how does it start executing my custom bootloader? The reason for asking this is as follows: In our application, we will either use Bluetooth or Zigbee which depends on a value in a certain variable. 

    From HW perspective, it starts executing from address 0 (where the MBR is). Then the MBR will either jump right to the bootloader or the SoftDevice as described earlier in this post.

    anusha_14 said:
    If you have any documentation links that could give more details on MBR and how to add BLE SoftDevice to an existing application, it would be helpful.

    We do not have any documentation specifically on adding SoftDevice to an existing application (particularly in the field), but there are many examples of application using a SoftDevice in the SDK that you can refer to. You can read more about the MBR in the SoftDevice specification under Master boot record and bootloader. (You may also find the documentation for the nRF5 SDK bootloader  libraries useful as a reference.)

  • Thanks for the details. Your suggestion to specify bootloader address in end of page 0 worked for me.

Related