This is the mail archive of the ecos-discuss@sourceware.org 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]
Other format: [Raw text]

Re: Guidance on ROMRAM ldi


On 19/11/2010 19:37, Michael Bergandi wrote:
Hi all,

I am trying to learn more about the linker file used in a ROMRAM
configuration. I have looked at several other ROMRAM ldi files for the
ARM, but I can't seem to find much agreement as to the proper way to
set up the SECTIONS section.

Our board has 2MB ROM and 32MB RAM and uses an iMX27 (ARM9) processor.
The current ldi file is adapted from a Freescale Redboot port to the
iMX27 LiteKit and looks like this:

MEMORY
{
     ram : ORIGIN = 0, LENGTH = 0x02000000
     rom : ORIGIN = 0xA1E00000, LENGTH = 0x00200000
}

SECTIONS
{
     SECTIONS_BEGIN
     SECTION_rom_vectors (rom, 0xA1E00000, 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_sram (ram, 0x8000, FOLLOWING (.gcc_except_table))
     SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA)
     SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
     SECTIONS_END
}

If I understand correctly, the lengths provided from rom and ram in
the MEMORY section should be the actual size without concession for a
copy of ROM that would consume a portion of the RAM.

The rom ORIGIN is an offset into the RAM (which is mapped to both
0x00000000 and 0xA0000000). We want our app to be loaded to the end of
the RAM.

In some of the other ROMRAM ldi files I looked at, the SECTION
declarations use only 'ram' and not 'rom'. I'm thinking this may not
matter depending on the order and SECTION declaration options
(assuming you are only working with a single chunk off RAM). Is this
thinking correct?
In my romram.ldi file, there is no ROM part, which is correct: a romram application starts with (as first instructions) to copy itself from rom to ram.
You also have no actual ROM part, as the name "rom" refers to the place in RAM where the application will be. So this is ok.
I don't need this because our app is loaded at the start from the RAM.


I have also seen some discussion in the archives suggesting that using
LMA_EQ_VMA is not the right thing to use. Is there  a final word on
this? Should I use only FOLLOWING, as I have seen elsewhere?
I don't know, but also would like to know ;-).
We don't have a VMM in our ARM7.
I think that if you want to use the VMM of your ARM9, you should not use LMA_EQ_VMA (linear equals virtual) for all parts.
Is there some general rules of thumb on setting up the SECTION
declarations to avoid common mistakes/problems?

Any advice is welcome.
Below the romram.ldi and .h of my ARM7 design (based on eb55 in ecos), maybe it could help..

MEMORY
{
    sram : ORIGIN = 0x00000000, LENGTH = 0x2000
    ram  : ORIGIN = 0x06000000, LENGTH = 0x400000
}

SECTIONS
{
    SECTIONS_BEGIN
    SECTION_fixed_vectors (sram, 0x20, LMA_EQ_VMA)
    SECTION_rom_vectors (ram, 0x06000000, 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)
    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);
    SECTIONS_END
}


#ifndef __ASSEMBLER__ #include <cyg/infra/cyg_type.h> #include <stddef.h>

#endif
#define CYGMEM_REGION_ram (0x06000000)
#define CYGMEM_REGION_ram_SIZE (0x00400000)
#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__heap1) [];
#endif
#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
#define CYGMEM_SECTION_heap1_SIZE (0x06400000 - (size_t) CYG_LABEL_NAME (__heap1))



Thank you,



--
Jürgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045    Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk



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


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