public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Declaring new section
@ 2001-08-10  3:40 Robert Cragie
  2001-08-10  3:45 ` Andrew Lunn
  2001-08-10 10:03 ` Jonathan Larmour
  0 siblings, 2 replies; 3+ messages in thread
From: Robert Cragie @ 2001-08-10  3:40 UTC (permalink / raw)
  To: ecos-discuss

I needed to declare a new section for a specific SRAM device on my board. I
did this by the adding the following lines in the .ldi file:

// eCos memory layout - Tue Feb 29 14:25:49 2000

// This is a generated file - do not edit

#include <cyg/infra/cyg_type.inc>

MEMORY
{
    ram : ORIGIN = 0, LENGTH = 0x4000000
    rom : ORIGIN = 0x24000000, LENGTH = 0x80000
Added this line --->        sram : ORIGIN = 0x28001000, LENGTH = 0x0003F000
}

SECTIONS
{
    SECTIONS_BEGIN
    SECTION_rom_vectors (rom, 0x24000000, LMA_EQ_VMA)
    SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA)
    SECTION_data (ram, 0x800, FOLLOWING (.gcc_except_table))
    SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
Added this line --->    SECTION_sram (sram, 0x28001000, LMA_EQ_VMA)
    SECTIONS_END
}

This worked fine, but when I came to generate an S-record file (using
"arm-elf-objcopy -S -O srec myfile myfile.srec") for downloading, it added
in loads of S-records at 0x28000000, all 0. This screws up the ARM Boot
Monitor flash downloader, as it somehow assumes these should go where the
flash is at 0x24000000. I noticed that the .sram section (according to
"arm-elf-objdump -h myfile") is of type CONTENTS, ALLOC, LOAD, DATA.

There is obviously a bit of magick going on between the .ldi file and
target.ld - is there any way I can make the .sram section like the .bss
section, i.e. so it is cleared to zero and doesn't appear as downloadable?

Also, whilst we're on the subject, is there anyway to link in .a files
without having to physically include them in target.ld?

TIA

Robert Cragie
Design Engineer
Jennic Ltd.
Furnival Street
Sheffield
S1 4QT
United Kingdom
Tel: +44 (0) 114 281 4512
Fax: +44 (0) 114 281 2951
Mob: +44 (0) 7940 558520
mailto:rcc@jennic.com
http://www.jennic.com

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

* Re: [ECOS] Declaring new section
  2001-08-10  3:40 [ECOS] Declaring new section Robert Cragie
@ 2001-08-10  3:45 ` Andrew Lunn
  2001-08-10 10:03 ` Jonathan Larmour
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2001-08-10  3:45 UTC (permalink / raw)
  To: Robert Cragie; +Cc: ecos-discuss

> Also, whilst we're on the subject, is there anyway to link in .a files
> without having to physically include them in target.ld?

-l works. I use it all the time. When you have multiple libraries you may need
to use 

-Wl,--start-group $(LIBS) -Wl,--end-group

to make the link do mulitple passes.

        Andrew

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

* Re: [ECOS] Declaring new section
  2001-08-10  3:40 [ECOS] Declaring new section Robert Cragie
  2001-08-10  3:45 ` Andrew Lunn
@ 2001-08-10 10:03 ` Jonathan Larmour
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Larmour @ 2001-08-10 10:03 UTC (permalink / raw)
  To: Robert Cragie; +Cc: ecos-discuss

Robert Cragie wrote:
> 
> I needed to declare a new section for a specific SRAM device on my board. I
> did this by the adding the following lines in the .ldi file:
> 
> // eCos memory layout - Tue Feb 29 14:25:49 2000
> 
> // This is a generated file - do not edit
> 
> #include <cyg/infra/cyg_type.inc>
> 
> MEMORY
> {
>     ram : ORIGIN = 0, LENGTH = 0x4000000
>     rom : ORIGIN = 0x24000000, LENGTH = 0x80000
> Added this line --->        sram : ORIGIN = 0x28001000, LENGTH = 0x0003F000
> }
> 
> SECTIONS
> {
>     SECTIONS_BEGIN
>     SECTION_rom_vectors (rom, 0x24000000, LMA_EQ_VMA)
>     SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA)
>     SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA)
>     SECTION_data (ram, 0x800, FOLLOWING (.gcc_except_table))
>     SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
>     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
> Added this line --->    SECTION_sram (sram, 0x28001000, LMA_EQ_VMA)
>     SECTIONS_END
> }
> 
> This worked fine, but when I came to generate an S-record file (using
> "arm-elf-objcopy -S -O srec myfile myfile.srec") for downloading, it added
> in loads of S-records at 0x28000000, all 0. This screws up the ARM Boot
> Monitor flash downloader, as it somehow assumes these should go where the
> flash is at 0x24000000. I noticed that the .sram section (according to
> "arm-elf-objdump -h myfile") is of type CONTENTS, ALLOC, LOAD, DATA.
> 
> There is obviously a bit of magick going on between the .ldi file and
> target.ld - is there any way I can make the .sram section like the .bss
> section, i.e. so it is cleared to zero and doesn't appear as downloadable?

What matters is how it is declared when it is used, i.e. something is put
into it. If it is declared with 

.section ".sram","w",@nobits

Then that would probably ensure it had the right section attributes. Look
at the info files for gas ( e.g. "info as" ) and look up the .section
directive, for ELF.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

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

end of thread, other threads:[~2001-08-10 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-10  3:40 [ECOS] Declaring new section Robert Cragie
2001-08-10  3:45 ` Andrew Lunn
2001-08-10 10:03 ` Jonathan Larmour

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).