> Hi.
>
>>
>> I have serial output on the C8051F330 board RDM6300 working via
>> putchar() (see attached code). But whenever I try to use printf(),
>> everything gets messed up: Garbage output on the serial line or the
>> device resets.
>
> That is exactly the same behaviour I got on the F330. My code is a mess
> but it triggers exactly in the same way.
>
>>
>> I've tried different memeory models and reentrency, but don't see a
>> change in behaviour. printf() takes us over 4K of flash, but the
>> C8051F330 has 8KB, so we should be ok.
>>
>> Philipp
>
> I used my own function to send strings and tried all kinds of tricks but
> couldn't get around this issue. The Keil compiler that you get with the
> Silabs Simplicity Studio works without any problems for me. Maybe it
> would be worth porting your small example to Keil and see the difference
> in assembly ?
>
> MvH
> Benjamin Larsson

See my earlier comments. You can't just dump your data into SBUF without
checking it is free. A simple solution is to set TI initially, then in
putchar wait for TI to be set, clear it and place the char into SBUF. A
real solution would use interrupts and fifo ringbuffers for transmission
and reception.

Maarten

------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to