Arthur Skowronek wrote:
> I tried to write a Makefile for use with sdcc 2.9.0 to
> compile multifile z80 projects.
I tried out your makefile, and it seems the problem is
your options to link-z80. I was not able to figure out what
it did not like, so I changed it to use sdcc to link, and it
worked (well, I got an output file, that is).
I notice that you gave --no-std-crt0 as a compiler option, but
it is really an option to sdcc when linking. I don't think it
has any effect when compiling. When you use sdcc to link,
crt0.o and the z80 lib are added to the linker script that it then
passes to link-z80 (unless you use options to suppress them).
If you really want to call linker yourself, I think you probably
need to add the z80 lib to your command line even if you don't
want crt0.o, because you surely need other things from it.
(Just don't add crt0.o if you don't want it.)
But why not just use sdcc to link?
#To use sdcc for linking, you need something like this:
...
LINKOPTIONS = -mz80
LINKOPTIONS += --verbose -V
LINKOPTIONS += --code-loc $(SEG_CODE)
LINKOPTIONS += --data-loc $(SEG_DATA)
#uncomment next line if you don't want crt0.o linked.
#LINKOPTIONS += --no-std-crt0
...
# and then link with CC
$(PRJ_OUTP) : $(PRJ_OBJS)
<tab> $(CC) $(LINKOPTIONS) $^ -o $@
...
With sdcc 2.9.0, you can't name the output with -o
to "anything.ihx", because sdcc will delete the .ihx file.
but if you use "-o anything.hex", I think
it does not delete, but names it "anything.ihx"
(It also deletes the .map file when you use -o)
I submitted a patch to fix that, and it was applied in
snapshot 5518. :-) :-) :-)
With prior versions you can let sdcc name the output
with the default name, and then rename it.
Also, Richard Gray wrote:
> you're probably going to need some kind
> of 'for' loop to iterate over each input file.
That's not it, make will use the compile rule once for each sourcefile.
And, lementec fabien wrote:
> I dont know about your linker options, but -i seems
> weird to specify the output file. Any try with -o?
He is calling link-z80 directly, so the options are different
than when you let sdcc call it. -i means "intel hex" to link-z80,
and -o is not an option for link-z80, but it works if you link
with sdcc as of snapshot #5518. :-)
Randy
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user