1 Reply Latest reply on Mar 11, 2019 10:43 PM by SrinathS_16

    How to develope FX3 2-stage bootloader?

    xixu_4093676

      We are planing to develope our 2-stage bootloader

      the function feature is following :

      1. the Fx3BootAppGcc check whether there are one valid app img on the I2C EEPROM(assumed the app img locate at eeprom address 0x8000)

      2. if the app img is Ok,2-stage bootloader  will boot the app img

      3. if the app img been damaged, the 2-stage bootloader download new app img by usb and write to eeprom.

      So I 'm reviewing the following code usb_boot.c in the Fx3BootAppGcc to try to how to get the img data by usb ep0.

      My question is : the  Fx3BootAppGcc only support download the img data to ITCM Memory region(CY_FX3_BOOT_ITCM_BASE to CY_FX3_BOOT_ITCM_END)?

      Also, Are there one windows tools that can be used with this example(Fx3BootAppGcc) to download the app img ?

      if ((address + gEP0.wLen) <= CY_FX3_BOOT_ITCM_END)

                  {

                      /* Avoid writing to the interrupt table. */

                      if (address < 0xFF) {

                          gEP0.pData += 0xFF-address;

                          gEP0.wLen -= 0xFF-address;

                          address = 0xFF;

                      }

                      CyFx3BootMemCopy((uint8_t *)address, gEP0.pData, gEP0.wLen);

                  }

       

       

      void

      myVendorCmdHandler (

              void

              )

      {

      ....

      else if (stage == eDataOut)
              {
                  status = CyFx3BootUsbDmaXferData (0x00, (uint32_t)gEP0.pData, gEP0.wLen, CY_FX3_BOOT_WAIT_FOREVER);
                  if (status != CY_FX3_BOOT_SUCCESS)
                  {
                      /* USB DMA Transfer failed. Stall the Endpoint. */
                      CyFx3BootUsbStall (0, CyTrue, CyFalse);
                      return;
                  }

                  /* Validate ITCM Memory */
                  if ((address + gEP0.wLen) <= CY_FX3_BOOT_ITCM_END)
                  {
                      /* Avoid writing to the interrupt table. */
                      if (address < 0xFF) {
                          gEP0.pData += 0xFF-address;
                          gEP0.wLen -= 0xFF-address;
                          address = 0xFF;
                      }
                      CyFx3BootMemCopy((uint8_t *)address, gEP0.pData, gEP0.wLen);
                  }
              }

      ....

      }