This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: again ROMRAM startup on SA1100
- To: Andrew Lunn <andrew dot lunn at ascom dot ch>
- Subject: Re: [ECOS] again ROMRAM startup on SA1100
- From: Gary Thomas <gthomas at cambridge dot redhat dot com>
- Date: Mon, 11 Jun 2001 08:08:09 -0600 (MDT)
- Cc: ecos-discuss at sources dot redhat dot com,
- Cc: ecos-discuss at sources dot redhat dot com,Andreas Bürgel <ab at genologic dot de>
- Organization: Red Hat, Inc.
On 11-Jun-2001 Andrew Lunn wrote:
> On Mon, Jun 11, 2001 at 03:36:18PM +0200, Andreas Bürgel wrote:
>> Hi folks,
>>
>> I may have a working version now, but I found it far too easy to do.
>> So I suppose it's wrong somewhere. Here's what I did:
>
> [..]
>
>> My application now starts from ROM and seems to run in RAM, but there
>> *must* be a trap waiting for me (?).
>
> Where do you jump from ROM to RAM. I could not see it in your code. My
> relocation code does..
>
>#if defined(CYG_HAL_STARTUP_ROMRAM)
>#define RELOCATE_TEXT_SEGMENT ;\
> ldr r2,=__exception_handlers ;\
> ldr r3,=CYGMEM_REGION_rom ;\
> cmp r2,r3 ;\
> beq 20f ;\
> ldr r4,=__rom_data_end
> ;\
> 15: ;\
> ldr r0, [r3], #4 ;\
> str r0, [r2], #4 ;\
> cmp r2, r4 ;\
> bne 15b ;\
> b __new_pc ;\
> __new_pc: ;\
> 20:
>
> The b __new_pc is important. This is where is jumps from ROM to
> RAM. Do you have an equivelent somewhere? You have to be carefull
> about the address you are branching to. You dont want to make a
> relative jump of 1 instruction, since you still end up on ROM. You
> have to make big jump down into RAM. I just copied this code from Dave
> Airlie.
I believe that it happens implicitly when the MMU gets turned on - pretty slick.