> Hello SDCC users, > > > I'm doing a project with the famous Z80 just for fun, and decided to use > the sdasz80 assembler. My project consists of multiple source files to > keep everything modular. I'm having a problem with the linking step. > I've 2 source files: boot.asm and numconv.asm: > > > ; boot.asm: > .globl HexToU8 > .area _START (ABS) > > .org 0 > ld SP, #0xFFFF > call HexToU8 > ... > > ; numconv.asm: > .globl HexToU8 > .area _CODE (REL,CON) > > HexToU8: > ... > ret > > > As you can see, the boot.asm uses absolute placement because it needs to > be placed at the begning of the memory (it needs to be executed first). > The numconv.asm uses relative placement instead (it can be at any memory > position provided that the HexToU8 symbol is correctly adjusted by the > linker). > > > To compile and link I invoke the folowing commands: > > $ sdasz80 -o src/numconv.asm > $ sdasz80 -o src/boot.asm > $ sdldz80 MemMonitor.ihx src/numconv.rel src/boot.rel -i > $ sdobjcopy -Iihex -Obinary --pad-to 65536 --gap-fill 255 MemMonitor.ihx > MemMonitor.bin > > > It seems to compile and link fine, but the final binary doesn't include > the numconv subroutines and the HexToU8 symbol assumes the value 0x0000. > With my understanding the linker tries to put the _CODE (REL, CON) area > at the 0x0000 address, but it gets overwritten with the _START (ABS) > area. How I tell the linker to put the _CODE area to any other available > address (not used by the _START area)?
I'd start by linking boot.rel first. Maarten ------------------------------------------------------------------------------ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user