[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] Re: [avr-gcc-list] Odd itoa/strrev problem with ATmega853
From: |
Dmitry K. |
Subject: |
[avr-libc-dev] Re: [avr-gcc-list] Odd itoa/strrev problem with ATmega8535 |
Date: |
Sun, 15 Jun 2003 14:28:20 +1100 |
User-agent: |
KMail/1.5 |
At 15 Jun 2003 03:39 Josh Pieper wrote:
> I haven't tried reduce this problem to the most simple test case yet,
> but was wondering if anyone has seen something similar and has a tip.
> I'm using itoa on an ATmega8535 with the UART receive and timer 0
> compare interrupt enabled. Every 20 or 30 itoa's, it returns a string
> that is reversed. i.e. instead of "-49" it will return "94-".
>
> I'm using a cvs snapshot of avr-gcc and avr-libc dated 20030512.
>
> I have already verified that there is no way that the stack is
> overrunning data, and I am using SIGNAL to define the interrupt
> handlers. Any quick tips, or should I reduce it to a simple test case
> and post that?
>
Good afternoon!
I have checked up work "itoa" on the plate with ATmega163.
Works correctly, including "-49".
But on realization (itoa.S) there are two remarks:
1. There is no clearing "T" in a case when "radix" it is not equal 10. It
results, for example, in the following:
itoa(0, s, 10) --> "0"
itoa(-2, s, 8) --> "177776" (T was 0)
itoa(-2, s, 10) --> "-2" (T set 1)
itoa(-2, s, 8) --> "-177776"
2. Erroneous "radix" results in unpredictable consequences: a call "strrev"
with "value" as the address of a string. Apparently, instead of:
cpi r_radix, 2 ; no radix < 2
brlt terminate
it is necessary to put:
cpi r_radix, 2 ; no radix < 2
brlt n_terminate
Best wishes.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] Re: [avr-gcc-list] Odd itoa/strrev problem with ATmega8535,
Dmitry K. <=