avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] linker builds file too big, is it a bug?


From: Massimiliano Cialdi
Subject: Re: [avr-chat] linker builds file too big, is it a bug?
Date: Mon, 14 Feb 2011 10:03:35 +0100

Il giorno dom, 13/02/2011 alle 23.41 +1100, Erik Christiansen ha
scritto:

> But the avr-specific VMA shouldn't affect LMA arithmetic, so that's no
> excuse for not detecting memory region overflow, I do admit.
> 
> It's hard to believe that it has never checked for region overflow,
> despite the consistency of the older versions of ld tried so far.
I have updated my sample, at the same url:
http://dl.dropbox.com/u/7966431/test_avr-ld.tar.gz

now it fill 32KB flash space of an atmega32 micro.

test.c is modified as follows:
#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.

the linker script avr5_mega32.x is modified only in MEMORY command:

MEMORY
{
  text   (rx)   : ORIGIN = 0, LENGTH = 32K
  data   (rw!x) : ORIGIN = 0x800060, LENGTH = 2K
  eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 1K
}

now text region is as long as 32KB, as atmega32's flash.

If you compile you will obtain a binary bigger than 32KB, and 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 tried both
avr-gcc 4.3.3 + binutils 2.19.1 and
avr-gcc 4.4.4 + binutils 2.20.1
with same results


regards




reply via email to

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