public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Jonathan Larmour <jlarmour@redhat.com>
To: Robert Cragie <rcc@jennic.com>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Declaring new section
Date: Fri, 10 Aug 2001 10:03:00 -0000	[thread overview]
Message-ID: <3B7413C3.EB72741A@redhat.com> (raw)
In-Reply-To: <NDBBLOIOMLKELOJBAPAGGEBDCIAA.rcc@jennic.com>

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

      parent reply	other threads:[~2001-08-10 10:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-10  3:40 Robert Cragie
2001-08-10  3:45 ` Andrew Lunn
2001-08-10 10:03 ` Jonathan Larmour [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B7413C3.EB72741A@redhat.com \
    --to=jlarmour@redhat.com \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=rcc@jennic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).