最近搞了一下stm32f4xx的IAP功能,主要有两个程序,一个是APP,一个是IAP-bootloader.
首先说一下IAP-bootloader,是官网的IAP程序,
1、需要修改晶振,配合你自己的板子,我的是24Mhz;
2、修改key的GPIO设置,串口设置;
3、flash 的起始位置设置,可根据你的需要更改;
4、我的是#define APPLICATION_ADDRESS (uint32_t)0x08004000。
第二个是app程序,我是用RTT系统编写的app程序,需要修改:
1、void SystemInit(void)函数的下面这一行
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
// SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
SCB->VTOR = FLASH_BASE | 0x00004000; /* Vector Table Relocation in Internal FLASH */
#endif
2、修改board.c文件的void NVIC_Configuration(void)
{
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */
/* Set the Vector Table base location at 0x08000000 */
// NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000);
#endif
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
}
3、修改工程的1ROM1地址。
希望给其他的人参考,再次感谢在我调试过程中群里的大神们给我的帮助和指导。
谢谢你们!
查看更多