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

How to jump from Bootloader to Application (nrf51822)

Currently, I am trying to develop nrf51822 (MDBT40) using Nordic SDK v12 (S130). The programmer I used is DAPLink from RedBear.

I am wondering how to make program to jump from bootloader to application code.

This is what I have don:

  • Flash bootloader_secure example as my bootloader program:

    • Go to bootloader_secure/pca10028/armgcc/ and type "make clean; make";

    • Copy the generated .hex file in _build directory;

    • Merge the provided s130_nrf51_2.0.1_softdevice.hex with .hex file using:

      ./mergehex -m s130_nrf51_2.0.1_softdevice.hex nrf51422_xxac.hex -o bootloaderout.hex

    • Drag bootloaderout.hex file into virtual file system created by DAPLink for flashing bootloader;

  • Flash Beacon Example as Application Firmware:

    • Similar to previous steps, get .hex file by making the program;

    • Merge the provided s130_nrf51_2.0.1_softdevice.hex with .hex file using:

      ./mergehex -m s130_nrf51_2.0.1_softdevice.hex nrf51422_xxac.hex -o appout.hex

    • Drag appout.hex file into virtual file system created by DAPLink for flashing application code;

From what I observed, my nrf51822 only execute the beacon app, with the secure DFU bootloader being ignore. However, from what I think, the nrf51822 should execute bootloader code, after which the application code will be executed. This can be explained by following statement in main.c from bootloader:

nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR); // the MAIN_APPLICATION_START_ADDR looks like the increment of SoftDevice

Can anyone suggest me where the mistake I may make. Thanks!

Parents
  • You need to generate a bootloader settings page, please see Appendix 1 in this blog post.

  • Thanks for your suggestion Bjørn. As the guide indicated by you. Currently I got 4 hex files, which are application.hex, bootloader.hex, bootloader_setting.hex, softdevice.hex. I am wondering how shall I merge them together.

    This is how I did currently, but it looks like it doesn't work property. The device just step into application code directly with bootloading/secure DFU part being passed.. Could you please indicate me where the the mistake I made

    • Merge bootloader.hex and bootloader_setting.hex using following command:

      ./mergehex -m bootloader.hex bootloader_setting.hex -o outputbootloader.hex

    • Merge application code and softdevice using following command:

      ./mergehex -m application.hex s130_nrf51_2.0.1_softdevice.hex -o outputapp.hex

    • Drag outputbootloader.hex into virtual file system generated by DAPLink. And wait until it is finished;

    • Drag outputapp.hex into virtual file system generated by DAPLink. Wait until it is finished.

Reply
  • Thanks for your suggestion Bjørn. As the guide indicated by you. Currently I got 4 hex files, which are application.hex, bootloader.hex, bootloader_setting.hex, softdevice.hex. I am wondering how shall I merge them together.

    This is how I did currently, but it looks like it doesn't work property. The device just step into application code directly with bootloading/secure DFU part being passed.. Could you please indicate me where the the mistake I made

    • Merge bootloader.hex and bootloader_setting.hex using following command:

      ./mergehex -m bootloader.hex bootloader_setting.hex -o outputbootloader.hex

    • Merge application code and softdevice using following command:

      ./mergehex -m application.hex s130_nrf51_2.0.1_softdevice.hex -o outputapp.hex

    • Drag outputbootloader.hex into virtual file system generated by DAPLink. And wait until it is finished;

    • Drag outputapp.hex into virtual file system generated by DAPLink. Wait until it is finished.

Children
No Data
Related