This is the mail archive of the ecos-discuss@sourceware.org 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: Data segment and ROM?


On Thu, Jul 31, 2008 at 11:18:07AM +0200, Stanislav Meduna wrote:
> Hi,
>
> I am trying to get some initial understanding of eCos and
> RedBoot (I'll need to do a port for a Net+ARM-based
> hardware) and I am playing with RedBoot in a SkyEye
> ARM simulator configured as an AT91 machine with
> serial, network and flash.
>
> The RAM version is already running quite well, but when
> trying to boot the ROM version I immediately got some
> problems and traced them back to the following line in
> packages/hal/arm/at91/var/current/src/hal_diag.c:
>
> static channel_data_t at91_ser_channels[CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS] = {
> {
>  #if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 0
>      { (cyg_uint8*)AT91_USART0, 1000, CYGNUM_HAL_INTERRUPT_USART0,
>
>
> Well, if I understand this correctly such data end in the
> data segment full of zeros and won't ever see the
> initialization data.

This sounds like the initializing data in the ROM part of the image is
not getting copied into the RAM. 

Look in vectors.S and make sure this is happening:

#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
        // Set up reset vector
        mov     r0,#0
        ldr     r1,.__exception_handlers
        ldr     r2,[r1,#0x00]    // reset vector intstruction
        str     r2,[r0,#0x00]
        ldr     r2,=warm_reset
        str     r2,[r0,#0x20]
        // Relocate [copy] data from ROM to RAM
        ldr     r3,.__rom_data_start
        ldr     r4,.__ram_data_start
        ldr     r5,.__ram_data_end
        cmp     r4,r5           // jump if no data to move
        beq     2f
        sub     r3,r3,#4        // loop adjustments
        sub     r4,r4,#4
1:      ldr     r0,[r3,#4]!     // copy info
        str     r0,[r4,#4]!
        cmp     r4,r5
        bne     1b
2:
#endif

Also, check what it is copying from does actually contain something
useful. It could be your simulation system has not loaded that segment
from the elf image into your simulated FLASH.

     Andrew

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