AnsweredAssumed Answered

IAP application startup error

Question asked by longchair.m on Nov 8, 2012
Latest reply on Nov 8, 2012 by Clive One

I have been studying the IAP samples recently, basically the one from AN2557.

I have tried to adapt it for my application, the idea being that I would load a new fw from the microSD card when it would be available.

therefore I have made in my Keil projet two configurations :
- One being for the bootloader
- One being for the "application".

I just want to be able to debug the application without having to use the bootloader to update the fw.

I am working on a STM32F103RBT6, and I have defined that my application would be stored at 0x08010000 (upper 64k), and my bootloader will lay at the regular address 0x08000000.

therefore in my bootloader configuration , I have defined that :
IROM1 = 0x08000000

and in the application configuration
IROM1 = 0x08010000

Then I have defined the BOOTDLOADER define in the bootloader config.

and I have the following main function :

int main (void)
  // check if we need a FW update
  if ((f_mount(0,&fs))== FR_OK)
   // check if we have a FirmwareFile
   if (FIRMWARE_Upload("GueNightFlyARM.bin",ApplicationAddress)==SUCCESS)
    // reset the chip
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x10000);
  // now run the application
  /* Test if user code is programmed starting from address "ApplicationAddress" */
  if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
   /* Jump to user application */
   JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
   //JumpAddress = *(__IO uint32_t*) (ApplicationAddress );
   Jump_To_Application = (void (*)())JumpAddress;
   /* Initialize user application's Stack Pointer */
   __set_MSP(*(__IO uint32_t*) ApplicationAddress);
   return MainApplication();

The upload of the firware seems to be good, when i compare memory with the binary from the bin file, they seem identical. Though when it jumps to the application with Jump_To_Application();, I get a NMI_handler exception hander call.

I have been comparing the samples with my code and don't see why this would happen.

Any Idea is welcome :)