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: got struck in running ecos application from ROMRAM


Hi,

You  have to write small functionality for relocating Code from ROM to RAM
if use ROMRAM Startup and it should called before MMU initialization. Please
refer the following reference logic for ur case.



Reference Code:- hal_platform_setup.h



#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)

#define PLATFORM_SETUP1 _platform_setup1

#define CYGHWR_HAL_ARM_HAS_MMU

.............

//==========================================

// code relocation stuff for ROM/RAM startup

//==========================================

#if defined(CYG_HAL_STARTUP_ROMRAM)

#define RELOCATE_CODE                  \

       ldr     r2, =SA11X0_RAM_BANK0_BASE ;\   // Ur RAM Physical Base

       ldr     r3, =__exception_handlers  ;\

       ldr     r4, =SA11X0_ROM_BANK0_BASE ;\   // Ur ROM Physical Base

       ldr     r5, =_end              ;\

       add     r5, r5, r2             ;\

       add     r2, r2, r3             ;\

15:                                   ;\

       ldr     r6, [r4], #4           ;\

       str     r6, [r2], #4           ;\

       cmp     r2, r5                 ;\

       bne     15b                    ;\

       nop                            ;\

       nop                            ;\

       nop                            ;\

       nop                            ;\

       nop                            ;\

       nop                            ;\

20:                                   ;\

       nop                            ;\

       nop                            ;\

#else

#define RELOCATE_CODE

#endif

..............

// This macro represents the initial startup code for the platform

.macro _platform_setup1

...............................

// Set up a stack [for calling C code]

ldr r1,=__startup_stack

ldr r2,=SA11X0_RAM_BANK0_BASE   // Use ur  RAM Base Here

orr sp,r1,r2

// relocate code from ROM to RAM if ROM/RAM startup

RELOCATE_CODE

// Create MMU tables

bl hal_mmu_init

// Enable MMU

.endm

...........

#else // defined(CYG_HAL_STARTUP_ROM)

#define PLATFORM_SETUP1

#endif



I hope this will help you.....

Regards,

Vinayagam.M





----- Original Message ----- 
From: "Ganapat Rao P Kulkarni" <gpkulkarni@gmail.com>
To: <ecos-discuss@ecos.sourceware.org>
Sent: Wednesday, March 30, 2005 3:38 PM
Subject: [ECOS] got struck in running ecos application from ROMRAM


> Hi group,
> I have created a bootloader application whihc gets
> bootstrping from vectors.S and give control to my
> application main function.
> Initially i have tried to work it form ROM.
> I am able to do it.
> Now i am trying to do the same with ROMRAM feature.
> i.e for few instructions (im my case ,till mmu is
> enabled ) it will executes from the flash then it will
> executes from ram. To do this i have made default
> option ROMRAM in cdl file then created *.ecc file.
> With this, i have compiled my application and flashed
> it on my target (ARM9TDMI).
>
>
> Now i am getting the prefetch abort exeception for
> next instruction atfter enabling the mmu.
>
> Please let me know what are all we need to take into
> consideration while making it work with ROMRAM
> feature.
>
> thanks in advance
> best regards
> ganapat
> PS:in this case i have assumed both ldi file rom.ldi
> and romram.ldi (in dir pkgconf) are used together to
> generate the final binary when you enable CYG_STARTUP=
> ROMRAM.
>
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>
>


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