Hello Everyone,
I have an error message that seems easy to fix, but I have used all of my brain cells trying to figure this out after a couple of days.
I have the Keil IDE with the ARM® Compiler toolchain Version 5.02
The processor is a stm32f303
This is my error message.
UART STM32F3.axf: Error: L6218E: Undefined symbol ucInputBuffer (referred from routine.o).
The "ucInputBuffer" is my own variable.
I have the #include "routine.h" where the "ucInputBuffer" is declared.
Inside the "routine.h" file I declare the variable like shown below.
extern volatile unsigned char ucInputBuffer;
This is my compiler control string.
-c --cpu Cortex-M4.fp -g -O0 --apcs=interwork -I..\STM32F3 -I C:\Keil\ARM\RV31\INC -I C:\Keil\ARM\CMSIS\Include -I C:\Keil\ARM\Inc\ST\STM32F30x -o "*.o" --omf_browse "*.crf" --depend "*.d"
This is the linker control string.
--cpu Cortex-M4.fp *.o --strict --scatter "UART STM32F3.sct" --summary_stderr --info summarysizes --map --xref --callgraph --symbols --info sizes --info totals --info unused --info veneers --list ".\UART STM32F3.map" -o "UART STM32F3.axf"
Any ideas anyone???
Thankyou
But the message is not talking about declarations - is it?
The message says that you have not defined it...
http://www.keil.com/forum/21995
'extern' tells the compiler that there is a variable declared somewhere else that is of that type, but it doesn't actually reserve the memory.
This allows code to reference variables not declared in its local scope.
When the linker goes to stitch everything together and resolve the references, it's looking for the actual variable which must be declared (once and only once).
You're missing the line in a C file where you declare your variable:
volatile unsigned char ucInputBuffer;
(Note the lack of 'extern'.)
"it's looking for the actual variable which must be declared (once and only once)"
You mean defined - not just declared.
"You're missing the line in a C file where you declare (sic) your variable"
Again - it needs a definition (but doesn't actually care about it being in a .c file).
You're right.
It's a shame the original authors of the C language chose words that don't really map to the English definitions. Particularly when they chose 'define' to mean instantiate, and 'declare' to mean describe the details of (when both words generally mean to describe the details of and neither one of them hint at instantiation).
I constantly stumble on these two words too. Their normal meaning is too close to make it easy to map them to their specific meaning in terms of C source code.
IGOR;
Maybe you should learn to use the tools before complaining over much. Keil supports backup *BAK files. Keil supports save on exit, save on compile and save when you damn well want to save. I can't think of another save option that you might need except SVN and Keil supports that as a add-on tool.
Bradford
Ooo-err - what's happened there?!
My post seems to have grabbed the text of Al Bradford's post in another thread!!
What I actually said was:
The Compiler wants declarations, so it will talk about declarations in its messages.
The Linker wants definitions, so it will talk about definitions in its messages.
Both posts 21:14.
So now we know that Keil don't use a thread-safe method to allocate the ID for the next post in the database. All it needs are two "post" that happens near enough that they get concurrently processed by the web server.
Atomic operations are among the first things to consider when implementing web services. There are a number of tricks available to get even stupid databases to supply unique new record ID:s to concurrently running threads without collisions when two posts needs to be created and post A points to post B and post B points to post A. Or in this case the "thread" record points to the first post record, while the post record points to the owning thread record.
Web scripts can't be written as if they own the database, since almost all web servers supports concurrent servicing of web pages.
Andrew;
I do not know what happened but I sure did not want to get involved with this post. Don't plan to try to do anything about it. I'll just join Igor in his rant.
Thank-you for that explanation. It was well done and helped me to understand the difference between declaring and definition.