3 Replies Latest reply on May 17, 2018 5:55 AM by user_318879994

    Dual-Application Bootloader with Combinaison Project

    user_318879994

      Hi all,

       

      To begin i will present you that i want to do.

      For my project i need to do a dual-application bootloader. In a normal utilization when the product is started the BOOTLOADER should wait an USBFS command.

      This command asks to BOOTLOADER to JUMP in APP#0 or APP#1. When this step is done. APP#0 or APP#1 should be able to JUMP in BOOTLOADER or in the other APP#x. That why the Dual-Application Bootloader with Combinaison Project seems to be the best use case for us.

      For the moment,

      - when i am in BOOTLOADER, i receive the USB command to jump in APP#0 and i JUMP in APP#0

      - when i am in BOOTLOADER, i receive the USB command to jump in APP#1 and i JUMP but i don't know where...

      - when i am in APP#0 and i want to jump in APP#1...after the Bootloadable_Load() i re-jump in APP#0

       

      See follow the architecture of my project: ("Memory View")

      In all project, all Bootloader and Bootloadable component name are the sames.

       

      Mains code architecture:

      Compilation and Program process:

      - Compilation of BOOTLOADER Project

      - Compilation of APP#0 Project

      - Compilation of APP#1 Project

      - Run a shell to use cypelftool.exe

      - Execute command: cyelftool -M App1_1.elf App2_2.elf MultiApp.hex --flash_size 262144 --flash_row_size 256

      - Program MultiApp.hex file. (with psoc programmer)

       

      We can not use Bootloader host due to a custom USB VID/PID. (not detected by bootloader host).

      So I use a custom software to send USB frame to request a jump.

       

      For me the main issue is that i can't change the active APP parameter. I fact when i do a SetActiveApplication(APP#1), the return are 0x09 (ABANDON)

      And in fact the return of Get_ActiveApplication is always "0x0000".

       

      My Questions:

      -How jump to BOOTLOADER from APP#0 and APP#1?

      -How jump to APP#0 from APP#1 and to APP#1 from APP#0?

      -How i can be sure that my APP#1 are present when i program my firmware? (APP#0 seems to by always present)

       

      Thank's in advance.

       

      Jimmy.

       

      For information screenshots of each TopDesign of my Workspace:

      BOODLOADER:

      APP#0 and APP#1 are the same:

        • 1. Re: Dual-Application Bootloader with Combinaison Project
          geon

          Hello Jimmy,

           

          (Q1) How jump to BOOTLOADER from APP#0 and APP#1?

          Bootloadable_Load();

           

          (Q2)How jump to APP#0 from APP#1 and to APP#1 from APP#0?

           

          int main(void)

          {

              uint8 runningApp;

             

              CyGlobalIntEnable; /* Enable global interrupts. */

             

              /* Initialize the in app bootloader */

              Bootloader_App_Initialize();

             

              /* store current active image in order to switch images later */

              runningApp = Bootloader_App_GetRunningAppStatus();

           

              for(;;)

              {

                  /* Ping bootloader interface for in app updates */ 

                  Bootloader_App_HostLink(1u);

                  CyDelay(2000);

                  /* Check for custom inputs here, switch the active image and reset */

                  {         

                      if (Bootloadable_MD_BTLDB_ACTIVE_0 == runningApp)

                      {

                          Bootloadable_SetActiveApplication(Bootloadable_MD_BTLDB_ACTIVE_1);

                          Bootloadable_Load();

                      }   

                      else if (Bootloadable_MD_BTLDB_ACTIVE_1 == runningApp)

                      {

           

                          Bootloadable_SetActiveApplication(Bootloadable_MD_BTLDB_ACTIVE_0);

                          Bootloadable_Load();

                      }

                      else

                      {             

           

                      }

                      CySoftwareReset();

                  }

              }

          }

           

          (Q3) How i can be sure that my APP#1 are present when i program my firmware? (APP#0 seems to by always present)

          Please make use of code in (Q2). Application will be loaded only if present.

           

          Best Regards,

          Geona Mary

          • 2. Re: Dual-Application Bootloader with Combinaison Project
            user_318879994

            Hello,

             

            Sorry for the late response i was on vacation .

             

            I will take time to test this code and i will give a feedback after.

             

            Best Regards,

            • 3. Re: Dual-Application Bootloader with Combinaison Project
              user_318879994

              Hi,

               

              Thank you, this code works well.

               

              I needed to add in "main.c" of the Bootloader this code because when APP#X want to jump in APP#Y the program jumps before in the Bootloader (not in app bootloader):

               

                  for(;;)

                  {            

                      if(Bootloader_GetMetadata(Bootloader_GET_BTLDB_ACTIVE,0) == 01)

                      {

                          UART_PutString("Jump in APP#0\r\n");

                          Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_1);

                      }

                      else if(Bootloader_GetMetadata(Bootloader_GET_BTLDB_ACTIVE,0) == 00)

                      {

                          UART_PutString("Jump in APP#1\r\n");

                          Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_2);

                      } 

                  }

               

              Best regards,

               

              Jimmy.