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

What is role of bootloader?

I looked up method about Transferring files.

and became interested about the example of dfu.

if I understand dfu example, I think it would help to me

so..

What is role of bootloader when I use DFU?

if I update only a softdevice, does bootloader need?

when I use ble for transfer data, bootloader is not necessary.

I don't understand about bootloader

  • Hi GunMin

    When you want to send data over BLE or ANT, you first flash BLE softdevice or ANT softdevice and then put you application on top of that. With that you can send data over BLE or ANT. You do not need any bootloader to do this. You need to program the device by connecting a programmer to the SWD programming interface on the nRF51.

    If you however want to be able to update your device in the field, in order to add features or to fix bugs, you most likely want to use a bootloader. The bootloader lets you update the device over BLE, typically via Smart phone app, instead of connecting a specialized programmer.

    When using a bootloader, you have Softdevice+bootloader+application on the device. First you flash the softdevice, then you flash the bootloader, then you use a smartphone app to upload an application to the device via BLE. Afterwards, you can update the application/bootloader/softdevice via your smartphone.

    Update 4.3.2015 You do not need to do any changes to your application in order to include a bootloader. The bootloader is located at the end of the flash memory space, so they should not overlap, see the memory map here.

    You do however need to be aware of the size of your application when using a bootloader. If you want to transfer new application to the bootloader via BLE, then the tradition is to have dual bank bootloader to do that. Dual-bank means that you will store the old application in flash until you have completed transfer and validation of the new application. That means you will need flash space for two application. So to fit the whole thing, you need to fit a softdevice, bootloader, two applications and and non-volatile application data in addition. Non volatile-application data is data that you want to restore after resetting the nRF51, and is typically 3-5kB in size. The bootloader size in nRF51 SDK 7.2.0 is by default flashed to the last 16 flash pages (1 flash page is 1kB). The result is:

    • S110 v7.1 flash: 88kB
    • Bootloader SDK 7.2.0: 16kB
    • Application data: 5kB (assumed)
    • Remaining space for application: 256 - 88 - 16 - 5 = 147kB
    • Maximum application size for dual bank DFU: 147 / 2 = 73kB

    With the bootloader in nRF51 SDK v7, uploading an init file to the DFU with the application is mandatory. For this to be successful, you need to prepare the init file as described on my answer on this thread.

    When you have uploaded the application via bootloader, the device will start up the application by default. You will need to press a button on the device while resetting in order to enable bootloader mode and be able to upload a new application via bootloader. You could also enable bootloader mode from a connected device (typically the smartphone) but then you will need to implement a DFU service in your application as described here.

    Update 16.4.2015 You can upload softdevice+bootloader+application all at once with a programmer. a good way of doing this is to merge the three into one hex file and then program it to the nRF51. This is described on this thread.

  • Thank you for reply.

    Currently I am using as a Softedevice and Application.

    If I add Bootloader, Do I need to change the starting point and Size of memory (Rom / Ram)?

  • I would like to ask one more.

    Now approach, First I flash the softdevice, then I flash the bootloader, then I use a smartphone app to upload an application to the device via BLE.

    This is great.

    But if I sell it by creating a product, creating Does any way?

    Did I put a hex file for the application in any way with the product?

Related