[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] stdio is only partially functional
From: |
Sander Pool |
Subject: |
[avr-gcc-list] stdio is only partially functional |
Date: |
Mon, 17 Mar 2003 00:23:34 -0800 |
Hello,
I am finally enabling stdio on my mega128 project. I'm seeing some odd
behavior I hope you can help with. Somehow I can output individual
characters just fine but strings get clobbered.
When I do a sequence of calls like this:
fprintf(stdout, "fprintf\n");
fprintf_P(stdout, "fprintf_P\n");
fputs("fputs\n", stdout);
fputs_P("fputs_P\n", stdout);
fputc('X', stdout);
RL_USART_Putc1('Y');
RL_USART_Putc1('\n');
I get:
fS??.?d??'TA0"Q "P?a?"T?.?{??S.?lS??.?h??Y'?'?'/'????.''?'$/
"?"O"
_"o"?"Y" '^f "P?a?"T?.?{??S.?lS??.?h??Y'?'?'/'????.''?'$/"?"O"_"o
"?"Y
" '^XY
on my terminal. X, Y and \n are transmitted fine but the string prints
aren't even the right number of characters. I'm probably doing something
silly, I hope you can help me identify it. I init my streams like this:
int RL_tryout(char c)
{
if (c == '\n') {
// first output a carriage return
RL_tryout('\r');
}
loop_until_bit_is_set(UCSR1A, UDRE);
UDR1 = c;
}
void RL_USART_Init(uint16_t ubrr)
{
UBRR1H = ubrr >> 8;
UBRR1L = ubrr & 0xff;
UCSR1B = _BV(TXEN);
stdout = fdevopen(RL_tryout, NULL, 0);
stderr = stdout;
}
Thanks,
Sander
PS I know that only the _P routines should work in this case but I figured I
may as well try both.
Re: [avr-gcc-list] [ANN] WinAVR 20030312 Released, David Gay, 2003/03/13
Re: [avr-gcc-list] [ANN] WinAVR 20030312 Released, Volkmar Dierkes, 2003/03/16
- [avr-gcc-list] stdio is only partially functional,
Sander Pool <=