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]
Other format: [Raw text]

RE: Help about adding new sections for ARM platform


Llandre:

I have included a corrected ".mlt" file that does what you want.  The key
item here is the linker-defined vs. user-defined section (go figure).  It
seems that in order to get the SECTION_<section_name> definition you must
specify the section as linker-defined.

I also corrected the .bss section -- it is not relocated, as it only exists
in RAM, not in the ROM image.

As far as the ".mlt" file syntax, I originally thought as you did, but
realized that it really is <VMA-start> <VMA-next> <LMA-start> <LMA-next>,
with the exception of the first section, which defines all four parameters.
This section is typically the "rom_vectors" section, but in your case it is
the "fixed_vectors".  This just doesn't seem right, so I suspect that there
is more to the syntax encoding that what we've deduced so far.  The source
code for the Memory Layout Tool should be the authority on the issue
(documented in the code).  Does anyone know where it is?

Note: I copied my original reply to the ecos-discuss list, but the redhat
mail server bounced it, because it didn't like the html file that I
attached.

Here is the corrected "<TARGET>_romram.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 4 1 1 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 0 bss !
section bss 0 4 0 1 0 1 0 1 heap1 heap1 !
section heap1 0 8 0 0 0 0 0 0 !

Jay


-----Original Message-----
From: llandre [mailto:r&d@wawnet.biz]
Sent: Tuesday, November 19, 2002 3:25 AM
To: Jay Foster
Subject: RE: [ECOS] Help about adding new sections for ARM platform


Hi Jay,

thanks for your help.
Your understanding is correct. I had to place the ROM at 0 because the 
processor I'm working with is not able to perform any remap. In other words 
the external ROM is always at 0.
To port eCos on this CPU, we had to change the HAL (in particular the 
vectors.S file) and we introduced a new section called init_code (see 
attached file ROMRAM_layout1.jpg). It is in ROM and it is not relocated.
Everything worked fine with this configuration.

Now, for other reasons, we want to add a new section (fixed_text). The 
situation is illustrated by ROMRAM_layout2.jpg. This section is placed in 
ROM and it is relocated in RAM at startup. With this new configuration we 
have the problem I described in my mail to ecos-discuss mailing list that 
is still  unresolved.

Regards.


PS: I read your document about the Memory Layout Syntax. In my 
understanding the correct orders of parameters is:
section <section-name> <x> <align> <relocated> <section-type> <VMA-start> 
<LMA-start> <VMA-next> <LMA-next> [VMA-LMA-args] ! [notes]
In other words I think the <VMA-next> and <LMA-start> parameters should be 
exchanged. Am I right?


>Llandre,
>
>I have recently struggled through a similar issue and have determined the
>".mlt" file syntax (at least most of it) empirically through trial and
>error.  Here is what I came up with:
>
>
>You might try:
>
>   section init_code 0 4 0 0 0 0 0 1 fixed_text !
>   section fixed_text 0 4 1 0 1 1 0 1 c000000 text text !
>
>It looks like you are trying to place ROM at address 0.  I have also been
>exploring doing this for the ARM architecture, but have discovered several
>places in the HAL code that assumes that RAM is mapped to address 0.  I
>would be interrested in your experience in doing this.
>
>Jay Foster
>jay@systech.com
>
>-----Original Message-----
>From: llandre [mailto:r&d@wawnet.biz]
>Sent: Sunday, November 17, 2002 8:20 AM
>To: ecos-discuss@sources.redhat.com
>Subject: [ECOS] Help about adding new sections for ARM platform
>
>
>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
>

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


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