Hi

Stanley Lee wrote:
> Hi,
> 
> I have tried to compile Jan's code in terminal and got the following
> printout instead. I'm having a feeling that SDCC isn't recompiled
> properly on my computer.

Looks like you didnt tell sdcc for which cpu you want to compile your
code. You need to add something like:

-mpic16 -p18f2620 ....

attacked you find a Makefile I use to compile my sdcc projects. You need
to edit the lines PROG_NAME and OBJS accodring to you files.

jan
# change this to your program name
PROG_NAME = Servotester.hex
# list your object files
OBJS = pwm.o main.o

DEBUG = #-DUSB_USE_UART #-DDEBUG_UART -DDEBUG -DDEBUG_PRINT 

PIC_TYPE = PIC18F1220
sdcc_PIC_TYPE = 18f1220
lkr_PIC_TYPE = 18f1220
TOOLSDIR = /usr/local/
CC = $(TOOLSDIR)/bin/sdcc
CFLAGS = -mpic16 -V -p$(sdcc_PIC_TYPE) $(DEBUG) --denable-peeps --opt-code-size 
--optimize-cmp --optimize-df --fstack 
LNK = $(TOOLSDIR)/bin/sdcc
INC = -I.
LDFLAGS = -L/usr/local/share/sdcc/lib/pic16/
CRT = --use-crt=crt0.o -V
#DEBUG = --denable-peeps --obanksel=9 --opt-code-size --optimize-cmp 
--optimize-df --fstack

all: $(PROG_NAME)

.c.o:
        $(CC)  $(CFLAGS) $(INC) -c $<

#rule to link the final executable
$(PROG_NAME): $(OBJS)
        $(LNK) $(DEBUG) $(LDFLAGS) $(CRT) -Wl-s$(lkr_PIC_TYPE).lkr,-m -mpic16 
-p$(sdcc_PIC_TYPE) $+ -o $(@) -llibio$(sdcc_PIC_TYPE).lib -llibc18f.lib
#
prog: $(PROG_NAME)
        piklab-prog --programmer=direct --port=/dev/parport0 
--device=$(sdcc_PIC_TYPE) --command=program $(PROG_NAME)

clean:
        rm -f *.o *.rel *.lst *.cod *.hex *.map *.asm
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to