Hi Everyone, I'm newbie about keil and ARM tools. I have STM32 discovery board and I want to build RTC clock with calendar which is controlled by RS232.
I have a problem when use exported functions which are defined in stm32f10x_XXX.h.
I prapare configration wizard to create STM32_Init.c. Enabled USART and RTC.
I got error message from compiler. "Error: L6218E: Undefined symbol RTC_EnterConfigMode (referred from main.o)." I search L6218E error code on form and everone said its about defination and library manegment.
I checked project explorer window and check "stm32f10x_rtc.h" file connected to main.c . I can't use any other stm32f10x_XXX.h libraries exported functions too.
This is code which I worked on it. Why I got L6218E ? Could u guide to me for this.
Best regards
/******************************************************************************************/ #include <stm32f10x_lib.h> // STM32F10x Library Definitions #include "STM32_Init.h" // STM32 Initialization #include "stdio.h" #include "string.h" int saniye=0; int dakika=59; int saat=11; // Time variable saniye-second dakika-minute saat-hour void SendChar (char text[]) ; // Send Char to RS232 void SendByte (int byte); // Send byte to RS232 char aName[] = "RTC over RS232\n\r"; char aTime[] = "Timer \n\r"; char buffer[] = "24 : 59 : 59\n\r"; /*---------------------------------------------------------------------------- MAIN function *----------------------------------------------------------------------------*/ int main (void) { stm32_Init (); // STM32 init while (1){ RTC_EnterConfigMode(); // PROBLEM is HERE. Without this line, Code Worked RTC_ExitConfigMode(); // PROBLEM is HERE Without this line, Code Worked if(GPIOA->IDR & (u32)(1<<0)) // Led 4 blink When push Button { GPIOC->BSRR=(u32)(1<<8); } else { GPIOC->BRR=(u32)(1<<8); } } } // end main void RTC_IRQHandler(void) //RTC interreupt handler to send Time data RS232 port every second { sprintf (buffer, "%d : %d : %d\n\r", saat,dakika,saniye); // Write Time variable to Buffer SendChar(aName); SendChar(buffer); if (RTC->CRL & (1<<0) ) { // check second flag RTC->CRL &= ~(1<<0); // clear second flag if(++saniye>=60){ // create time value with RTC interrupt and count time variale saniye=0; if(++dakika>=60){ dakika=0; if(++saat>=24) saat=0;} } if(GPIOC->IDR & (u32)(1<<9)){ //Toggle every sec LED3 GPIOC->BRR=(u32)(1<<9); } else GPIOC->BSRR=(u32)(1<<9); } } // end RTC_IRQHandler void SendChar ( char text[] ) { unsigned int i, len; len = strlen(text); for(i=0; i<len; i++) { SendByte(text[i]); } } void SendByte (int byte) { while (!(USART1->SR & USART_FLAG_TXE)); //Wait for the uart to finish sending the byte. USART1->DR = byte; }
.
Sorry Per Westermark,
I tought I reply bought.
******
If i understand correctly ,
stm32f10x_rtc.h has function prototype "void RTC_EnterConfigMode(void);". It's not source code.
You said , I have to write these source code in header file, right? These exported functions are just prototype for guidance?
If these are library file, they have to include sourse code on some where right? Where is source of functions. I tought it will be easy when I saw exported functions.
In the source (.c) file you place the implementation of a function:
void RTC_EnterConfigMode(void) { // your implementation }
in the respective header file, you tell the compiler how it should be used - note that without a prototype in a header file, a function is not more than a resolved memory address anybody can call - even delivering the wrong number of parameters to a function (not a good idea...).
So in the header file (.h) you place
extern void RTC_EnterConfigMode(void) ;