diff options
Diffstat (limited to 'support/regression/ports/ds390')
| -rw-r--r-- | support/regression/ports/ds390/spec.mk | 75 | ||||
| -rw-r--r-- | support/regression/ports/ds390/support.c | 44 | ||||
| -rw-r--r-- | support/regression/ports/ds390/uCsim.cmd | 8 |
3 files changed, 127 insertions, 0 deletions
diff --git a/support/regression/ports/ds390/spec.mk b/support/regression/ports/ds390/spec.mk new file mode 100644 index 0000000..3429910 --- /dev/null +++ b/support/regression/ports/ds390/spec.mk @@ -0,0 +1,75 @@ +# Regression test specification for the ds390 target running with uCsim + +.PRECIOUS: %.c + +CC_FOR_BUILD = $(CC) + +# simulation timeout in seconds +SIM_TIMEOUT = 240 + +# path to uCsim +ifdef SDCC_BIN_PATH + S51 = $(SDCC_BIN_PATH)/s51$(EXEEXT) +else + ifdef UCSIM_DIR + S51A = $(UCSIM_DIR)/s51.src/s51$(EXEEXT) + else + S51A = $(top_builddir)/sim/ucsim/s51.src/s51$(EXEEXT) + S51B = $(top_builddir)/bin/s51$(EXEEXT) + endif + + EMU = $(WINE) $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi) + +ifndef CROSSCOMPILING + SDCCFLAGS += --nostdinc -I$(top_srcdir) + LINKFLAGS += --nostdlib -L$(top_builddir)/device/lib/build/ds390 +endif +endif + +ifdef CROSSCOMPILING + DEV_NULL ?= NUL + SDCCFLAGS += -I$(top_srcdir) +else + DEV_NULL ?= /dev/null +endif + +SDCCFLAGS += -mds390 --less-pedantic -Wl-r +LINKFLAGS += libsdcc.lib liblong.lib liblonglong.lib libint.lib libfloat.lib +LINKFLAGS += libds390.lib + +OBJEXT = .rel +BINEXT = .ihx + +# otherwise `make` deletes testfwk.rel and `make -j` will fail +.PRECIOUS: $(PORT_CASES_DIR)/%$(OBJEXT) + +# Required extras +EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT) +include $(srcdir)/fwk/lib/spec.mk + +# Rule to link into .ihx +%$(BINEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORT_CASES_DIR)/fwk.lib + $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) $(EXTRAS) $(PORT_CASES_DIR)/fwk.lib $< -o $@ + +%$(OBJEXT): %.c + $(SDCC) $(SDCCFLAGS) -c $< -o $@ + +$(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.c + $(SDCC) $(SDCCFLAGS) -c $< -o $@ + +$(PORT_CASES_DIR)/%$(OBJEXT): $(srcdir)/fwk/lib/%.c + $(SDCC) $(SDCCFLAGS) -c $< -o $@ + +$(PORT_CASES_DIR)/fwk.lib: $(srcdir)/fwk/lib/fwk.lib + cat < $(srcdir)/fwk/lib/fwk.lib > $@ + +# run simulator with SIM_TIMEOUT seconds timeout +%.out: %$(BINEXT) $(CASES_DIR)/timeout + mkdir -p $(dir $@) + -$(CASES_DIR)/timeout $(SIM_TIMEOUT) $(EMU) -tds390 -S in=$(DEV_NULL),out=$@ $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $(@:.out=.sim) \ + || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(BINEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + $(PYTHON) $(srcdir)/get_ticks.py < $(@:.out=.sim) >> $@ + -grep -n FAIL $@ /dev/null || true + + +_clean: diff --git a/support/regression/ports/ds390/support.c b/support/regression/ports/ds390/support.c new file mode 100644 index 0000000..190b3d4 --- /dev/null +++ b/support/regression/ports/ds390/support.c @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + support.c - startup for regression tests with uCsim + + Copied from tinibios.c, which was written By - Johan Knol, johan.knol@iduna.nl + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! +-------------------------------------------------------------------------*/ + +#include <tinibios.h> + +void +_putchar (char c) +{ + Serial0PutChar (c); +} + +void +_initEmu (void) +{ +} + +void +_exitEmu (void) +{ + Serial0PutChar (' '); /* wait for the last character to be transmitted */ + /* before hitting the breakpoint */ + * (char __idata *) 0 = * (char __xdata *) 0x7654; +} diff --git a/support/regression/ports/ds390/uCsim.cmd b/support/regression/ports/ds390/uCsim.cmd new file mode 100644 index 0000000..cd2b168 --- /dev/null +++ b/support/regression/ports/ds390/uCsim.cmd @@ -0,0 +1,8 @@ +set error non-classified off +set error unknown_code off +set error memory off +set error stack off +break xram r 0x7654 +run +state +quit |
