I've tried what you suggested, linking the boot.rel first results in the opposite effect, the _START area gets overwritten by the _CODE area. Here a small showcase for the problem I'm having:
; boot.asm: .globl HexToU8 .area _START (ABS,OVR) .org 0 ld SP, #0xFFFF call HexToU8 Loop: jp Loop .asciz "boot" ; numconv.asm: .globl HexToU8 .area _CODE (REL,CON) HexToU8: ld A, #'A' ret TESTSTR: .asciz "numconv" $ sdasz80 -o numconv.asm $ sdasz80 -o boot.asm $ sdldz80 MemMonitor.ihx boot.rel numconv.rel -i $ sdobjcopy -Iihex -Obinary --pad-to 65536 --gap-fill 255 MemMonitor.ihx MemMonitor.bin $ hexdump -C MemMonitor.bin 00000000 3e 41 c9 6e 75 6d 63 6f 6e 76 00 6f 74 00 ff ff |>A.numconv.ot...| 00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * 00010000 As you can see, the linker overwrites the _START area with the _CODE area. On 17-08-2016 11:09, Maarten Brock wrote: >> 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 ------------------------------------------------------------------------------ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user