This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi Ben I am not sure if this is the definitive answer, but it is how I go about doing it.... Firstly you need to have a linker script, example follows : /*---------------------------------------------------*/ MEMORY { ram : ORIGIN = 0x202000, LENGTH = 0x2000 rom : ORIGIN = 0x0, LENGTH = 0x2000 } SECTIONS { .text : { PROVIDE(_stext = . ); *(.text) . = ALIGN(4); PROVIDE(_etext = . ); #(in your case you would probably need to do something like : #PROVIDE(_Image$$RO$$Limit); #--------------------------------------------------------------------------- ---) } > rom .data : { PROVIDE(_sdata = . ); *(.data) *(.rodata) *(.glue_7*) . = ALIGN(4); PROVIDE(_edata = . ); } > ram .bss : { PROVIDE(_sbss = . ); *(.bss) . = ALIGN(4); PROVIDE(_ebss = . ); } > ram . += 0x1000; PROVIDE(_stack = .); PROVIDE(_end =.); } /*------------------------------------------------------------*/ then in your aseembler file you can reference the symbols, as shown in my crt0 below : /*--------------------------------------------------------------*/ .text .align .global main,_main main: _main: # copy .data section ldr r3, =_etext ldr r4, =_sdata ldr r5, =_edata subs r5, r5, r4 bl copydata # clear .bss section ldr r4, =_sbss ldr r5, =_ebss subs r5, r5, r4 bl clearbss # and jump to the kernel b boot copydata: subs r5, r5, #4 ldr r6, [r3], #4 str r6, [r4], #4 bne copydata mov pc, lr clearbss: subs r5, r5, #4 str r0, [r3], #4 bne clearbss mov pc. lr bss_start: .word _sbss bss_end: .word _ebss text_end: .word _etext data_start: .word _sdata data_end: .word _edata stack_start: .word _stack end: .word _end /*------------------------------------------------------*/ The linker script file must be included in the linker flags with the -T option. Hope this helps Regards Simon ----- Original Message ----- From: <benjaminlee001 at shaw dot ca> To: <crossgcc at sources dot redhat dot com> Sent: Saturday, March 01, 2003 1:57 AM Subject: porting assembly file to compiled using GNU linker rather than ARMLINK > Hi all, > > I've got a question regarding the use of GNU linker. > > I am trying to compile an assembler file using GNU as and ld. The file is a file to setup the C envoirnment and is originally built using ARM SDT armasm and armlink. I've changed all the directives in the file so that it would compile under GNU as. But when I try to link the file together with other source files, it gives me a message saying that "undefined reference to `Image$$RO$$Limit'" in that file. The symbol "Image$$RO$$Limit'" represents the code size and is determined at link time by armlink. So how can I get GNU linker to define the symbol at link time so I can build the object file successfully? The portion of code that contains that symbol is listed below. > > > IMPORT |Image$$RO$$Limit| ; End of ROM code (=start of ROM data) > > IMPORT |Image$$RW$$Base| ; Base of RAM to initialise > > IMPORT |Image$$ZI$$Base| ; Base and limit of area > > IMPORT |Image$$ZI$$Limit| ; to zero initialise > > > > LDR r0, =|Image$$RO$$Limit| ; Get pointer to ROM data > > LDR r1, =|Image$$RW$$Base| ; and RAM copy > > LDR r3, =|Image$$ZI$$Base| ; Zero init base to top of initialised data > > CMP r0, r1 ; Check that they are different > > BEQ %F1 > >0 CMP r1, r3 ; Copy init data > > LDRCC r2, [r0], #4 > > STRCC r2, [r1], #4 > > BCC %B0 > >1 LDR r1, =|Image$$ZI$$Limit| ; Top of zero init segment > > MOV r2, #0 > >2 CMP r3, r1 ; Zero init > > STRCC r2, [r3], #4 > > BCC %B2 > > Please help me out on this, > > Thank you so much, > > Ben > > > ------ > Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ > Want to unsubscribe? Send a note to crossgcc-unsubscribe at sources dot redhat dot com > ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe at sources dot redhat dot com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |