[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Code Size Causes Crash?
From: |
Dmitry K. |
Subject: |
Re: [avr-gcc-list] Code Size Causes Crash? |
Date: |
Fri, 28 Jan 2005 08:38:40 +1000 |
User-agent: |
KMail/1.5 |
On Friday 28 January 2005 05:51, Kevin Neff wrote:
> On Thu, 27 Jan 2005, Dmitry K. wrote:
> > On Thursday 27 January 2005 04:58, Kevin Neff wrote:
> > [...]
> >
> > > While investigating this problem, I made a simple program to test code
> > > size (which is included below). I've incremented and deincremented 'i'
> > > many times to increase the code size. with 404 increment and decrement
> > > statements, the code is run correctly (the LED blinks). The addition
> > > of one statement beyond that breaks the program.
> >
> > [...]
> >
> > > avr-objcopy --strip-all -O ihex main.elf main.hex
> > > text data bss dec hex filename
> > > 4312 0 0 4312 10d8 main.elfa
> > >
> > > avr-gcc -mmcu=atmega128 -Wl,-Map=main.map,--cref main.o -o main.elf
> > > avr-objcopy --strip-all -O ihex main.elf main.hex
> > > text data bss dec hex filename
> > > 4322 0 0 4322 10e2 main.elf
> >
> > 4322 ? What is the version of your compiler?
> >
> > I have try compile this program with 3.3.4 .
> > First, text size was 4312 bytes (the same as you).
> > But after addition of one statement -- 4324 bytes.
> > Difference is 22 bytes: 20 -- statement themselves,
> > and 2 -- `rjmp' is replaced to `jmp'.
Sorry, a misprint:
Difference is 12 bytes: 10 -- statement themselves,
and 2 -- `rjmp' is replaced to `jmp'.
> # avr-gcc --version
> avr-gcc (GCC) 3.4.2
I have try 3.4.2 . Result is correct.
I believe so you forget to use option `-mmcu=atmega128' by compilation.
Default is `avr2' -- code for 4Kwords chips. On such chips rjmp may
be -4..+4 Kwords, in contrast to mega128 -- -2..+2 Kwords.
Regards.