4 Replies Latest reply on Oct 9, 2019 5:41 AM by EmHo_296241

    How to create callback from bootloader on PSoC 4?

    JoWi_3984961

      This code in the bootloader seems to make defining a callback macro for new commands for the bootloader difficult:

       

      #if ((CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LAUNCHER) && (!CY_PSOC3))

      /**

      *  This variable holds the pointer on the user's callback-function that implements the custom

      *  bootloader command processing.

      */

      static Bootloader_callback_type Bootloader_callback = NULL;

      #endif /*(CYDEV_PROJ_TYPE != CYDEV_PROJ_TYPE_LAUNCHER) && (!CY_PSOC3)*/

       

      Using the standard bootloader, one appication to load, on the PSoC 4, the variable Bootloader_callback is set to the NULL function pointer.

      This means I cannot set it to point to my code.

       

      Why is this done?  I wish to define new commands for the bootloader on the PSoC 4, and I THOUGHT callback macros was the way to go, until I see the above code.

       

      This code appears in bootloader.c, target is PSoC4, and it is generated code, so I modify it at my peril.

       

      What gives?