So I've been reading about sdcc for last 2/3 days and there are plenty of bits and pieces scattered around.
I see that sdcc support printf through stdio.h for printing on serial terminal. However none of the source is clear about printf usage, Section about standards libs at http://sdcc.sourceforge.net/doc/sdccman.html/ is just not there :-/
I read that I need to implement putchar to support printf.
I suppose its simply done as:
1. Initialize Serial
TI = 0;
SBUF = char;
while (TI = 0);
For a first try that is enough (on an mcs51) for printing on a serial terminal.
However you may have a display or other device you want to use for stdout and thus need a different putchar.
It's also possible to use interrupts and fifos to communicate with the uart which requires a different putchar implementation.
Alos have a look in the device/lib/ directory at the *ser* files with several implementations for serial communication.
ok so printf uses putchar and prints the data accordingly:
for e.g. if I want to print on LCD I can implement putchar to put one character on LCD
I'll have a look at ser as well
Thank you :)