1 # Port specification for the mcs51 port running with uCsim
6 S51A = $(SDCC_DIR)/sim/ucsim/s51.src/s51
7 S51B = $(SDCC_DIR)/bin/s51
9 S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
11 SDCCFLAGS +=--nostdinc --less-pedantic -DREENTRANT=reentrant -I$(INC_DIR)/mcs51
12 LINKFLAGS = --nostdlib
13 LINKFLAGS += mcs51.lib libsdcc.lib liblong.lib libint.lib libfloat.lib
14 LIBDIR = $(SDCC_DIR)/device/lib/build/small
19 EXTRAS = $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
20 FWKLIB = $(PORTS_DIR)/$(PORT)/T2_isr$(OBJEXT)
22 # Rule to link into .ihx
23 %$(EXEEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORTS_DIR)/$(PORT)/fwk.lib
24 $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $(PORTS_DIR)/$(PORT)/fwk.lib $< -o $@
27 $(SDCC) $(SDCCFLAGS) -c $< -o $@
29 $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT): fwk/lib/testfwk.c
30 $(SDCC) $(SDCCFLAGS) -c $< -o $@
32 $(PORTS_DIR)/$(PORT)/fwk.lib:
33 cp $(PORTS_DIR)/mcs51/fwk.lib $(PORTS_DIR)/$(PORT)/fwk.lib
35 # run simulator with 30 seconds timeout
36 %.out: %$(EXEEXT) fwk/lib/timeout
38 -fwk/lib/timeout 30 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd > $(@:.out=.sim) \
39 || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
40 python get_ticks.py < $(@:.out=.sim) >> $@
41 -grep -n FAIL $@ /dev/null || true
43 fwk/lib/timeout: fwk/lib/timeout.c
47 rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \
48 $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm \
49 $(PORTS_DIR)/$(PORT)/*.lnk $(PORTS_DIR)/$(PORT)/*.map $(PORTS_DIR)/$(PORT)/*.mem