Dynamically Jump Between PSoC 4 Bootloader and Bootloadable Application – KBA228337

Version 2

    Author: RyanZ_36          Version: **

     

    Sometimes, your custom bootloader project may need to dynamically jump from the bootloader program to the bootloadable application program or the other way around.

    The following functions help you on this:

    Function

    Parameter

    Description

    void Bootloader_Exit (uint8 appId)

    appld

    The application to be started:

    - Bootloader_EXIT_TO_BTLDR - The Bootloader application will be started on a software reset.

    - Bootloader_EXIT_TO_BTLDB;

    - Bootloader_EXIT_TO_BTLDB_1 - Bootloadable application # 1 will be started on a software reset.

    - Bootloader_EXIT_TO_BTLDB_2 - Bootloadable application # 2 will be started on a software reset. Available only if the "Dual-application" option is enabled in the Component customizer.

    The function schedules the specified application and performs a software reset to launch a specified application.

    If the specified application is not valid, it will launch the bootloader program again.

    void Bootloadable_Load (void)

     

    The function schedules the Bootloader/Launcher to be launched and then performs a software reset to launch it.

    For example, in dual-bootloadable application, use an external GPIO to launch the specified bootloadable application from bootloader. This code is the interrupt handler of a timer. When an interrupt happens, the code checks the GPIO status and goes to the specified bootloadable application.

     

    CY_ISR(timer_ISR)

    {

          Timer_ClearInterrupt(Timer_INTR_MASK_TC);

     

        if(Trigger_BTLDR_To_APP1_Read() != 0u)

        {Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_1);}

       

        if(Trigger_BTLDR_To_APP2_Read() != 0u)

        {Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_2);}  

    }

    For more details about the jump procedure between bootloader and bootloadable, read reference document below.