|
/*************** IAP程序跳转APP程序 #define APPLICATION_ADDRESS (uint32_t)0x08003000 typedef void (*pFunction)(void); 把用户程序写入FLASH地址后执行以下代码 //跳转APP // JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); Jump_To_Application();
编译器默认 ***************/ /************** APP程序 #define APPLICATION_ADDRESS ((uint32_t)0x08004400) void IAP_Set(void) { uint32_t i = 0; /* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/ /* Copy the vector table from the Flash (mapped at the base of the application load address 0x08003000) to the base address of the SRAM at 0x20000000. */ for(i = 0; i < 48; i++) { *((uint32_t*)(0x20000000 + (i << 2)))=*(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2)); } /* Enable the SYSCFG peripheral clock*/ RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); /* Remap SRAM at 0x00000000 */ SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM); }
**************/ |
微信公众号
手机版
对是的,这些我也懂,但是map文件里面_Vectors_Size 0x000000b4 Number 0 startup_stm32f030.o ABSOLUTE
__Vectors 0x08002000 Data 4 startup_stm32f030.o(RESET)
__Vectors_End 0x080020b4 Data 0 startup_stm32f030.o(RESET)
应该和型号也有关系吧,是不是按map文件_Vectors_Size 大小来判断更准确呢?
你看看你map文件里面是多少?
我搞错了 不好意思大神,我想问一下stm32f030 iap中配置ram起始地址为ox200000c0是怎么算出来的?
但是我在map里面查看却不是c0
__Vectors_Size 0x000000b4 Number 0 startup_stm32f030.o ABSOLUTE
__Vectors 0x08002000 Data 4 startup_stm32f030.o(RESET)
__Vectors_End 0x080020b4 Data 0 startup_stm32f030.o(RESET)
注意在APP开始地方放那一段代码:
uint32_t i = 0;
/* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/
/* Copy the vector table from the Flash (mapped at the base of the application
load address 0x08003000) to the base address of the SRAM at 0x20000000. */
for(i = 0; i < 48; i++)
{
*((uint32_t*)(0x20000000 + (i << 2)))=*(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));
}
/* Enable the SYSCFG peripheral clock*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Remap SRAM at 0x00000000 */
SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);
一个STM32F0 的IAP 应用话题
我是用官方的IAP,我明天去公司上传分享
IAP升级DEMO
点评
我当时搞IAP也是费了点周折,最后还是搞定,谢谢分享!
呵呵呵