Page 1 of 1

calling external function

Posted: Sat Mar 29, 2003 9:14 pm
by slacker
i am trying to call a c function from my ISR written in asm code. i want to compile a binary file so i can use org. but i cant use extern and call with that binary file to call the c function because it gives me an error: idt.asm:28: error: binary output format does not support external references

waht should i do to be able to call the external c function and align my variables to 0x600?

thank you.

Re:calling external function

Posted: Sun Mar 30, 2003 12:06 am
by Chris Giese
Compile the C code and assemble the asm code into a relocatable format (DJGPP COFF, Win32 PE COFF, ELF, .OBJ, or a.out), then use a linker to combine the relocatable files into an executable file.

Usually, the linker has an option to set the ORG value. Check the "Starting virtual address" rows in this table: http://my.execpc.com/~geezer/temp/linkers.htm

If you're using the GNU linker (ld), using a linker script is a good idea.