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

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

RE: [avr-gcc-list] optimization flags causes problems??


From: Ramazan Kerek
Subject: RE: [avr-gcc-list] optimization flags causes problems??
Date: Fri, 18 Apr 2008 09:29:55 +0300

I attached "Makefile" so  it will give more information about the flags
and some other options I am using.

About using the EEPROM from the lib avr-gcc provided: I used and saw
that
With -O0 flag eeprom memory write is done without problem.

Thanks

R Kerek


-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of David Brown
Sent: Thursday, April 17, 2008 4:25 PM
To: address@hidden
Subject: Re: [avr-gcc-list] optimization flags causes problems??

Ramazan Kerek wrote:
> Please see my comment on your questions below.
> 
> Best Regards
> 
> R. Kerek
> 
> 
> What compiler flags did you use?
> ->  -Wall, -gdwarf-2, -std=gnu99, -O0, -funsigned-char,
> -funsigned-bitfields, fpack-struct, -fshort-enums
> 

Try compiling with -mmcu=atmega128.  Without an appropriate -mmcu flag, 
the compiler doesn't know which chip you are targeting, and the 
<avr/io.h> include file will not get the right definitions for the port 
registers.

Are you actually including <avr/io.h>, or are you defining DDRA, PORTA, 
etc., manually yourself?  If you are, then you've probably defined them 
incorrectly (such as forgetting "volatile") - you should *always* use 
the definitions that come with the compiler/library.


> If you compile the code you gave, use -O0 and -Os, what is the
generated
> 
> assembly code?
> -I do not know how and where I can get the generated assembly code. I
am
> new to this environment.
> 

Add something like flags "-fverbose-asm, -Wa,-ahlsd=${basename address@hidden" 
to the flag line in your makefile.


> Incidentally, why are you writing your own eeprom functions rather
than 
> using the ones from the library?
> -I am trying not be much dependent on the libraries as possible since
I
> will be more flexible changing my own code.
>   

Sometimes it is useful to be independent of libraries, but other times 
it is just a waste of effort.  The avr-libc is very good - the code is 
compact and efficient.  You can expect that for the same function (and 
the same sort of implementation), the library code will be at least as 
good as anything you write yourself.  It will also work across the range

of avr devices, unlike your routines.  So unless you are thinking of 
using avr-gcc without avr-libc (theoretically possible), or writing code

that must work on different avr compilers, stick to the library 
functions for this sort of thing.

->**The project I am involved with only uses AT90CAN128, 


_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


Attachment: Makefile
Description: Makefile


reply via email to

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