* sim/ucsim/cmd.src/newcmd.cc: #include <ctype.h>
[fw/sdcc] / support / regression / ports / mcs51 / spec.mk
index ba313c3caa0bf58fe6b5bd560caeba3d3d013be4..fd2a395665c869e0954aeb7361143bdce0943fdd 100644 (file)
@@ -2,36 +2,53 @@
 #
 # model small
 
+ifndef DEV_NULL
+  DEV_NULL = /dev/null
+endif
+
 # path to uCsim
-S51A = $(SDCC_DIR)/sim/ucsim/s51.src/s51
-S51B = $(SDCC_DIR)/bin/s51
+S51A = $(top_builddir)sim/ucsim/s51.src/s51
+S51B = $(top_builddir)bin/s51
 
 S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
 
-SDCCFLAGS +=--lesspedantic -DREENTRANT=reentrant --stack-after-data
+SDCCFLAGS +=--nostdinc --less-pedantic -DREENTRANT=reentrant -I$(INC_DIR)/mcs51 -I$(top_srcdir)
+LINKFLAGS = --nostdlib
+LINKFLAGS += mcs51.lib libsdcc.lib liblong.lib libint.lib libfloat.lib
+LIBDIR = $(top_builddir)device/lib/build/small
 
 OBJEXT = .rel
 EXEEXT = .ihx
 
-EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
+EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT)
+FWKLIB = $(PORT_CASES_DIR)/T2_isr$(OBJEXT)
 
 # Rule to link into .ihx
-%$(EXEEXT): %$(OBJEXT) $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@
+%$(EXEEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORT_CASES_DIR)/fwk.lib
+       $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $(PORT_CASES_DIR)/fwk.lib $< -o $@
 
 %$(OBJEXT): %.c
        $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
-# run simulator with 10 seconds timeout
-%.out: %$(EXEEXT) fwk/lib/timeout
-       mkdir -p `dirname $@`
-       -fwk/lib/timeout 10 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
+$(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.c
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
+
+$(PORT_CASES_DIR)/%$(OBJEXT): fwk/lib/%.c
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
+
+$(PORT_CASES_DIR)/fwk.lib:
+       cp $(PORTS_DIR)/mcs51/fwk.lib $@
+
+# run simulator with 30 seconds timeout
+%.out: %$(EXEEXT) gen/timeout
+       mkdir -p $(dir $@)
+       -gen/timeout 30 "$(S51)" -t32 -S in=$(DEV_NULL),out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd > $(@:.out=.sim) \
          || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+       python $(srcdir)/get_ticks.py < $(@:.out=.sim) >> $@
        -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 temp.lnk
+gen/timeout: $(srcdir)/fwk/lib/timeout.c
+       $(CC) $< -o $@
 
+_clean: