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

Custom Bootloader nRF52832

I've got an mBed application that includes a softdevice (s132 - 2.0.1) that is installed at 0x00000-0x520000 and works as required. I created a test bootloader using the example "blinky" from the nRF52 SDK14 (no softdevice). I load this at 0x78000. When I erase the UICR, my mBed application starts as required. When I write 0x78000 to the BOOTLOADER_ADDR (0x10001014) and do a reset, my example "blinky" code starts. How do I pass control back to the mBed application once my bootloader code is finished? I don't want to use Nordic's DFU code is it is too bulky and too complex.

First question, when I set the BOOTLOADER_ADDR to 0x78000 to start my blinky bootloader, does the softdevice get started also? Note that the example "blinky" app from the NRF52 SDK14 does not include a softdevice.

Does anyone have any code that would allow me to jump to my mBed app (standard app with softdevice)? I've tried several things but each time my blinky bootloader gets restarted.

I've tried the simplistic approach:

void *ptr = (void *)0x1c000; goto *ptr;

But this does not work.

Lastly, I expected that if I set the BOOTLOADER_ADDR to 0x1000 or 0x1C000 (the start of my mBed application) and do a reset that it would start my mbed app, but it doesn't. I have to clear the BOOTLOADER_ADDR in the UICR to 0xffffffff to get it starting again.

Any insights would be greatly appreciated.

Parents
  • OK, figured it out. I'm using the IoT bootloader example in SDK 14.2 (/examples/iot/bootloader) and configured the Makefile to set the MAIN_APPLICATION_START_ADDR to 0x1c000 and CODE_REGION_1_START to 0x1c000 as well. In main.c, I only have some led blinking to confirm that I am in the bootloader before calling nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR) and that's it. I am not calling nrf_bootloader_init(). The main application at 0x1c000 is then called. The main application uses mBed with BLE and this works as required. Hope this helps someone else.

Reply
  • OK, figured it out. I'm using the IoT bootloader example in SDK 14.2 (/examples/iot/bootloader) and configured the Makefile to set the MAIN_APPLICATION_START_ADDR to 0x1c000 and CODE_REGION_1_START to 0x1c000 as well. In main.c, I only have some led blinking to confirm that I am in the bootloader before calling nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR) and that's it. I am not calling nrf_bootloader_init(). The main application at 0x1c000 is then called. The main application uses mBed with BLE and this works as required. Hope this helps someone else.

Children
No Data
Related