This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Declaring new section


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]