We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, What exactly is the purpose for the functions in the file Serial.c (putchar(), getchar()) included w/ the Blinky example? Does the Keil C not have these itself? Or for that matter, the delay() function in Blinky.c uses printf directly, which works fine. Are these for illustrative purpose only? Confused - Todd
The point is that you may wish to rewrite these functions if you want the printf/scanf i/o to go somewhere other than the UART. The default getchar/putchar are included in the library and will be linked in unless you provide your own definition.
Stefan, So in this case, when printf is called, it uses the putchar included in the project, right? I somewhat knew this was the case, but I was expecting that there would have to be some sort of explicit linking to have the printf pick up the putchar in the project - I guess that happens automatically? Thanks - Todd
"So in this case, when printf is called, it uses the putchar included in the project, right?" Yes, that's the idea. "I somewhat knew this was the case, but I was expecting that there would have to be some sort of explicit linking to have the printf pick up the putchar in the project - I guess that happens automatically?" The linker tries to resolve external references in a predetermined order. If it finds a putchar in one of your .obj files it won't go looking for one in the standard library.
Thanks very much Stefan - Todd
Hi All, My problem is that the linker finds my versions of putchar and getchar but it still looks for them in the lib and of course finds them there. I then get the error message "multiple definitions of public symbols". What am I missing that will prevent the linker from continuing to look for them? Thank you Beverly