public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] linker script problem
@ 2005-04-22  9:49 Neundorf, Alexander
  2005-04-22 10:04 ` GONZALEZ Laurent
  0 siblings, 1 reply; 3+ messages in thread
From: Neundorf, Alexander @ 2005-04-22  9:49 UTC (permalink / raw)
  To: ecos-discuss

Hi,

in my application now more or less the complete available RAM is used and a second RAM had to be added.
The ldi file now looks like this with a new section "ram2":

#include <cyg/infra/cyg_type.inc>

MEMORY
{
    ram  : ORIGIN = 0x00000000, LENGTH = 0x04000000
    ram2 : ORIGIN = 0x04000000, LENGTH = 0x04000000
}

SECTIONS
{
    SECTIONS_BEGIN
    SECTION_fixed_vectors	(ram, 0x20, LMA_EQ_VMA)
    SECTION_rom_vectors		(ram, 0x20000, LMA_EQ_VMA)
    SECTION_text		(ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fini		(ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata		(ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata1		(ram, ALIGN (0x4), LMA_EQ_VMA)
    .romfs ALIGN(0x20) :	{*(.romfs)} > ram
    SECTION_fixup		(ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_gcc_except_table	(ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_data		(ram, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_bss			(ram, ALIGN (0x4), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
    .ram2 (NOLOAD)		:        {*(.ram2)} > ram2
    SECTIONS_END
}

Now it works, but the produced elf file has become 32 MB bigger (from 5 to 37 MB). That's the size of the buffer I placed in the new ram2 section:

char RealBigBuffer[0x2000000} __attribute__ ((section("ram2")));

When this buffer was still in the default data section the elf file didn't "include" all this space.

This is what the list file says:

-----%<---------------------------------------------------
testapp:     file format elf32-littlearm
testapp
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00020040

...
 17 .ram2         020000fa  04000000  04000000  00040000  2**0
                  CONTENTS, ALLOC, LOAD, DATA
...
040000fa g     O .ram2	02000000 RealBigBuffer
...
04000000 g     O .ram2	000000fa Buffer

----%<----------------------------------------------------

Is this the intended behaviour ? Is there a way to remove the 32 MB for this buffer from the elf file ?

Any hints are very much appreciated
Alex

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] linker script problem
  2005-04-22  9:49 [ECOS] linker script problem Neundorf, Alexander
@ 2005-04-22 10:04 ` GONZALEZ Laurent
  0 siblings, 0 replies; 3+ messages in thread
From: GONZALEZ Laurent @ 2005-04-22 10:04 UTC (permalink / raw)
  To: ecos-discuss

On Fri, 22 Apr 2005 11:20:08 +0200
"Neundorf, Alexander" <Alexander.Neundorf@jenoptik.com> wrote:

> 
> SECTIONS
> {
>     SECTIONS_BEGIN
>     SECTION_fixed_vectors	(ram, 0x20, LMA_EQ_VMA)
>     SECTION_rom_vectors		(ram, 0x20000, LMA_EQ_VMA)
>     SECTION_text		(ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_fini		(ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_rodata		(ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_rodata1		(ram, ALIGN (0x4), LMA_EQ_VMA)
>     .romfs ALIGN(0x20) :	{*(.romfs)} > ram
>     SECTION_fixup		(ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_gcc_except_table	(ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_data		(ram, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_bss			(ram, ALIGN (0x4), LMA_EQ_VMA)
>     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
>     .ram2 (NOLOAD)		:        {*(.ram2)} > ram2
>     SECTIONS_END
> }
> 
...
> 
> This is what the list file says:
> 
> -----%<---------------------------------------------------
> testapp:     file format elf32-littlearm
> testapp
> architecture: arm, flags 0x00000112:
> EXEC_P, HAS_SYMS, D_PAGED
> start address 0x00020040
> 
> ...
>  17 .ram2         020000fa  04000000  04000000  00040000  2**0
>                   CONTENTS, ALLOC, LOAD, DATA
> ...
> 040000fa g     O .ram2	02000000 RealBigBuffer
> ...
> 04000000 g     O .ram2	000000fa Buffer

I'am afraid that .ram2 section is loadable.

My guess is that your .ram2 section also contains an initialized variable (Buffer?), thus the whole section is tagged "CONTENTS, ALLOC, LOAD, DATA" like another .data section.

yours,

-- 
GONZALEZ Laurent
------------------------------------
Real-Time OS Team Leader
TRANGO Systems - Groupe ELSYS Design
74, avenue des Martyrs
38000 Grenoble
Tel: 33 (0)4 76 12 28 44
Fax: 33 (0)4 76 12 28 49
http://www.trango-systems.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] linker script problem
  2005-04-22 10:54 AW: " Neundorf, Alexander
@ 2005-04-22 12:17 ` GONZALEZ Laurent
  0 siblings, 0 replies; 3+ messages in thread
From: GONZALEZ Laurent @ 2005-04-22 12:17 UTC (permalink / raw)
  To: Neundorf, Alexander; +Cc: ecos-discuss

alexander,

On Fri, 22 Apr 2005 12:04:01 +0200
"Neundorf, Alexander" <Alexander.Neundorf@jenoptik.com> wrote:

> Hi Laurent, 
> 
> > Von: ecos-discuss-owner@ecos.sourceware.org
> > [mailto:ecos-discuss-owner@ecos.sourceware.org]Im Auftrag von GONZALEZ
> > Laurent
> ....
> > > This is what the list file says:
> > > 
> > > -----%<---------------------------------------------------
> > > testapp:     file format elf32-littlearm
> > > testapp
> > > architecture: arm, flags 0x00000112:
> > > EXEC_P, HAS_SYMS, D_PAGED
> > > start address 0x00020040
> > > 
> > > ...
> > >  17 .ram2         020000fa  04000000  04000000  00040000  2**0
> > >                   CONTENTS, ALLOC, LOAD, DATA
> > > ...
> > > 040000fa g     O .ram2	02000000 RealBigBuffer
> > > ...
> > > 04000000 g     O .ram2	000000fa Buffer
> > 
> > I'am afraid that .ram2 section is loadable.
> > 
> > My guess is that your .ram2 section also contains an 
> > initialized variable (Buffer?), thus the whole section is 
> > tagged "CONTENTS, ALLOC, LOAD, DATA" like another .data section.
> 
> Initialized in which way ?
> Could you please explain a bit more ?
> 

Buffer might have been initialized in your C code by a statement like:
char Buffer[0xfa] = "Hallo welt\n";

However, the most important thing is that the .ram2 section has wrong attributes despite the presence of (NOLOAD) type specifier ! I only suggested that it could comes from some initialized data.

What does your target.ld file looks like ? Are you sure that it is properly generated, or that you really use the good one when your application links ?

-- 
GONZALEZ Laurent
-----------------------------------------
Real-Time OS Team Leader
TRANGO Systems - ELSYS Design Group
74, avenue des Martyrs
38000 Grenoble
Tel: 33 (0)4 76 12 28 44
Fax: 33 (0)4 76 12 28 49
-----------------------------------------
Trango, the real-time embedded hypervisor
http://www.trango-systems.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-22 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-22  9:49 [ECOS] linker script problem Neundorf, Alexander
2005-04-22 10:04 ` GONZALEZ Laurent
2005-04-22 10:54 AW: " Neundorf, Alexander
2005-04-22 12:17 ` GONZALEZ Laurent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).