1# Regression test specification for the stm8-large target running with uCsim 2 3# simulation timeout in seconds 4SIM_TIMEOUT = 30 5 6# path to uCsim 7ifdef SDCC_BIN_PATH 8 UCSTM8C = $(SDCC_BIN_PATH)/sstm8$(EXEEXT) 9 10 AS_STM8C = $(SDCC_BIN_PATH)/sdasstm8$(EXEEXT) 11else 12 ifdef UCSIM_DIR 13 UCSTM8A = $(UCSIM_DIR)/stm8.src/sstm8$(EXEEXT) 14 else 15 UCSTM8A = $(top_builddir)/sim/ucsim/stm8.src/sstm8$(EXEEXT) 16 UCSTM8B = $(top_builddir)/bin/sstm8$(EXEEXT) 17 endif 18 19 EMU = $(WINE) $(shell if [ -f $(UCSTM8A) ]; then echo $(UCSTM8A); else echo $(UCSTM8B); fi) 20 21 AS = $(WINE) $(top_builddir)/bin/sdasstm8$(EXEEXT) 22 23ifndef CROSSCOMPILING 24 SDCCFLAGS += --nostdinc -I$(top_srcdir) 25 LINKFLAGS += --nostdlib -L$(top_builddir)/device/lib/build/stm8-large 26endif 27endif 28 29ifdef CROSSCOMPILING 30 SDCCFLAGS += -I$(top_srcdir) 31endif 32 33SDCCFLAGS += -mstm8 --model-large --less-pedantic --out-fmt-ihx 34LINKFLAGS += stm8.lib 35 36OBJEXT = .rel 37BINEXT = .ihx 38 39# otherwise `make` deletes testfwk.rel and `make -j` will fail 40.PRECIOUS: $(PORT_CASES_DIR)/%$(OBJEXT) 41 42# Required extras 43EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT) 44include $(srcdir)/fwk/lib/spec.mk 45 46# Rule to link into .ihx 47%$(BINEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORT_CASES_DIR)/fwk.lib 48 $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) $(EXTRAS) $(PORT_CASES_DIR)/fwk.lib $< -o $@ 49 50%$(OBJEXT): %.asm 51 $(AS) -plosgff $< 52 53%$(OBJEXT): %.c 54 $(SDCC) $(SDCCFLAGS) -c $< -o $@ 55 56$(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.c 57 $(SDCC) $(SDCCFLAGS) -c $< -o $@ 58 59$(PORT_CASES_DIR)/%$(OBJEXT): $(srcdir)/fwk/lib/%.c 60 $(SDCC) $(SDCCFLAGS) -c $< -o $@ 61 62$(PORT_CASES_DIR)/fwk.lib: $(srcdir)/fwk/lib/fwk.lib 63 cat < $(srcdir)/fwk/lib/fwk.lib > $@ 64 65# run simulator with SIM_TIMEOUT seconds timeout 66%.out: %$(BINEXT) $(CASES_DIR)/timeout 67 mkdir -p $(dir $@) 68 -$(CASES_DIR)/timeout $(SIM_TIMEOUT) $(EMU) $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \ 69 || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(BINEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ 70 $(PYTHON) $(srcdir)/get_ticks.py < $@ >> $@ 71 -grep -n FAIL $@ /dev/null || true 72 73_clean: 74