Starting at a different address

Florian Schirmer jolt@taytron.net
Fri Apr 21 14:52:00 GMT 2000


Hi,

i've got a maybe simple question. There is a motorola cpu32 machine with a running os which permitts the execution of a user written application. The binary can be copied via serial interface to ram address 0x10000 and will be executed from the os at this position.

Sorry for my bad english but i hope the background is clear :) My question now is how to tell the compiler that the application is running at address 0x10000 and not 0x0 which is the default if i got it correctly. I tried to add a asm ".equ 0x10000" but this increases the resulting binary a lot and doesnt seem to work.

Do i need a linker script which locates the sections at the right address or what do i need? Any hint, link or idea which stick me in the right direction would be wonderful.

Currently i invoke the compiler with the following command:

m68k-elf-gcc -Wall -mcpu32 -O3 -nostdlib -Wl,--oformat=binary -Wa,-alh,-L -o test.bin test.c > test.asm

where test.c contains:

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

void SerialSendBufA(unsigned char* Data, unsigned int DataLen)
{
  return;	
}

void __main()
{
  SerialSendBufA(0, 0);
}

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

The resulting binary crashes the target machine since the address of the sub function is wrong (i think). Without a call to sub functions the application runs fine. Using -fpic or -fPIC resolves the crash. But now i cant call the sub function "SerialSendBufA("test", 4);" with the parameter "test" since this gives me a linker error GOT_TABLE not found or something like that.

Maybe someone can help me with this tricky problem.

Thanks a lot
  Florian Schirmer


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



More information about the crossgcc mailing list