This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

memcpy & VMA/LMA initilisations


Hi

I have read in various places that in order to init vars in rom, you need to 
memcpy them to ram first, (which seems sensible). The problem is that i cant 
get it to work.

here is the code i am using,...

   /* initialized data */
    .init : AT (__bdata_end) /* memcpy to init */
    {
    __data_start = .;
     *(VTABLE)   /* now, 400 bytes */
     *(STACK)    /* now, 800 bytes */
     *(EXCEPTIO) /* now, 800 bytes */
     *(USTACK)   /* now, 100 bytes */
     *(APPDATA)  /* now, 2 bytes */
     *(UNINITVA) /* 0 */
     *(.data)
     __data_end = .;
    } > _ram0

    //snip

    BDATA :
    {
    __bdata_start = .;
     *(BDATA)
     *(code)
     *(const)
     *(vars)
     __bdata_end = .;
    } > _ram1


and then on startup,..


extern long __data_start;
extern long __data_end;
extern long __bdata_end;

void initcopy (void) {

	memcpy( &__data_start, &__bdata_end, (&__data_end - &__data_start));
	return;


but all the above sections are all 0, i.e not found, so no
data is copied, any ideas (solutions :-) !

regards,.

---
Matthew J Fletcher              amimjf@connectfree.co.uk
www.amimjf.connetcfree.co.uk    ICQ amimjf 44193496
Serck Controls Ltd              Programming from PIC to Java

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]