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: redboot elf loader


Please copy your replies to the mailing list so that everyone can
benefit.

On Mon, 2003-09-29 at 06:37, Artur Lipowski wrote:
> Gary Thomas wrote:
> 
> > Please show us what you've done (as is, this sounds like Fermat's last
> > theorem!)  I'd like to understand why you think the current behaviour
> > is wrong and how it should behave.
> 
> I have following definitions in the linker script:
> ........
> MEMORY
> {
>      sram : ORIGIN = 0, LENGTH = 8K
>      ram : ORIGIN = 0x02000000, LENGTH = 512K
> }
> .....
> /* here are standard (GCC) sections */
> ......
> . = ALIGN(4);
> _end = .; PROVIDE (end = .);
> .vectors 0x0 : AT ( _end )
>      	{
> 		_v_start = .;
>      		*(.vectors)
> 	} > sram
> _v_end = .;
> ....
> 
> I wrote some assembler routines and place them in section ".vectors". My 
> startup code performs copying from address _v_start to address 0.
> 
> Without changes in load.c the redboot loader reports error which says 
> that it cannot load code at address 0 because it is outside of the RAM 
> region. It is true but it also means that the loader does not respect 
> load address embedded in the elf binary.

Sorry, but it's supposed to work this way.  I would entertain patches 
that allow for a switch to override this (checking) behaviour, but 
simply disabling it is not acceptable.

Also, there have been recent changes to RedBoot which would allow for
your SRAM section to be defined as a usable memory region that fixes
this problem.  This is done on a platform basis - look at the MOAB 
(PowerPC) platform for an example.

> Output of the "arm-elf-objdump -h" shows that there are proper values of 
> the LMA and VMA in the elf image:
> hello.elf:     file format elf32-littlearm
> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>    0 .text         000068f8  02010000  02010000  00000080  2**2
>                    CONTENTS, ALLOC, LOAD, CODE
>    1 .data         00000da8  020168f8  020168f8  00006978  2**2
>                    CONTENTS, ALLOC, LOAD, DATA
>    2 .bss          00000224  020176a0  020176a0  00007720  2**5
>                    ALLOC
>    3 .vectors      00000094  00000000  020178c4  00007720  2**2
>                    CONTENTS, ALLOC, LOAD, CODE
> 
> Changes I made in load.c are very simple, instead of using the p_vaddr 
> field I use the p_paddr filed of the Elf32_Phdr structure in the 
> load_elf_image function.

How about sending a patch which shows this more fully?

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
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]