This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

function definition in KEIL problem

Hello i am including rcc_config.h file which has the following functions as shown in the attached code.

But Keil gives me the follwing errors

what should i do with those warnings if i want to use thos functions in the H file inside main.c?

Thanks.

void SysClockConfig (void)
{
		/****>>>>>>> STEPS FOLLOWED <<<<<<<<*****
	
	1. ENABLE HSE and wait for the HSE to become Ready
	2. Set the POWER ENABLE CLOCK and VOLTAGE REGULATOR
	3. Configure the FLASH PREFETCH and the LATENCY Related Settings
	4. Configure the PRESCALARS HCLK, PCLK1, PCLK2
	5. Configure the MAIN PLL
	6. Enable the PLL and wait for it to become ready
	7. Select the Clock Source and wait for it to be set
	
	********************/
	
	
	#define PLL_M 	4
	#define PLL_N 	180
	#define PLL_P 	0  // PLLP = 2

	// 1. ENABLE HSE and wait for the HSE to become Ready
	RCC->CR |= RCC_CR_HSEON;  // RCC->CR |= 1<<16; 
	while (!(RCC->CR & RCC_CR_HSERDY));  // while (!(RCC->CR & (1<<17)));
	
	// 2. Set the POWER ENABLE CLOCK and VOLTAGE REGULATOR
	RCC->APB1ENR |= RCC_APB1ENR_PWREN;  // RCC->APB1ENR |= 1<<28;
	PWR->CR |= PWR_CR_VOS;  // PWR->CR |= 3<<14; 
	
	
	// 3. Configure the FLASH PREFETCH and the LATENCY Related Settings
	FLASH->ACR = FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN | FLASH_ACR_LATENCY_5WS;  // FLASH->ACR = (1<<8) | (1<<9)| (1<<10)| (5<<0);
	
	// 4. Configure the PRESCALARS HCLK, PCLK1, PCLK2
	// AHB PR
	RCC->CFGR |= RCC_CFGR_HPRE_DIV1;  // RCC->CFGR &= ~(1<<4);
	
	// APB1 PR
	RCC->CFGR |= RCC_CFGR_PPRE1_DIV4;  // RCC->CFGR |= (5<<10);
	
	// APB2 PR
	RCC->CFGR |= RCC_CFGR_PPRE2_DIV2;  // RCC->CFGR |= (4<<13);
	
	
	// 5. Configure the MAIN PLL
	RCC->PLLCFGR = (PLL_M <<0) | (PLL_N << 6) | (PLL_P <<16) | (RCC_PLLCFGR_PLLSRC_HSE);  // (1<<22);

	// 6. Enable the PLL and wait for it to become ready
	RCC->CR |= RCC_CR_PLLON;  // RCC->CR |= (1<<24);
	while (!(RCC->CR & RCC_CR_PLLRDY));  // while (!(RCC->CR & (1<<25)));
	
	// 7. Select the Clock Source and wait for it to be set
	RCC->CFGR |= RCC_CFGR_SW_PLL;  // RCC->CFGR |= (2<<0);
	while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL);  // while (!(RCC->CFGR & (2<<2)));
}


void GPIO_Config (void)
{
	/**** STEPS FOLLOWED *****
	1. Enable the GPIO CLOCK
	2. Set the Pin as OUTPUT
	3. Configure the OUTPUT MODE
	*************/
	
	// 1. Enable the GPIO CLOCK
	//RCC->AHB1ENR |= (1<<0);  
	RCC->AHB1ENR|=RCC_AHB1ENR_GPIODEN;
	// 2. Set the Pin as OUTPUT
	//GPIOA->MODER |= (1<<10);  // pin PA5(bits 11:10) as Output (01)
	  GPIOD->MODER &=~(0x1UL<<31U);
	  GPIOD->MODER |=(0x1UL<<30U);
	// 3. Configure the OUTPUT MODE
	GPIOD->OTYPER = 0;
	GPIOD->OSPEEDR = 0;
}

void delay (volatile uint32_t time)
{
	while (time--);
	 
}

Build started: Project: less02_NO_HALL
*** Using Compiler 'V6.15', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Target 1'
main.c(1): warning: In file included from...
./rcc_config.h(43): warning: no previous prototype for function 'SysClockConfig' [-Wmissing-prototypes]
void SysClockConfig (void)
^
./rcc_config.h(43): note: declare 'static' if the function is not intended to be used outside of this translation unit
void SysClockConfig (void)
^
static
./rcc_config.h(98): warning: no previous prototype for function 'GPIO_Config' [-Wmissing-prototypes]
void GPIO_Config (void)
^
./rcc_config.h(98): note: declare 'static' if the function is not intended to be used outside of this translation unit
void GPIO_Config (void)
^
static
./rcc_config.h(122): warning: no newline at end of file [-Wnewline-eof]
}
^
./rcc_config.h(118): warning: no previous prototype for function 'delay' [-Wmissing-prototypes]
void delay (volatile uint32_t time)
^
./rcc_config.h(118): note: declare 'static' if the function is not intended to be used outside of this translation unit
void delay (volatile uint32_t time)
^
static
4 warnings generated.
compiling main.c...
linking...
Program Size: Code=376 RO-data=408 RW-data=0 ZI-data=1632
".\Objects\less02_NO_HALL.axf" - 0 Error(s), 4 Warning(s).
Build Time Elapsed: 00:00:01

Parents
  • It is required:

    - ...to know the Keil product and version, as well as the target and Pack in use

    - ...to see the context of your rcc_config.h implementation

    Beside, I recommend to see:

       "Automatic function inlining and static functions" 

        www.keil.com/support/man/docs/armcc/armcc_chr1359124226591.htm

    as part of the Compiler User Guide.

Reply
  • It is required:

    - ...to know the Keil product and version, as well as the target and Pack in use

    - ...to see the context of your rcc_config.h implementation

    Beside, I recommend to see:

       "Automatic function inlining and static functions" 

        www.keil.com/support/man/docs/armcc/armcc_chr1359124226591.htm

    as part of the Compiler User Guide.

Children