[ECOS] Help about adding new sections for ARM platform

llandre r&d@wawnet.biz
Sun Nov 17 08:16:00 GMT 2002


I had to introduce a couple of new sections in the memory layout called 
init_code and fixed_text (I use the eCos Configuration Tool 1.3.net). Here 
is the .mlt file:
-------------------------------------------------------
version 0
region ROM 0 200000 1 !
region SDRAM c000000 400000 0 !
section rom_vectors 0 1 0 1 1 0 1 0 0 0 !
section fixed_vectors 0 1 0 1 1 1 1 1 20 20 init_code init_code !
section init_code 0 4 0 1 0 0 0 1 fixed_text !
section fixed_text 0 1 1 0 1 1 0 1 c000000 text text !
section text 0 4 1 1 0 1 0 1 fini fini !
section fini 0 4 1 1 0 1 0 1 rodata rodata !
section rodata 0 4 1 1 0 1 0 1 rodata1 rodata1 !
section rodata1 0 4 1 1 0 1 0 1 fixup fixup !
section fixup 0 4 1 1 0 1 0 1 gcc_except_table gcc_except_table !
section gcc_except_table 0 4 1 1 0 1 0 1 data data !
section data 0 4 1 1 0 1 0 1 bss bss !
section bss 0 4 1 1 0 1 0 0 heap1 !
section heap1 0 8 0 0 0 0 0 0 !
-------------------------------------------------------

I changed the file arm.ld accordingly, that is I added the two macros:
-------------------------------------------------------
#define SECTION_init_code(_region_, _vma_, _lma_) \
     .init_code _vma_ : _lma_ \
     { _sinit_code = ABSOLUTE(.); \
     PROVIDE (__sinit_code = ABSOLUTE(.)); \
     *(.init_code) } \
     > _region_ \
     __rom_init_code_start = LOADADDR (.init_code); \
     _einit_code = .; PROVIDE (__einit_code = .);

#define SECTION_fixed_text(_region_, _vma_, _lma_) \
     .fixed_text _vma_ : _lma_ \
     { _sfixed_text = ABSOLUTE(.); \
     PROVIDE (__sfixed_text = ABSOLUTE(.)); \
     *(.fixed_text) } \
     > _region_ \
     __rom_fixed_text_start = LOADADDR (.fixed_text); \
     _efixed_text = .; PROVIDE (__efixed_text = .);
-------------------------------------------------------

While the first one is recognized correctly, the second is not. Here is the 
.ldi file generated automatically:
-------------------------------------------------------
// eCos memory layout - Sun Nov 17 17:05:50 2002

// This is a generated file - do not edit

#include <cyg/infra/cyg_type.inc>

MEMORY
{
     ROM : ORIGIN = 0, LENGTH = 0x200000
     SDRAM : ORIGIN = 0xc000000, LENGTH = 0x400000
}

SECTIONS
{
     SECTIONS_BEGIN
     SECTION_rom_vectors (ROM, 0, LMA_EQ_VMA)
     SECTION_fixed_vectors (ROM, 0x20, LMA_EQ_VMA)
     SECTION_init_code (ROM, ALIGN (0x4), LMA_EQ_VMA)
     CYG_LABEL_DEFN(__fixed_text) = 0xc000000;
     SECTION_text (SDRAM, ALIGN (0x4), AT (__fixed_text + 0))
     SECTION_fini (SDRAM, ALIGN (0x4), FOLLOWING (.text))
     SECTION_rodata (SDRAM, ALIGN (0x4), FOLLOWING (.fini))
     SECTION_rodata1 (SDRAM, ALIGN (0x4), FOLLOWING (.rodata))
     SECTION_fixup (SDRAM, ALIGN (0x4), FOLLOWING (.rodata1))
     SECTION_gcc_except_table (SDRAM, ALIGN (0x4), FOLLOWING (.fixup))
     SECTION_data (SDRAM, ALIGN (0x4), FOLLOWING (.gcc_except_table))
     SECTION_bss (SDRAM, ALIGN (0x4), FOLLOWING (.data))
     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
     SECTIONS_END
}
-------------------------------------------------------

For the fixed_text section I expected a line like this
SECTION_fixed_text (SDRAM, 0xc000000, FOLLOWING(.init_code))
but instead I get this one
CYG_LABEL_DEFN(__fixed_text) = 0xc000000;

The obvious consequence is that the target.ld script is incorrect too.

Anybody can help me?
Is there a document that explains how the Configuration Tool manages the 
linker stuff?

Many thanks in advance.


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



More information about the Ecos-discuss mailing list