I am using mcs51 port of SDCC v2.9 for Windows 2000 released on the web as is without any source modifications.
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Mar 22 2009) (MINGW32)
My target board: Infineon XC878 (8051 Core)
I am trying to print some data on the hyper terminal using the following code:
extern void uart_init(void);
int i = 10;
char c = 's';
char str = "Hello World !!!";
printf("integer(10) = %d\r\n",i);
printf("char(s) = %c\r\n",c);
printf("str(Hello World !!!) = %s \r\n",str);
Output Obtained: int
Where as expected output:
integer(10) = 10
char(s) = s
str(Hello World !!!) = Hello World !!!
putchar() and UART initializations are part of the project.
printf() output is NOT correct in small,medium,large models. However, If I replace printf() with printf_small(), I get the
expected output in small model only but does not work with medium,large.
Question: Is there a printf routine that works with small, medium and large? In sdccman.pdf sec 184.108.40.206 is good but does
not specify any limitations on the memory models support for these routines.
Any help to resolve this is much appreciated. Thanks in advance.
sdcc -mmcs51 --model-small -c Printf_Test.c -o .\model_small_output\
sdcc -mmcs51 --model-small -c putchar.c -o .\model_small_output\
sdcc -mmcs51 --model-small -c UART.c -o .\model_small_output\
sdcc -mmcs51 --model-small .\model_small_output\Printf_Test.rel .\model_small_output\putchar.rel
.\model_small_output\UART.rel --xram-loc 0xF000 --xram-size 0xC00 -Wl -bBSEG=0x20 --idata-loc 0x80 -o
BTW, Is there a way to include attachments while posting a message?
Thanks & Best Regards,
I'd get rid of --idata-loc 0x80. It's not necessary.
Does the XC878 have an internal watchdog that's enabled by default?
The forum has no option to include attachments, the tracker system does.
Thanks for your reply. XC878 has an internal watchdog but it is NOT enabled by default.
printf() problem is NOT solved yet. But I could get printf_small() working with large and medium as below:
XC878-16FF processor has XRAM in memory bank 0x1F. So a SFR MEX3 has to initialized with 0x1F. With this initialization, printf_small() works fine in all memory models.
Thanks & Regards,
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.