avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] odd behaviour with type casting


From: Paul Thomas
Subject: Re: [avr-gcc-list] odd behaviour with type casting
Date: Fri, 24 Feb 2012 09:26:15 -0700

On Thu, Feb 23, 2012 at 4:42 PM, Georg-Johann Lay <address@hidden> wrote:
> Paul Thomas schrieb:
>>
>> I'm getting very wrong math in one instance using a casting,  negative
>> numbers and a division. If I don't do any 1 of those three things it
>> works fine. This is with an atxmega32a4 using both the atmel avr-gcc
>> 4.5.1 (avr-gcc (AVR_8_bit_GNU_Toolchain_3.2.3_314) 4.5.1) as well as
>> 4.5.1 gcc built with the script from AvrFreaks. The code snippet to
>> demonstrate this is: ...
>
>
> Without a minimal example that *compiles* and is legal C code no one will be
> able to say anything about this.  Same for guessing the compiler options.
>
> With almost 99.9% certainty your problem is somewhere else; not in the
> arithmetic and not in the cast.
>
> 4.5.x has PR46779 and PR39633 open, for example, but with obfuscated code
> there is no clue...
>
> Johann

Here's the compiler options:
avr-gcc -gdwarf-2 -Wall -Wno-attributes -O2 -mmcu=atxmega32a4
-I./include -I../common/include    -c -o cpv.o cpv.c
avr-gcc -gdwarf-2 -Wall -Wno-attributes -O2 -mmcu=atxmega32a4
-I./include -I../common/include    -c -o ../common/avrpacket.o
../common/avrpacket.c
avr-gcc -gdwarf-2 -Wall -Wno-attributes -O2 -mmcu=atxmega32a4
-I./include -I../common/include    -c -o ../common/crc.o
../common/crc.c
avr-gcc -gdwarf-2 -Wall -Wno-attributes -O2 -mmcu=atxmega32a4
-I./include -I../common/include  -Wl,-Map,cpv.map -o cpv.elf cpv.o
../common/avrpacket.o ../common/crc.o
avr-objdump -h -S cpv.elf > cpv.lst

I'll try and reduce this to a simple program, that can be compiled.
The main thing is that uart_putchar (i.e. printf) is tied up in a
custom interrupt/dma library, but I can just use a simple uart_putchar
function for this.

thanks,
Paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]