AnsweredAssumed Answered

Jumping to stored code triggers hardfault interrupt!

Question asked by Mrunal Ahirrao on Feb 23, 2018
Latest reply on Feb 26, 2018 by Mrunal Ahirrao

Hello,

 

I have developed a IAP application based on STM32F030CCT6. The application code is received on UART and I can store it in flash, I am storing code at 0x08010000. But I am facing problems in executing it. While trying to jump at code my code goes into HardFault interrupt. And unfortunately on this MCU there is no implementation of HFSR and VTOR. Hence I am not getting the reason for hardfault! I am using below code for jumping. And I have also remapped the Vector table in application binary. I am using Keil MDK5 and hence I have verified the addresses of code from MAP file. The application code's RESET starts at 0x08010000. and the IAP starts at 0x08000000 as expected. Please guide me.

 

     

typedef void (*jumpFunction) (void);//typedef for function pointer jumpFunction JumpToFunction;

//Function pointer uint32_t JumpAddress,somaddr;//Address of function pointer

__disable_irq(); JumpAddress = *(__IO uint32_t*)(FLASH_X_START_ADDR + 4);

JumpToFunction = (jumpFunction) JumpAddress; /* Initialize user application's Stack Pointer */

__set_MSP(*(__IO uint32_t*) FLASH_X_START_ADDR); /* Jump to application */

JumpToFunction();

Outcomes