fork download
  1. void init_led(void)
  2. {
  3. RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
  4. GPIOC->CRL &= ~(GPIO_CRL_MODE0_0);
  5. GPIOC->CRL |= GPIO_CRL_MODE0_1;
  6. GPIOC->CRL &= ~GPIO_CRL_CNF2;
  7. }
  8.  
  9. void init_pll(void)
  10. {
  11. RCC_DeInit();
  12. RCC_HSICmd(ENABLE);
  13. while(!RCC_GetFlagStatus(RCC_FLAG_HSIRDY));
  14. RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);
  15. RCC_PLLCmd(ENABLE);
  16. while(!RCC_GetFlagStatus(RCC_FLAG_PLLRDY));
  17. FLASH_SetLatency(FLASH_Latency_1);
  18. FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
  19. RCC_HCLKConfig(RCC_SYSCLK_Div1);
  20. RCC_PCLK1Config(RCC_HCLK_Div1);
  21. RCC_PCLK2Config(RCC_HCLK_Div1);
  22. RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
  23. while(RCC_GetSYSCLKSource() != 0x08);
  24. SystemCoreClockUpdate();
  25. }
  26.  
  27. void init_mcu(void)
  28. {
  29. init_pll();
  30. init_led();
  31. }
  32.  
  33. int main(void)
  34. {
  35. uint32_t i;
  36.  
  37. init_mcu();
  38. while(1)
  39. {
  40. GPIOC->ODR ^= GPIO_ODR_ODR0;
  41. for (i = 0; i < 1e5; i++)
  42. __asm("nop");
  43. }
  44. }
  45.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'init_led':
prog.c:3:3: error: 'RCC' undeclared (first use in this function)
   RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
   ^
prog.c:3:3: note: each undeclared identifier is reported only once for each function it appears in
prog.c:3:19: error: 'RCC_APB2ENR_IOPCEN' undeclared (first use in this function)
   RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
                   ^
prog.c:4:3: error: 'GPIOC' undeclared (first use in this function)
   GPIOC->CRL &= ~(GPIO_CRL_MODE0_0);
   ^
prog.c:4:19: error: 'GPIO_CRL_MODE0_0' undeclared (first use in this function)
   GPIOC->CRL &= ~(GPIO_CRL_MODE0_0);
                   ^
prog.c:5:17: error: 'GPIO_CRL_MODE0_1' undeclared (first use in this function)
   GPIOC->CRL |= GPIO_CRL_MODE0_1;
                 ^
prog.c:6:18: error: 'GPIO_CRL_CNF2' undeclared (first use in this function)
   GPIOC->CRL &= ~GPIO_CRL_CNF2;
                  ^
prog.c: In function 'init_pll':
prog.c:11:3: warning: implicit declaration of function 'RCC_DeInit' [-Wimplicit-function-declaration]
   RCC_DeInit();
   ^
prog.c:12:3: warning: implicit declaration of function 'RCC_HSICmd' [-Wimplicit-function-declaration]
   RCC_HSICmd(ENABLE);
   ^
prog.c:12:14: error: 'ENABLE' undeclared (first use in this function)
   RCC_HSICmd(ENABLE);
              ^
prog.c:13:10: warning: implicit declaration of function 'RCC_GetFlagStatus' [-Wimplicit-function-declaration]
   while(!RCC_GetFlagStatus(RCC_FLAG_HSIRDY));
          ^
prog.c:13:28: error: 'RCC_FLAG_HSIRDY' undeclared (first use in this function)
   while(!RCC_GetFlagStatus(RCC_FLAG_HSIRDY));
                            ^
prog.c:14:3: warning: implicit declaration of function 'RCC_PLLConfig' [-Wimplicit-function-declaration]
   RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);
   ^
prog.c:14:17: error: 'RCC_PLLSource_HSI_Div2' undeclared (first use in this function)
   RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);
                 ^
prog.c:14:41: error: 'RCC_PLLMul_6' undeclared (first use in this function)
   RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);
                                         ^
prog.c:15:3: warning: implicit declaration of function 'RCC_PLLCmd' [-Wimplicit-function-declaration]
   RCC_PLLCmd(ENABLE);
   ^
prog.c:16:28: error: 'RCC_FLAG_PLLRDY' undeclared (first use in this function)
   while(!RCC_GetFlagStatus(RCC_FLAG_PLLRDY));
                            ^
prog.c:17:3: warning: implicit declaration of function 'FLASH_SetLatency' [-Wimplicit-function-declaration]
   FLASH_SetLatency(FLASH_Latency_1);
   ^
prog.c:17:20: error: 'FLASH_Latency_1' undeclared (first use in this function)
   FLASH_SetLatency(FLASH_Latency_1);
                    ^
prog.c:18:3: warning: implicit declaration of function 'FLASH_PrefetchBufferCmd' [-Wimplicit-function-declaration]
   FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
   ^
prog.c:18:27: error: 'FLASH_PrefetchBuffer_Enable' undeclared (first use in this function)
   FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
                           ^
prog.c:19:3: warning: implicit declaration of function 'RCC_HCLKConfig' [-Wimplicit-function-declaration]
   RCC_HCLKConfig(RCC_SYSCLK_Div1);
   ^
prog.c:19:18: error: 'RCC_SYSCLK_Div1' undeclared (first use in this function)
   RCC_HCLKConfig(RCC_SYSCLK_Div1);
                  ^
prog.c:20:3: warning: implicit declaration of function 'RCC_PCLK1Config' [-Wimplicit-function-declaration]
   RCC_PCLK1Config(RCC_HCLK_Div1);
   ^
prog.c:20:19: error: 'RCC_HCLK_Div1' undeclared (first use in this function)
   RCC_PCLK1Config(RCC_HCLK_Div1);
                   ^
prog.c:21:3: warning: implicit declaration of function 'RCC_PCLK2Config' [-Wimplicit-function-declaration]
   RCC_PCLK2Config(RCC_HCLK_Div1);
   ^
prog.c:22:3: warning: implicit declaration of function 'RCC_SYSCLKConfig' [-Wimplicit-function-declaration]
   RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
   ^
prog.c:22:20: error: 'RCC_SYSCLKSource_PLLCLK' undeclared (first use in this function)
   RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
                    ^
prog.c:23:9: warning: implicit declaration of function 'RCC_GetSYSCLKSource' [-Wimplicit-function-declaration]
   while(RCC_GetSYSCLKSource() != 0x08);
         ^
prog.c:24:3: warning: implicit declaration of function 'SystemCoreClockUpdate' [-Wimplicit-function-declaration]
   SystemCoreClockUpdate();
   ^
prog.c: In function 'main':
prog.c:35:3: error: unknown type name 'uint32_t'
   uint32_t i;
   ^
prog.c:40:5: error: 'GPIOC' undeclared (first use in this function)
     GPIOC->ODR ^= GPIO_ODR_ODR0;
     ^
prog.c:40:19: error: 'GPIO_ODR_ODR0' undeclared (first use in this function)
     GPIOC->ODR ^= GPIO_ODR_ODR0;
                   ^
stdout
Standard output is empty