app/src/mcu_init.c
/**
  * @brief  Setup the microcontroller system
  *         Initialize the Embedded Flash Interface, the PLL and update the 
  *         SystemCoreClock variable.
  * @note   This function should be used only after reset.
  * @param  None
  * @retval None
  */
@brief  Setup the microcontroller system
Initialize the Embedded Flash Interface, the PLL and update the
SystemCoreClock variable.
@note   This function should be used only after reset.
@param  None
@retval None
@brief Setup the microcontroller system Initialize the Embedded Flash Interface the PLL and update the SystemCoreClock variable . @note This function should be used only after reset . @param None @retval None
void SystemInit(void)
{
    RCC->CR |= 0x00000001U;
#if !defined(STM32F105xC) && !defined(STM32F107xC)
    RCC->CFGR &= 0xF8FF0000U;
#else
    RCC->CFGR &= 0xF0FF0000U;
#endif    
    RCC->CR &= 0xFEF6FFFFU;
    RCC->CR &= 0xFFFBFFFFU;
    RCC->CFGR &= 0xFF80FFFFU;
#if defined(STM32F105xC) || defined(STM32F107xC)
    RCC->CR &= 0xEBFFFFFFU;
    RCC->CIR = 0x00FF0000U;
    RCC->CFGR2 = 0x00000000U;
#elif defined(STM32F100xB) || defined(STM32F100xE)
    RCC->CIR = 0x009F0000U;
    RCC->CFGR2 = 0x00000000U;      
#else
    RCC->CIR = 0x009F0000U;
#endif 
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
#ifdef DATA_IN_ExtSRAM
        SystemInit_ExtMemCtl(); 
#endif 
#endif 
#ifdef VECT_TAB_SRAM
    SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; 
#else
    SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; 
#endif 
}
void SystemInit ( void ) { RCC -> CR |= 0x00000001U ; #if ! defined ( STM32F105xC ) && ! defined ( STM32F107xC ) RCC -> CFGR &= 0xF8FF0000U ; #else RCC -> CFGR &= 0xF0FF0000U ; #endif RCC -> CR &= 0xFEF6FFFFU ; RCC -> CR &= 0xFFFBFFFFU ; RCC -> CFGR &= 0xFF80FFFFU ; #if defined ( STM32F105xC ) || defined ( STM32F107xC ) RCC -> CR &= 0xEBFFFFFFU ; RCC -> CIR = 0x00FF0000U ; RCC -> CFGR2 = 0x00000000U ; #elif defined ( STM32F100xB ) || defined ( STM32F100xE ) RCC -> CIR = 0x009F0000U ; RCC -> CFGR2 = 0x00000000U ; #else RCC -> CIR = 0x009F0000U ; #endif #if defined ( STM32F100xE ) || defined ( STM32F101xE ) || defined ( STM32F101xG ) || defined ( STM32F103xE ) || defined ( STM32F103xG ) #ifdef DATA_IN_ExtSRAM SystemInit_ExtMemCtl ( ) ; #endif #endif #ifdef VECT_TAB_SRAM SCB -> VTOR = SRAM_BASE | VECT_TAB_OFFSET ; #else SCB -> VTOR = FLASH_BASE | VECT_TAB_OFFSET ; #endif }
@brief  Setup the microcontroller system
         Initialize the Embedded Flash Interface, the PLL and update the
         SystemCoreClock variable.
@brief Setup the microcontroller system Initialize the Embedded Flash Interface the PLL and update the SystemCoreClock variable .
// Set HSION bit // Reset SW, HPRE, PPRE1, PPRE2, ADCPRE and MCO bits  /* STM32F105xC */ // Reset HSEON, CSSON and PLLON bits // Reset HSEBYP bit // Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE/OTGFSPRE bits // Reset PLL2ON and PLL3ON bits // Disable all interrupts and clear pending bits // Reset CFGR2 register */ // Disable all interrupts and clear pending bits // Reset CFGR2 register */ // Disable all interrupts and clear pending bits /* STM32F105xC */ /* DATA_IN_ExtSRAM */ // Vector Table Relocation in Internal SRAM. // Vector Table Relocation in Internal FLASH.