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

Getting hard fault when launching application from custom boot loader

I am building a custom boot loader to work with out application on a custom board based on the UBLOX NINA-302 module.  The boot loader will use USB as the only connection and that will use a USB driver we already developed for the application.  The idea is to use a simple boot loader without a soft device or MBR that will interface directly to our host application over USB.   The boot loader will start at 0x0 (FLASH_START=0x0) and a length of 0x10000 (FLASH_SIZE=0x10000).  The application is built in SES with FLASH_START set to offset address (0x10000) and FLASH_SIZE set to 0x20000.  The application was loaded into flash using J-Link before starting up the boot loader solution.

I am launching the application using the same funcitons that the Nordic boot loader wit some modifications specific to the implementation (files included below).  I have tried this with the standard "start_app' with optimization and also by replacing the function with an updated version I found on the developer blog.  The application seems to be starting up since I can track it using breakpoints up to "start_app" and then single set through the application code after the jump to the new reset handler.  I can single step through code but hit a hard fault whenever I let it free run.  The application has been stripped down to just blinky code with no interrupt service.  I even stripped the boot loader down to just the launch code but the application still crashes.  Any ideas?

  • Hi,

    Would it be possible for you to share the full project for the bootloader and application? That way I can debug the HardFault and look for a solution for you.

    Best regards,
    Jørgen

  • Any luck with the debug using the files I sent you?

  • Hi,

    I tried adding some LED controls to both bootloader and application code, and both seems to execute correctly. 

    In main_bl.c, I set LED4 on the nRF52840 DK:

    Similar, in main.c I set LED3:

    Both light up when I run the DK as normal (not in debug interface mode).

    Can you check if you are seeing similar behavior?

    Best regards,
    Jørgen

  • I'm running this on a custom board with SES using JLINK.  What do you mean by "DK as normal"?

  • I just implemented a similar "blinky" in both solutions, loaded the "app" at 0x10000 using SES and then ran the boot loader but  all I get is a reboot into the bootloader application.  I verified that the blinky worked in both applications before trying to boot the application from the bootloader.  The bootoader lights come on but the code seem to consistently reboot at 0x0 instead of 0x10000.

1 2 3 4