fork download
  1. void clock_init(void)
  2. {
  3. RCC->CR |= RCC_CR_HSEON;
  4. while( !(RCC->CR & RCC_CR_HSERDY) ){}
  5.  
  6. FLASH->ACR &= ~FLASH_ACR_LATENCY;
  7. FLASH->ACR |= FLASH_ACR_LATENCY_0;
  8. FLASH->ACR |= FLASH_ACR_PRFTBE;
  9.  
  10. RCC->CFGR |= RCC_CFGR_PLLSRC;
  11. RCC->CFGR |= RCC_CFGR_PLLMULL6;
  12.  
  13. RCC->CFGR |= RCC_CFGR_PPRE1_DIV2;
  14.  
  15. RCC->CR |= RCC_CR_PLLON;
  16. while( !(RCC->CR & RCC_CR_PLLRDY) ){}
  17.  
  18. RCC->CFGR |= RCC_CFGR_SW_PLL;
  19. while( (RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08 ){}
  20.  
  21. SystemCoreClockUpdate();
  22.  
  23. if(SysTick_Config(SystemCoreClock/1000))
  24. {
  25. while(1){}
  26. }
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘clock_init’:
prog.c:3:2: error: ‘RCC’ undeclared (first use in this function)
  RCC->CR |= RCC_CR_HSEON;
  ^~~
prog.c:3:2: note: each undeclared identifier is reported only once for each function it appears in
prog.c:3:13: error: ‘RCC_CR_HSEON’ undeclared (first use in this function)
  RCC->CR |= RCC_CR_HSEON;
             ^~~~~~~~~~~~
prog.c:4:21: error: ‘RCC_CR_HSERDY’ undeclared (first use in this function)
  while( !(RCC->CR & RCC_CR_HSERDY) ){}
                     ^~~~~~~~~~~~~
prog.c:6:2: error: ‘FLASH’ undeclared (first use in this function)
  FLASH->ACR &= ~FLASH_ACR_LATENCY;
  ^~~~~
prog.c:6:17: error: ‘FLASH_ACR_LATENCY’ undeclared (first use in this function)
  FLASH->ACR &= ~FLASH_ACR_LATENCY;
                 ^~~~~~~~~~~~~~~~~
prog.c:7:16: error: ‘FLASH_ACR_LATENCY_0’ undeclared (first use in this function)
  FLASH->ACR |= FLASH_ACR_LATENCY_0;
                ^~~~~~~~~~~~~~~~~~~
prog.c:8:16: error: ‘FLASH_ACR_PRFTBE’ undeclared (first use in this function)
  FLASH->ACR |= FLASH_ACR_PRFTBE;
                ^~~~~~~~~~~~~~~~
prog.c:10:15: error: ‘RCC_CFGR_PLLSRC’ undeclared (first use in this function)
  RCC->CFGR |= RCC_CFGR_PLLSRC;
               ^~~~~~~~~~~~~~~
prog.c:11:15: error: ‘RCC_CFGR_PLLMULL6’ undeclared (first use in this function)
  RCC->CFGR |= RCC_CFGR_PLLMULL6;
               ^~~~~~~~~~~~~~~~~
prog.c:13:15: error: ‘RCC_CFGR_PPRE1_DIV2’ undeclared (first use in this function)
  RCC->CFGR |= RCC_CFGR_PPRE1_DIV2;
               ^~~~~~~~~~~~~~~~~~~
prog.c:15:13: error: ‘RCC_CR_PLLON’ undeclared (first use in this function)
  RCC->CR |= RCC_CR_PLLON;
             ^~~~~~~~~~~~
prog.c:16:21: error: ‘RCC_CR_PLLRDY’ undeclared (first use in this function)
  while( !(RCC->CR & RCC_CR_PLLRDY) ){}
                     ^~~~~~~~~~~~~
prog.c:18:15: error: ‘RCC_CFGR_SW_PLL’ undeclared (first use in this function)
  RCC->CFGR |= RCC_CFGR_SW_PLL;
               ^~~~~~~~~~~~~~~
prog.c:19:23: error: ‘uint32_t’ undeclared (first use in this function)
  while( (RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08 ){}
                       ^~~~~~~~
prog.c:19:32: error: expected ‘)’ before ‘RCC_CFGR_SWS’
  while( (RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08 ){}
         ~                      ^~~~~~~~~~~~
                                )
prog.c:19:59: error: expected ‘)’ before numeric constant
  while( (RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08 ){}
       ~                                                   ^~~~
                                                           )
prog.c:21:2: warning: implicit declaration of function ‘SystemCoreClockUpdate’ [-Wimplicit-function-declaration]
  SystemCoreClockUpdate();
  ^~~~~~~~~~~~~~~~~~~~~
prog.c:23:5: warning: implicit declaration of function ‘SysTick_Config’ [-Wimplicit-function-declaration]
  if(SysTick_Config(SystemCoreClock/1000))
     ^~~~~~~~~~~~~~
prog.c:23:20: error: ‘SystemCoreClock’ undeclared (first use in this function)
  if(SysTick_Config(SystemCoreClock/1000))
                    ^~~~~~~~~~~~~~~
stdout
Standard output is empty