|
From: catiadoc <cat...@fr...> - 2005-02-15 20:29:01
|
> Hello,
> I'm a newbie in sdcc
> I just tested SDCC wich is working fine if I put all my source code in =
=20
> one
> file but if I split the code in 4 files (main.c main.h serial.c =20
> serial.h) it
> compiles OK but doesn't work. I paste here my Makefile What's wrong ??
>
> Thanks for your help
>
> Eltorio
>
>
> For testing in one file I compiled with
> Sdcc afile.c -I.\sdcc\include -mmcs51 --verbose --model-small =
--iram-size
> 0xFF --xram-size 0x03FF --xram-loc 0x0000 --code-loc 0x0000
>
Why not try with the defaults, no option at all?
Header files (.h) are "included" in the source .c files.
Then try options when it works.
Here is the simplest possible makefile, called from emacs with "make =
-k".
(I guess you'll not worry about some French in it :-).
# Makefile pour main
# -o : output, nom du fichier de sortie
# Objects : fichiers objets =E0 inclure dans le fichier de sortie
objects=3D main.rel serial.rel
main: $(objects)
sdcc -o main.hex --model-large $(objects)
# la fa=E7on de les r=E9unir
.SUFFIXES: .rel
.c.rel:
sdcc --model-large -c $<
# la fa=E7on de produire .rel =E0 partir de .c
>
> -------------------------------------------------------------
> #Makefile
>
> CC=3D .\sdcc\bin\sdcc
> IHX=3D .\sdcc\bin\packihx
> RM=3D C:\cygwin\bin\rm
> SRCC=3D $(wildcard *.c)
> OBJ=3D $(SRCC:.c=3D.rel)
> EXEC=3D agitateur
> CFLAGS=3D -I.\sdcc\include -mmcs51 --verbose LDFLAGS=3D -mmcs51 =
--verbose
> --model-small --iram-size 0xFF --xram-size 0x03FF --xram-loc 0x0000
> --code-loc 0x0000
>
> all: outfile
>
> outfile: $(OBJ)
> $(CC) main.rel serial.rel -o $(EXEC).ihx $(LDFLAGS)
>
> %.rel: %.c
> $(CC) -c $< $(CFLAGS)
>
>
>
>
Thanks for your help
1- I modified my Makefile as you proposed so stdout is
.\sdcc\bin\sdcc -c main.c -I.\sdcc\include
.\sdcc\bin\sdcc -c serial.c -I.\sdcc\include
.\sdcc\bin\sdcc main.rel serial.rel -o agitateur.ihx
No error in compilation... Code size is 4893 bytes but doesn't work.
2- I tested to automaticly concatenate the 2 .c files with
$(RM) -f onefile.c
$(CAT) serial.c main.c > onefile.ctemp
$(MV) onefile.ctemp onefile.c
$(CC) onefile.c -I.\sdcc\include -o onefile.ihx
$(RM) onefile.c
No error in compilation... Code size is 4897 bytes and it works =
!!!!!!!!!
Strange 4 bytes difference ??????????
|