2015-11-19 03:31 AM
Hi all
I try to implement a boot loader that can be jump to user application of STM32F030R8 chip , and I find the IAP sample as follow.http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF258152
It seams look like have the feature I need, but this sample is for STM320518-EVAL, I can't use it on STM32F030R8 directly. So I find out the function code for jump as below and add these to my main function. if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000) { /* 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 */ Jump_To_Application(); } Then, debug with IAR step by step, it was executed the ''Jump_To_Application'' , but I didn't see the address have jump to the APPLICATION_ADRRESS. So does anyone can point where is I missing? Thank you very much.2015-11-19 03:58 AM
It's jumping to an address in a vector table, ie indirectly, there is no code at APPLICATION_ADDRESS
Suggest you review the Cortex-M0 architecture a bit, either via the ARM TRM (Technical Reference Manual) or Joseph Yiu's series of books on the core.2015-11-23 01:12 AM
Thank you
It can be worked after I set the vector table of app as follow. /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ #define APPLICATION_ADDRESS (uint32_t)0x08004000 /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ static __IO uint32_t TimingDelay; #if (defined ( __CC_ARM )) __IO uint32_t VectorTable[48] __attribute__((at(0x20000000))); #elif (defined (__ICCARM__)) #pragma location = 0x20000000 __no_init __IO uint32_t VectorTable[48]; #elif defined ( __GNUC__ ) __IO uint32_t VectorTable[48] __attribute__((section(''.RAMVectorTable''))); #elif defined ( __TASKING__ ) __IO uint32_t VectorTable[48] __at(0x20000000); #endif for(i = 0; i < 48; i++) { VectorTable[i] = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2)); } /* Enable the SYSCFG peripheral clock*/ RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE); /* Remap SRAM at 0x00000000 */ SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM); Now, I need to implement the user app jump back to loader when I update the new user app, and jump to the new app again when the new app upload finished, can I use the same jump function to do it?2015-11-23 05:43 AM
I'd use a reset based method, as I've discussed on the forum several times before. Please search/Google for specifics.
The ST examples as broken, soRCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Not the RESET of the peripheral