Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bootloader code example SDK s132 v13.0

Hi,

I use the bootloader example given into the library to update my application (or bootloader and/or softdevice+bootloader) via DFU but I don't find in this code how to restart my target in application mode (if application is valid) when I try to update my target with an invalid package (ie bad application version, bad hw version, bad key...).

For example after bad access when the target resets it enters in bootloader mode whereas when I shutdown supply power the target starts in application.

Thank you for your help

Romain

  • The function for starting an application is defined in nrf_bootloader_app_start.h:

    /**@brief Function for starting another application (and aborting the current one).
     *
     * @details This function uses the provided address to swap the stack pointer and then load
     *          the address of the reset handler to be executed. It checks the current system mode
     *          (thread/handler). If in thread mode, it resets into the other application.
     *          If in handler mode, isr_abort is executed to ensure that handler mode is left correctly.
     *          It then jumps into the reset handler of the other application.
     *
     * @note This function will never return, but issues a reset into the provided application.
     *
     * @param[in]  start_addr  Start address of the other application. This address must point to the
                   initial stack pointer of the application.
     *
     */
    void nrf_bootloader_app_start(uint32_t start_addr);

    & is called at the end of the main() function in main.c:

    // Either there was no DFU functionality enabled in this project or the DFU module detected
    // no ongoing DFU operation and found a valid main application.
    // Boot the main application.
    nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR);

Related