/** * @brief Setup the system * SystemInit() is called prior to the application and sets up system * clocking, memory, and any resources needed prior to the application * starting. * @return none */ void SystemInit(void) { #if defined(CORE_M3) || defined(CORE_M4) unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08; #if defined(__IAR_SYSTEMS_ICC__) extern void *__vector_table; *pSCB_VTOR = (unsigned int) &__vector_table; #elif defined(__CODE_RED) extern void *g_pfnVectors; *pSCB_VTOR = (unsigned int) &g_pfnVectors; #elif defined(__ARMCC_VERSION) extern void *__Vectors; *pSCB_VTOR = (unsigned int) &__Vectors; #endif #if defined(__FPU_PRESENT) && __FPU_PRESENT == 1 fpuInit(); #endif /* Setup system clocking and memory. This is done early to allow the application and tools to clear memory and use scatter loading to external memory. */ SystemSetupClocking(); SystemSetupMuxing(); SystemSetupMemory(); #endif }
/* * SystemInit() - Initialize the system */ void __section(SectionForBootstrapOperations) SystemInit(void) { #if !defined(CORE_M0) /* Initialize vector table in flash */ #if defined(__ARMCC_VERSION) extern void *__Vectors; SCB->VTOR = (unsigned int) &__Vectors; #elif defined(__IAR_SYSTEMS_ICC__) extern void *__vector_table; SCB->VTOR = (unsigned int) &__vector_table; #else /* defined(__GNUC__) and others */ extern void *g_pfnVectors; SCB->VTOR = (unsigned int) &g_pfnVectors; #endif #if 0 // defined(__FPU_PRESENT) && __FPU_PRESENT == 1 /* Initialize floating point */ fpuInit(); #endif SystemSetupPins(pre_clock_mux, COUNT_OF(pre_clock_mux)); /* Configure pins */ SystemSetupClock(); /* Configure processor and peripheral clocks */ SystemSetupPins(post_clock_mux, COUNT_OF(post_clock_mux)); /* Configure pins */ SystemSetupMemory(); /* Configure external memory */ #endif /* !defined(CORE_M0) */ }