[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] strange behaviour of avr-ld, maybe a bug?
From: |
Massimiliano Cialdi |
Subject: |
[avr-gcc-list] strange behaviour of avr-ld, maybe a bug? |
Date: |
Mon, 14 Feb 2011 11:14:45 +0100 |
lets try this source file:
#include <stdint.h>
#include <avr/pgmspace.h>
static uint8_t data[] =
{
[0 ... 9] = 1,
[10 ... 99] = 2,
[100 ... 999] = 3,
[1000 ... 1499] = 4
};
static const uint8_t rodata[] PROGMEM =
{ [0 ... 31*1024] = 5 };
int main (void)
{
while(1)
{
__asm__ __volatile__ ("nop"); // do nothing
}
return (0);
}
rodata is used to fill the flash region.
In the linker script be sure the MEMORY command is:
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = 32K
data (rw!x) : ORIGIN = 0x800060, LENGTH = 2K
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 1K
}
text region is as long as 32KB, as atmega32's flash.
If you compile you will obtain a binary bigger than 32KB
I would expect a linker error like:
region `text' overflowed by xx bytes
if you run avr-size, you get:
AVR Memory Usage
----------------
Device: atmega32
Program: 33408 bytes (102.0% Full)
(.text + .data + .bootloader)
Data: 1500 bytes (73.2% Full)
(.data + .bss + .noinit)
flash is 102.0% Full... but linker doesn't warn
I know that .data is to be considered belonging to sram, but its initial
image is hold in flash, and according to my opinion this fact must be
take into account, otherwise the binary may not work
I tried both
avr-gcc 4.3.3 + binutils 2.19.1 and
avr-gcc 4.4.4 + binutils 2.20.1
with same results
the sample projeject is here:
http://dl.dropbox.com/u/7966431/test_avr-ld.tar.gz
it include test.c source, linker script and Makefile.
regards,
Max
- [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?,
Massimiliano Cialdi <=
- RE: [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?, Boyapati, Anitha, 2011/02/14
- RE: [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?, Massimiliano Cialdi, 2011/02/14
- Re: [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?, Erik Christiansen, 2011/02/14
- RE: [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?, Boyapati, Anitha, 2011/02/17
- A work-around Re: [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?, Erik Christiansen, 2011/02/17
- RE: A work-around Re: [avr-gcc-list] strange behaviour of avr-ld, maybe a bug?, Boyapati, Anitha, 2011/02/20
- Re: A work-around Re: [avr-gcc-list] strange behaviour of avr-ld,maybe a bug?, Erik Christiansen, 2011/02/21