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

Redefining putchar ()

Hello All,

I'm using a Keil eval Cortex-M3 eval board and using uVision v4.23, and trying to redirect printf output so stdout displays on the lovely LCD display instead to the serial port. I have defined putchar in my main.c, but somewhat expectedly get several compiler errors as a result.

unsigned int putchar (unsigned int ch) {
        GLCD_DisplayChar(row, col, FONTINDEX, ch);
        return ch;
}

It seems that putchar is defined as a macro in <stdio.h> and my attempting to define a replacement results in errors as follows:

main.c(51): error: #79: expected a type specifier
main.c(51): error: #147-D: declaration is incompatible with "int putc(int, FILE *)" (declared at line 657 of "C:\Keil\ARM\RV31\Inc\stdio.h")
main.c(51): error: #141-D: unnamed prototyped parameters not allowed when body is present
main.c(52): error: #20: identifier "row" is undefined
Target not created

Several hours later I'm no closer to a solution. Apologies if the answer is something obvious - I'm rather new at this. Any help would be appreciated.

-Rob

Parents Reply Children
No data