注意:F0系列在app工程中需要添加中断偏移函数,在MDK中要修改偏移地址,IROM1和IRAM1;
具体移植文件请参考我之前发布的iap教程,此处只做区分笔记;
1、IAP程序:
?
2、app程序
#define APPLICATION_ADDRESS ((uint32_t)0x08003000) //application load address
#define SRAM_ADDRESS ((uint32_t)0x20000000) // Relocate by software the vector table to the internal SRAM at 0x20000000
void bsp_iapAppInit(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*)(SRAM_ADDRESS + (i << 2))) = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));
}
/* Enable the SYSCFG peripheral clock*/
__HAL_RCC_SYSCFG_CLK_ENABLE();
/* Remap SRAM at 0x00000000 */
__HAL_SYSCFG_REMAPMEMORY_SRAM();
}
?
?
?
bin文件生成:
E:\XXXXXXX\Keil_v5\ARM\ARMCC\bin\fromelf.exe --bin -o $L@P.bin #L
|