On January 17, 2008 02:06:15 am Jacques Pelletier wrote:
> Hi,
>
> I just installed the latest version of SDCC, 2.7.0, compiled from the
> sources. Previously, I had the package SDCC 2.6.x installed through
> Synaptic on Ubuntu.
>
> One of my project compiled and linked fine with SDCC 2.6.
> Now with SDCC 2.7, it compiles but the linker gave "Invalid file type"
>
> I tried changing the -i main.ihx to -s main.s19, same result.
>
> SDCC seems to produce valid object code. It seems that the linker doesn't
> like the files '*.o' produced by SDCC.
>
> Any ideas, anyone?
>
>
> JP

I tried modifying the makefile by replacing the link command with this:

main.ihx:  $(OBJECTS)
        $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS)

SDCC now complains that it doesn't know what to do with the .o files, which 
are all there and properly compiled.

Here is the modified makefile, and a makefile from another project, which 
compiles and links properly, with the same version of SDCC and executing from 
the same shell (so that the same environment variables are used).

I'm suspecting some black magic here... :)

JP
# Copyright (c) 2001, Adam Dunkels.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#      This product includes software developed by Adam Dunkels.
# 4. The name of the author may not be used to endorse or promote
#    products derived from this software without specific prior
#    written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# This file is part of the uIP TCP/IP stack.
#
# $Id: Makefile,v 1.2 2001/11/24 16:03:59 adam Exp $
#

# Change the target system type here
SYS=z80

CC=sdcc
AS=as-$(SYS)
LN=link-$(SYS)

CFLAGS=-m$(SYS)
LFLAGS = --code-loc 0x5200 --no-std-crt0
MFLAGS = --model-small

OBJECTS = main.o ../uip/uip.o ../apps/httpd/httpd.o ../apps/httpd/fs.o ../apps/httpd/cgi.o uip_arch.o rs232dev.o rs232.o conio.o io.o


UIP.CMD: main.ihx
	sed s/:00000001FF/:00520001AD/ main.ihx | \
	hex2cmd > UIP.CMD

main.ihx:  $(OBJECTS)
	$(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS)

main.o: main.c
	$(CC) $(CFLAGS) -I . -I ../uip -I ../apps/httpd -c main.c

uip_arch.o: uip_arch.c uip_arch.h
	$(CC) $(CFLAGS) -I . -I ../uip -I ../apps/httpd -c uip_arch.c

rs232dev.o: rs232dev.c rs232dev.h
	$(CC) $(CFLAGS) -I . -I ../uip -I ../apps/httpd -c rs232dev.c

rs232.o: rs232.c rs232.h
	$(CC) $(CFLAGS) -c rs232.c

conio.o: conio.c conio.h
	$(CC) $(CFLAGS) -c conio.c

io.o: io.c io.h
	$(CC) $(CFLAGS) -c io.c

../uip/uip.o: ../uip/uip.c ../uip/uip.h
	cd ../uip; \
	$(CC) $(CFLAGS) -I . -I ../apps/httpd -I ../trs80-3 -c uip.c

../apps/httpd/httpd.o: ../apps/httpd/httpd.c ../apps/httpd/httpd.h
	cd ../apps/httpd; \
	$(CC) $(CFLAGS) -I . -I ../../uip -I ../../trs80-3 -c httpd.c

../apps/httpd/fs.o: ../apps/httpd/fs.c ../apps/httpd/fs.h ../apps/httpd/fsdata.c
	cd ../apps/httpd; \
	$(CC) $(CFLAGS) -I . -I ../../uip -I ../../trs80-3 -c fs.c

../apps/httpd/cgi.o: ../apps/httpd/cgi.c ../apps/httpd/cgi.h
	cd ../apps/httpd; \
	$(CC) $(CFLAGS) -I . -I ../../uip -I ../../trs80-3 -c cgi.c

clean:
	rm -f *.o *.asm *.lst *.sym *.map *.ihx UIP.CMD
	cd ../uip; rm -f *.o *.asm *.lst *.sym
	cd ../apps/httpd; rm -f *.o *.asm *.lst *.sym
#
MAPTOHEADER = map2header.awk

CC = sdcc -mz80
AS = as-z80
ASFLAGS = -plogsff
CFLAGS =
LFLAGS = --code-loc 0x2000 --data-loc 0x8000 --no-std-crt0
MFLAGS = --model-small --stack-loc 0x7d00

OBJECTS = main.o serial.o lcd.o rout_min.o
HEADERS = bios.h serial.h lcd.h rout_min.h

all: main.ihx

sim:
	sz80 main.ihx

_dummy:

clean:
	rm -f core *~ \#* *.asm *.cdb *.o *.hex *.ihx *.lst *.map \
     *.rst *.sym *.lnk *.lib *.bin

load:
	cp main.ihx /dev/ttyS0

bios.h: mini.MAP
	gawk -f $(MAPTOHEADER) $< > $@ 

main.ihx:  $(OBJECTS)
	$(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS)

%.rel: %.c $(HEADERS)
	$(CC) $(CFLAGS) $(MFLAGS) -c $<

%.o: %.c $(HEADERS)
	$(CC) $(CFLAGS) -c $<

%.o: %.s
	$(AS) $(ASFLAGS) $@ $<
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to