Hi there,
I tried to execute the IAP code (AN3965) on a f4 discovery board. I can say that the loader reads an writes binarys perfectly, it was testet with flash loader demonstrator. But jumping to user app does not work. I tried the following pieces of code, I get everytimes a hard fault at the command 'Jump_To_Application();'
What is wrong?
code one:
/* 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();
code two:
volatile uint32_t JumpAddress; void (*Jump_To_Application)(void) = 0; JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); /* Jump to user application */ Jump_To_Application = (void (*)(void)) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application();