1 Reply Latest reply on May 26, 2020 4:53 AM by HakanJ_21

    Modustoolbox 2.1 DFU with BLE image write address in flash

    OkBa_4438736

      Hi,

       

      I am using  two APPs for DFU functionality with BLE. App0 is just used as a launcher and App1 provides the main logic.

      I am following the instructions from Cypress Device Firmware Update (DFU) Middleware Library 4.0

      Host Command/Response protocol processing is as follows :

       

      status = Cy_DFU_Continue(&state, &dfuParams);

        ++count;

         if (state == CY_DFU_STATE_FINISHED)

        {

         /* Finished loading the application image */

         /* Validate DFU application, if it is valid then switch to it */

        status = Cy_DFU_ValidateApp(1u, &dfuParams);

         if (status == CY_DFU_SUCCESS)

        {

         Cy_DFU_TransportStop();

         Cy_DFU_ExecuteApp(1u);

        }

         else if (status == CY_DFU_ERROR_VERIFY)

        {

         /*

        * Restarts loading, an alternatives are to Halt MCU here

        * or switch to the other app if it is valid.

        * Error code may be handled here, i.e. print to debug UART.

        */

        status = Cy_DFU_Init(&state, &dfuParams);

         Cy_DFU_TransportReset();

        }Cy_DFU_Continue(&state, &dfuParams);

      In the code example, it looks like the packets are magically written in App1's flash address. How can I validate it ?

      I tried to check API function implementations such as Cy_DFU_Continue() however I could not find which flash address is used for the incoming packets to write into flash memory. I know metadata includes the flash layout information. But I could not find the code snippets includes the relation between incoming data and flash addresses in the metadata.

      What would happen if I want to use more than one 2 Apps ? How can I choose the one I want to overwrite?

       

      Regards,