1234567891011121314151617181920212223242526272829 |
- #include "app_loader.h"
- void IAP_Init(void)
- {
- #if (STM32F103 == 1)
-
- #ifdef VECT_TAB_SRAM
- SCB->VTOR = SRAM_BASE | NEW_VECTOR_OFFSET; /* Vector Table Relocation in Internal SRAM. */
- #else
- SCB->VTOR = FLASH_BASE | NEW_VECTOR_OFFSET; /* Vector Table Relocation in Internal FLASH. */
- #endif
- #elif (STM32F072 == 1)
- /* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/
- uint32_t i = 0;
- /* 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*)(NEW_VECTOR_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();
- #endif
- }
|