[ECOS] problem with modifing the hal_platform_setup.h

Shaojie Wu swu@zmicro.com
Tue Dec 11 14:41:00 GMT 2001


Hi, there


Now I am modifing the ecos source code(hal_platform_setup.h) for a custom
board with AT91FR4081,
I build the ecos library for eb40 and made the following change:


----------------------------------------------------------------------------
------------------------------

#include <cyg/hal/plf_io.h>

#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
        ldr     r0,=AT91_SF             //* enable external RAM
access<--------------------enable RAM access
        ldr     r1,=0x00000001
        str     r1,[r0,#AT91_SF_MMR]


        .macro  _setup
        ldr     r10,=_InitMemory        // Initialize memory controller
        movs    r0,pc,lsr #20           // If ROM startup, PC < 0x100000
        moveq   r10,r10,lsl #12         //   mask address to low 20 bits
        moveq   r10,r10,lsr #12
        ldmia   r10!,{r0-r9,r11-r12}    // Table of initialization constants
#if defined(CYG_HAL_STARTUP_ROMRAM)
        ldr     r10,=0x0000FFFF
        and     r12,r12,r10
        ldr     r10,=0x01000000
        orr     r12,r12,r10
#endif
        stmia   r11!,{r0-r9}            // Write to controller
        mov     pc,r12                  // Change address space, break
pipeline
_InitMemory:
        .long   0x01002535  // 0x01000000, 16MB,  2 cycles added after
transfer, 16-bit, 6 wait states
        .long   0x020022AD  // * 0x02000000, 16MB,  0 cycles added after
transfer, 16-bit, 1 wait state
        .long   0x03003535  // * modified for zvc board
        .long   0x04000535  // unused
        .long   0x05000535  // unused
        .long   0x06000535  // unused
        .long   0x07000535  // unused
        .long   0x08000535  // unused
        .long   0x00000001  // REMAP commande
        .long   0x00000006  // 7 memory regions, standard read
        .long   AT91_EBI    // External Bus Interface address
        .long   10f         // address where to jump
10:

#if defined(CYG_HAL_STARTUP_ROMRAM)
        ldr     r0,=0x01000000          // *Relocate FLASH/ROM to on-chip
RAM
        ldr     r1,=0x00100000         // RAM base & length
        ldr     r2,=0x00120000
20:     ldr     r3,[r0],#4
        str     r3,[r1],#4
        cmp     r1,r2
        bne     20b
        ldr     r0,=30f
        mov     pc,r0
30:
#endif      <---------------------------------------------------- seems
program stops here ????????????????????????

        ldr     r0,=AT91_PS             // Power saving interface
        ldr     r1,=0xFFFFFFFF          // Enable all peripheral [clocks]
        str     r1,[r0,#AT91_PS_PCER]
        ldr     r0,=AT91_PIO            // * enable able PIO (so peripherals
can use bits)
        ldr     r1,=0xFB9F3FFF
        str     r1,[r0,#AT91_PIO_PER]
        ldr     r1,=0x00460C000          // *disable ports for UART, FIQ,
EINT, Timer clocks
        str     r1,[r0,#AT91_PIO_PDR]
        ldr     r1,=0xFA1021BF
        str     r1,[r0,#AT91_PIO_OER]
        /* ldr     r1,=0x000001B6          // LEDs
        str     r1,[r0,#AT91_PIO_OER]
        str     r1,[r0,#AT91_PIO_SODR] */
        ldr     r0,=AT91_USART0                // related setting for USART0
	  ldr     r1,=0x0000005c
	  str     r1,[r0,#AT91_US_CR]
	  ldr     r1,=0x000008C0
	  str     r1,[r0,#AT91_US_MR]
	  ldr     r1,=0x00000082
	  str     r1,[r0,#AT91_US_BRG]
	  ldr     r1,=0xFFFFFFFF
        str     r1,[r0,#AT91_US_IDR]
        ldr     r0,=AT91_AIC                // disable the AIC interrupr
response
	  ldr     r1,=0xFFFFFFFF
	  str     r1,[r0,#AT91_AIC_IDCR]
	  ldr     r0,=AT91_SF               // disable the AIC interrupr response
	  ldr     r1,=0x20
	  str     r1,[r0,#AT91_SF_PMR]
        .endm

#define CYGSEM_HAL_ROM_RESET_USES_JUMP
#define PLATFORM_SETUP1     _setup
#else
#define PLATFORM_SETUP1
#endif


----------------------------------------------------------------------------
--------------------

Also, I updated the plf_io file to add more Macros,  after I program the
flash memory
and boot from that custom board, I found some registers could be set
successfully, some
could not( please look the above source code),also I checked the RAM and
found the code
has been copied from flash memory to RAM successfully.

I could not figure out why the code stops there, any reply will be highly
appreciated!!



More information about the Ecos-discuss mailing list