* .version: bumped version to 2.4.7
[fw/sdcc] / support / regression / ports / mcs51 / spec.mk
index 1c76314e3951983709024c90cd8480920ca3856f..610a0660cbacada38cd3178ba55cf805eb4b4f09 100644 (file)
@@ -1,28 +1,48 @@
 # Port specification for the mcs51 port running with uCsim
+#
+# model small
 
 # path to uCsim
-S51 = ../../sim/ucsim/s51.src/s51
+S51A = $(SDCC_DIR)/sim/ucsim/s51.src/s51
+S51B = $(SDCC_DIR)/bin/s51
 
-SDCCFLAGS += --lesspedantic -DREENTRANT=reentrant --stack-after-data
+S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
+
+SDCCFLAGS +=--nostdinc --less-pedantic -DREENTRANT=reentrant
+LINKFLAGS = --nostdlib
+LINKFLAGS += mcs51.lib libsdcc.lib liblong.lib libint.lib libfloat.lib
+LIBDIR = $(SDCC_DIR)/device/lib/build/small
 
 OBJEXT = .rel
 EXEEXT = .ihx
 
-EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
+EXTRAS = $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
+FWKLIB = $(PORTS_DIR)/$(PORT)/T2_isr$(OBJEXT)
 
 # Rule to link into .ihx
-%.ihx: %$(OBJEXT) $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $<
-       mv fwk/lib/testfwk.ihx $@
-       mv fwk/lib/testfwk.map $(@:.ihx=.map)
+%$(EXEEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORTS_DIR)/$(PORT)/fwk.lib
+       $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $(PORTS_DIR)/$(PORT)/fwk.lib $< -o $@
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
+
+$(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT): fwk/lib/testfwk.c
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
+
+$(PORTS_DIR)/$(PORT)/fwk.lib:
+       cp $(PORTS_DIR)/mcs51/fwk.lib $(PORTS_DIR)/$(PORT)/fwk.lib
 
-# run simulator with 5 seconds timeout
-%.out: %$(EXEEXT) ports/$(PORT)/timeout
+# run simulator with 30 seconds timeout
+%.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
-       -ports/$(PORT)/timeout 5 $(S51) -t32 -S in=/dev/null,out=$@ $< < ports/mcs51/uCsim.cmd >/dev/null 2>&1 || \
-          echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+       -fwk/lib/timeout 30 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
+         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
+fwk/lib/timeout: fwk/lib/timeout.c
+
+
+_clean:
+       rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \
+             $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm \
+             $(PORTS_DIR)/$(PORT)/*.lnk $(PORTS_DIR)/$(PORT)/*.map $(PORTS_DIR)/$(PORT)/*.mem