2.将APP的终端向量表复制到以上位置,设置中断向量表重映射- static void SetVectorTable(void)
- {
- int i;
- /*!< At this stage the microcontroller clock setting is already configured,
- this is done through SystemInit() function which is called from startup
- file (startup_stm32f0xx.s) before to branch to application main.
- To reconfigure the default setting of SystemInit() function, refer to
- system_stm32f0xx.c file
- */
- /* 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++)
- {
- VectorTable[i] = *(__IO uint32_t*)(APP_SPACE_ADDR + (i<<2));
- }
- /* Enable the SYSCFG peripheral clock */
- RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE); /* 注意:ST官方例程使用 RCC_APB2PeriphResetCmd是不对的 */
- /* Remap SRAM at 0x00000000 */
- SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);
- }
|