cancel
Showing results for 
Search instead for 
Did you mean: 

bootloader using FWupgrade_Standalone inbuild example project

NAmat
Associate II
 
1 REPLY 1
NAmat
Associate II

I downloaded FWupgrade_Standalone example project and loaded to my STM32F429I-DISC1 and made three changes.

  1. I removed button press Jump_To_Application logic from main and created a function as below:

void LoadFromInternalFlash(void)

{

/* Check Vector Table: Test if user code is programmed starting from

   * address "APPLICATION_ADDRESS" */

  if ((((*(__IO uint32_t *) APPLICATION_ADDRESS) & 0xFF000000) == 0x20000000)

    || (((*(__IO uint32_t *) APPLICATION_ADDRESS) & 0xFF000000) ==

      0x10000000))

  {

   /* Jump to user application */

   JumpAddress = *(__IO uint32_t *) (APPLICATION_ADDRESS + 4);

   Jump_To_Application = (pFunction) JumpAddress;

   /* Initialize user application's Stack Pointer */

   __set_MSP(*(__IO uint32_t *) APPLICATION_ADDRESS);

   Jump_To_Application();

  }

}

2.I added else part for if usb device is not connected then call above point 1 function as below:

if ((phost->device.is_connected) != 0U)

   { // as it is in the example

   }

   else

   { USBdiskNotAvailableCounter++;

    if(USBdiskNotAvailableCounter > 10)

    {

    LoadFromInternalFlash();

    }

   }

   break;

Result of Point 2: Working perfectly. When there is no USB device plugged in it load the previous application every time successfully.

3.I want if the new firmware "image.bin" is not available in USB device then I want to load previous application as in point 2. For that I made following change in function below

void COMMAND_Download(void)

{

 /* Open the binary file to be downloaded */

 if (f_open(&MyFileR, DOWNLOAD_FILENAME, FA_OPEN_EXISTING | FA_READ) == FR_OK)

 {

//as it is in the example

 }

 else

 {

  /* The binary file is not available: Toggle LED4 in infinite loop */

  //Fail_Handler();

LoadFromInternalFlash();

 }

}

Result: it never works. I have no idea why, can anybody explain. Thanks in advance.