From 13bce9be22334b2b96daea87f24d4cf65803e2d6 Mon Sep 17 00:00:00 2001 From: maartenbrock Date: Wed, 7 Dec 2005 12:49:32 +0000 Subject: [PATCH] * device/lib/Makefile.in: fixed to enable port-specific-objects * device/lib/ds390/i2c390.c (BitOutI2C): optimized by making bout unsigned char, thanks Hubert Sack * doc/sdccman.lyx: documented --xstack-loc, elaborated a bit more on interrupts and pitfalls, removed "setjmp/longjmp unsupported", documented some unsupported C99 features * src/SDCCmain.c (linkEdit): adapted default lib path for --stack-auto * src/SDCCpeeph.c (readRules): inserted patch 1367130 for finding missing if, thanks Hubert Sack * src/mcs51/gen.c (genEndFunction): enabled "pop psw" for regbank 0 isr * support/regression/Makefile.in: test-mcs51-stack-auto no longer needs to make make_library * support/regression/get_ticks.py: new, get cpu cycles and code size, so regression tests can report resource usage (rfe 700441) * support/regression/collate-results.py: report resource usage * support/regression/ports/ds390/spec.mk, * support/regression/ports/hc08/spec.mk, * support/regression/ports/mcs51/spec.mk, * support/regression/ports/ucz80/spec.mk: run sim output through get_ticks * support/regression/ports/ds390/uCsim.cmd, * support/regression/ports/hc08/uCsim.cmd, * support/regression/ports/mcs51/uCsim.cmd, * support/regression/ports/ucz80/uCsim.cmd: inserted "state" to report time * support/regression/ports/mcs51-stack-auto/spec.mk: no need to build the library, use the default one * support/regression/ports/mcs51-xstack-auto/spec.mk: inserted rules for building the library git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4003 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 31 ++++++ device/lib/Makefile.in | 8 +- device/lib/ds390/i2c390.c | 66 ++++++------- doc/sdccman.lyx | 96 ++++++++++++++++--- src/SDCCmain.c | 15 ++- src/SDCCpeeph.c | 33 ++++++- src/mcs51/gen.c | 2 +- support/regression/Makefile.in | 2 +- support/regression/collate-results.py | 17 +++- support/regression/get_ticks.py | 27 ++++++ support/regression/ports/ds390/spec.mk | 3 +- support/regression/ports/ds390/uCsim.cmd | 1 + support/regression/ports/hc08/spec.mk | 3 +- support/regression/ports/hc08/uCsim.cmd | 1 + .../regression/ports/mcs51-stack-auto/spec.mk | 55 +---------- .../ports/mcs51-xstack-auto/spec.mk | 60 +++++++++++- support/regression/ports/mcs51/spec.mk | 3 +- support/regression/ports/mcs51/uCsim.cmd | 1 + support/regression/ports/ucz80/spec.mk | 3 +- support/regression/ports/ucz80/uCsim.cmd | 1 + 20 files changed, 310 insertions(+), 118 deletions(-) create mode 100644 support/regression/get_ticks.py diff --git a/ChangeLog b/ChangeLog index 3ed0cdb3..255e086d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2005-12-07 Maarten Brock + + * device/lib/Makefile.in: fixed to enable port-specific-objects + * device/lib/ds390/i2c390.c (BitOutI2C): optimized by making bout unsigned + char, thanks Hubert Sack + * doc/sdccman.lyx: documented --xstack-loc, + elaborated a bit more on interrupts and pitfalls, + removed "setjmp/longjmp unsupported", + documented some unsupported C99 features + * src/SDCCmain.c (linkEdit): adapted default lib path for --stack-auto + * src/SDCCpeeph.c (readRules): inserted patch 1367130 for finding missing + if, thanks Hubert Sack + * src/mcs51/gen.c (genEndFunction): enabled "pop psw" for regbank 0 isr + * support/regression/Makefile.in: test-mcs51-stack-auto no longer needs to + make make_library + * support/regression/get_ticks.py: new, get cpu cycles and code size, so + regression tests can report resource usage (rfe 700441) + * support/regression/collate-results.py: report resource usage + * support/regression/ports/ds390/spec.mk, + * support/regression/ports/hc08/spec.mk, + * support/regression/ports/mcs51/spec.mk, + * support/regression/ports/ucz80/spec.mk: run sim output through get_ticks + * support/regression/ports/ds390/uCsim.cmd, + * support/regression/ports/hc08/uCsim.cmd, + * support/regression/ports/mcs51/uCsim.cmd, + * support/regression/ports/ucz80/uCsim.cmd: inserted "state" to report time + * support/regression/ports/mcs51-stack-auto/spec.mk: no need to build the + library, use the default one + * support/regression/ports/mcs51-xstack-auto/spec.mk: inserted rules for + building the library + 2005-12-06 Maarten Brock * config.dsp: added dependency on .version and configure_vc.awk diff --git a/device/lib/Makefile.in b/device/lib/Makefile.in index 2ab439cd..690cc894 100644 --- a/device/lib/Makefile.in +++ b/device/lib/Makefile.in @@ -49,7 +49,9 @@ CFLAGS = $(MODELFLAGS) --nostdinc BUILDDIR = build # Default PORT = z80 +ifndef PORTDIR PORTDIR = $(BUILDDIR)/$(PORT) +endif SOURCES = _atof.c _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \ _decdptr.c _divsint.c _divslong.c _divuint.c \ @@ -189,20 +191,20 @@ models: small-mcs51-stack-auto: if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \ - $(MAKE) MODELFLAGS="--model-small --stack-auto" PORT=small-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \ + $(MAKE) MODELFLAGS="--model-small --stack-auto" PORT=small PORTDIR=$(BUILDDIR)/small-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \ fi model-mcs51-stack-auto: if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \ for model in $(MODELS); do \ - $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \ + $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model PORTDIR=$(BUILDDIR)/$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \ done \ fi model-mcs51-xstack-auto: if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \ for model in $(MODELS); do \ - $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$$model-xstack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \ + $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$$model PORTDIR=$(BUILDDIR)/$$model-xstack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \ done \ fi diff --git a/device/lib/ds390/i2c390.c b/device/lib/ds390/i2c390.c index aa0f273a..02766a02 100644 --- a/device/lib/ds390/i2c390.c +++ b/device/lib/ds390/i2c390.c @@ -1,9 +1,9 @@ -/* This implemenation is based on an example I once grabbed from +/* This implemenation is based on an example I once grabbed from the Philips bbs. - Don't know who wrote it, but is has been hacked so heavely, he/she wouldn't + Don't know who wrote it, but is has been hacked so heavily, he/she wouldn't recogize it anyway */ -//#define DEBUG_I2C ==> DON'T DO THIS IS A LIBRARY <== +//#define DEBUG_I2C ==> DON'T DO THIS, THIS IS A LIBRARY <== #ifdef DEBUG_I2C #include @@ -91,7 +91,7 @@ char I2CStop(void) I2CDelay(I2CDELAY); SDA_HIGH; /* ...and then SDA up -> stop condition. */ I2CDelay(I2CDELAY); - + return (SCL_IN && SDA_IN); /* Both will be up, if everything is fine */ } @@ -101,26 +101,26 @@ char I2CStop(void) * Returns 0 on success, 1 if we lose arbitration. */ -char BitOutI2C(char bout) +char BitOutI2C(unsigned char bout) { SDA_OUT(bout); /* Put data out on SDA */ I2CDelay(I2CDELAY); - SCL_HIGH; /* Let SCL go up */ - while(!SCL_IN) /* Wait until all other devices are ready */ + SCL_HIGH; /* Let SCL go up */ + while(!SCL_IN) /* Wait until all other devices are ready */ { // should do a timeout here } - - if (SDA_IN != bout) /* Arbitration lost, release bus and return */ + + if (SDA_IN != bout) /* Arbitration lost, release bus and return */ { - SDA_HIGH; /* Should be up anyway, but make sure */ + SDA_HIGH; /* Should be up anyway, but make sure */ i2cError = I2CERR_LOST; I2CDumpError(i2cError); return 1; } I2CDelay(I2CDELAY); SCL_LOW; /* Pull SCL back down */ - I2CDelay(I2CDELAY); + I2CDelay(I2CDELAY); return 0; /* OK */ } @@ -132,16 +132,16 @@ char BitOutI2C(char bout) char BitInI2C(void) { char bin; - + // SDA is opencollector, so: SDA_HIGH; - - SCL_HIGH; /* Let SCL go up */ - while(!SCL_IN) /* Wait for other devices */ + + SCL_HIGH; /* Let SCL go up */ + while(!SCL_IN) /* Wait for other devices */ { // should do a timeout here } - bin = SDA_IN; /* Read in data */ + bin = SDA_IN; /* Read in data */ I2CDelay(I2CDELAY); SCL_LOW; /* Pull SCL back up */ I2CDelay(I2CDELAY); @@ -159,7 +159,7 @@ char BitInI2C(void) char ByteOutI2C(char dat) { char bit_count; - + bit_count = 8; while(bit_count) { if (dat & 0x80) { @@ -176,7 +176,7 @@ char ByteOutI2C(char dat) dat <<= 1; bit_count--; } - + if (BitInI2C()) { i2cError = I2CERR_NAK; I2CDumpError(i2cError); @@ -196,17 +196,17 @@ char ByteOutI2C(char dat) char I2CByteIn(char ack) { char bit_count, byte_in; - + bit_count = 8; byte_in = 0; - + while(bit_count) { byte_in <<= 1; if (BitInI2C()) byte_in |= 0x01; bit_count--; } - + BitOutI2C(ack); SDA_HIGH; /* Added 18-Jul-95 - thanks to Ray Bellis */ return byte_in; @@ -221,10 +221,10 @@ char I2CByteIn(char ack) char I2CSendStop(char addr, char count, char send_stop) { char byteptr, byte_out; - + if (I2CStart()) return 1; i2cError = 0; - + byte_out = addr & 0xfe; /* Ensure that it's a write address */ count++; /* Include slave address to byte count */ byteptr = 0; @@ -239,7 +239,7 @@ char I2CSendStop(char addr, char count, char send_stop) byteptr++; count--; } - + if (send_stop) I2CStop(); return 0; } @@ -253,19 +253,19 @@ char I2CSendStop(char addr, char count, char send_stop) char i2c_recv(char addr, char count) { char byteptr, byte_in; - + if (I2CStart()) return 1; i2cError = 0; byteptr = 0; - + byte_in = addr | 0x01; - + if (ByteOutI2C(byte_in)) { if (i2cError == I2CERR_NAK) I2CStop(); return i2cError; } - + while(count) { count-=1; @@ -277,9 +277,9 @@ char i2c_recv(char addr, char count) i2cReceiveBuffer[byteptr] = byte_in; byteptr++; } - + I2CStop(); - + return (i2cError ? 1 : 0); } @@ -297,15 +297,15 @@ char I2CSendReceive(char addr, char tx_count, char rx_count) { /* If send fails, abort but don't send a stop condition if we lost arbitration */ - + if (i2cError != I2CERR_LOST) I2CStop(); return 1; } - + SDA_HIGH; /* One of these may be low now, in which case the next */ SCL_HIGH; /* start condition wouldn't be detected so make */ I2CDelay(I2CDELAY); /* sure that they're up and wait for one delay slot */ - + if (i2c_recv((char)(addr|0x01), rx_count)) return 1; return (i2cError ? 1 : 0); } diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index 22df670d..111f2884 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -5741,6 +5741,61 @@ status Collapsed \labelwidthstring 00.00.0000 +\series bold +- +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +/ +\end_inset + +-xstack-loc +\series default + +\begin_inset LatexCommand \index{-\/-xstack-loc } + +\end_inset + +\SpecialChar ~ + By default the external stack +\begin_inset LatexCommand \index{xstack} + +\end_inset + + is placed after the pdata segment. + Using this option the xstack can be placed anywhere in the external memory + space of the 8051. + The value entered can be in Hexadecimal or Decimal format, e.g. + - +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +/ +\end_inset + +-xstack-loc 0x8000 or - +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +/ +\end_inset + +-stack-loc 32768. + The provided value should not overlap any other memory areas such as the + pdata or xdata segment and with enough space for the current application. +\layout List +\labelwidthstring 00.00.0000 + + \series bold - \begin_inset ERT @@ -10887,7 +10942,13 @@ nooverlay if it is not reentrant. Furthermore nonreentrant functions should not be called from the main program while the interrupt service routine might be active. - + They also must not be called from low priority interrupt service routines + while a high priority interrupt service routine might be active. You could use + semaphores or make the function +\emph on + critical +\emph default + if all parameters are passed in registers. \newline \newline @@ -26362,19 +26423,6 @@ struct s { char x } a[] = {{1}, {2}}; /* OK */ not supported. \layout Itemize -No support for setjmp -\begin_inset LatexCommand \index{setjmp (not supported)} - -\end_inset - - and longjmp -\begin_inset LatexCommand \index{longjmp (not supported)} - -\end_inset - - (for now). -\layout Itemize - Old K&R style \begin_inset LatexCommand \index{K\&R style} @@ -26403,6 +26451,26 @@ int i,j; /* are valid in ANSI but not valid in SDCC */ \end_deeper \layout Itemize +Most enhancements in C99 are not supported, f.e.: +\begin_deeper +\layout Verse + + +\family typewriter +\series bold +inline +\series default + int increment (int a) { return a+1; } /* is invalid in SDCC although allowed + in C99 */ +\newline +for ( +\series bold +int +\series default + i=0; i<10; i++) /* is invalid in SDCC although allowed in C99 */ +\end_deeper +\layout Itemize + Certain words that are valid identifiers in the standard may be reserved words in SDCC unless the \series bold diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 6c286a33..a44ef95b 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -1579,13 +1579,22 @@ linkEdit (char **envp) switch (options.model) { case MODEL_SMALL: - c = "small"; + if (options.stackAuto) + c = "small-stack-auto"; + else + c = "small"; break; case MODEL_MEDIUM: - c = "medium"; + if (options.stackAuto) + c = "medium-stack-auto"; + else + c = "medium"; break; case MODEL_LARGE: - c = "large"; + if (options.stackAuto) + c = "large-stack-auto"; + else + c = "large"; break; case MODEL_FLAT24: /* c = "flat24"; */ diff --git a/src/SDCCpeeph.c b/src/SDCCpeeph.c index 8225ac5e..b227cf0a 100644 --- a/src/SDCCpeeph.c +++ b/src/SDCCpeeph.c @@ -1318,7 +1318,7 @@ readRules (char *bp) { char restart = 0; char lines[MAX_PATTERN_LEN]; - char *lp; + char *lp, *rp; lineNode *match; lineNode *replace; lineNode *currL = NULL; @@ -1374,6 +1374,9 @@ top: EXPECT_CHR (bp, '{', "expected '{'\n"); bp++; + /* save char position (needed for generating error msg) */ + rp = bp; + SKIP_SPACE (bp, "unexpected end of rule\n"); getPeepLine (&replace, &bp); @@ -1403,7 +1406,33 @@ top: newPeepRule (match, replace, lines, restart); } else - newPeepRule (match, replace, NULL, restart); + { + if (*bp && strncmp (bp, "replace", 7)) + { + /* not the start of a new peeprule, so "if" should be here */ + + char strbuff[1000]; + char *cp; + + /* go to the start of the line following "{" of the "by" token */ + while (*rp && (*rp == '\n')) + rp++; + + /* copy text of rule starting with line after "by {" */ + cp = strbuff; + while (*rp && (rp < bp) && ((cp - strbuff) < sizeof(strbuff))) + *cp++ = *rp++; + + /* and now the rest of the line */ + while (*rp && (*rp != '\n') && ((cp - strbuff) < sizeof(strbuff))) + *cp++ = *rp++; + + *cp = '\0'; + fprintf (stderr, "%s\nexpected '} if ...'\n", strbuff); + return; + } + newPeepRule (match, replace, NULL, restart); + } goto top; } diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index fbbe3a9f..1707317e 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -3584,7 +3584,7 @@ genEndFunction (iCode * ic) /* restore the register bank */ if ( /* FUNC_REGBANK (sym->type) || */ IFFUNC_ISISR (sym->type)) { - if (/* !FUNC_REGBANK (sym->type) || */ !IFFUNC_ISISR (sym->type) + if (!FUNC_REGBANK (sym->type) || !IFFUNC_ISISR (sym->type) || !options.useXstack) { /* Special case of ISR using non-zero bank with useXstack diff --git a/support/regression/Makefile.in b/support/regression/Makefile.in index f2ee211a..6450e85b 100644 --- a/support/regression/Makefile.in +++ b/support/regression/Makefile.in @@ -94,7 +94,7 @@ test-mcs51-large: $(MAKE) test-port PORT=mcs51-large test-mcs51-stack-auto: - $(MAKE) make_library test-port PORT=mcs51-stack-auto + $(MAKE) test-port PORT=mcs51-stack-auto test-mcs51-xstack-auto: $(MAKE) make_library test-port PORT=mcs51-xstack-auto diff --git a/support/regression/collate-results.py b/support/regression/collate-results.py index ea6b1999..03f891a7 100644 --- a/support/regression/collate-results.py +++ b/support/regression/collate-results.py @@ -12,9 +12,13 @@ lines = sys.stdin.readlines() failures = 0 cases = 0 tests = 0 +bytes = 0 +ticks = 0 for line in lines: - # '--- Summary: f/t/c ...', where f = # failures, t = # test points, + if (re.search(r'^--- Running', line)): + name = line + # '--- Summary: f/t/c: ...', where f = # failures, t = # test points, # c = # test cases. if (re.search(r'^--- Summary:', line)): (summary, data, rest) = re.split(r':', line) @@ -22,5 +26,14 @@ for line in lines: failures = failures + string.atof(nfailures) tests = tests + string.atof(ntests) cases = cases + string.atof(ncases) + if (string.atof(nfailures)): + print name -print "%.0f failures, %.0f tests, %.0f test cases" % (failures, tests, cases) + # '--- Simulator: b/t: ...', where b = # bytes, t = # ticks + if (re.search(r'^--- Simulator:', line)): + (simulator, data, rest) = re.split(r':', line) + (nbytes, nticks) = re.split(r'/', data) + bytes = bytes + string.atof(nbytes) + ticks = ticks + string.atof(nticks) + +print "%.0f failures, %.0f tests, %.0f test cases, %.0f bytes, %.0f ticks" % (failures, tests, cases, bytes, ticks) diff --git a/support/regression/get_ticks.py b/support/regression/get_ticks.py new file mode 100644 index 00000000..bffeed58 --- /dev/null +++ b/support/regression/get_ticks.py @@ -0,0 +1,27 @@ +import sys, re +import string + +"""Simple script that scans all of the simulator output text fed in +through stdin and summarises the total number of system clock ticks.""" + +# Read in everything +lines = sys.stdin.readlines() + +# Declare globals +bytes = 0 +ticks = 0 + +for line in lines: + # 'n words read from ...', where = # bytes in hex file + if (re.search(r'words read from', line)): + (data, post) = re.split(r'w', line, 1) + bytes = string.atoi(data) + + # 'Total time since last reset= 0.102021 sec (i clks)', + # where i = # system clock ticks. + if (re.search(r'^Total time', line)): + (pre, data) = re.split(r'\(', line) + (nticks, post) = re.split(r' ', data) + ticks = string.atoi(nticks) + +print "\n--- Simulator: %d/%d: %d bytes, %d ticks" % (bytes, ticks, bytes, ticks) diff --git a/support/regression/ports/ds390/spec.mk b/support/regression/ports/ds390/spec.mk index c231a12b..62de8160 100644 --- a/support/regression/ports/ds390/spec.mk +++ b/support/regression/ports/ds390/spec.mk @@ -29,8 +29,9 @@ $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT): fwk/lib/testfwk.c # run simulator with 25 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` - -fwk/lib/timeout 25 $(S51) -tds390f -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd >/dev/null || \ + -fwk/lib/timeout 25 $(S51) -tds390f -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd > $(@:.out=.sim) || \ echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + python get_ticks.py < $(@:.out=.sim) >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c diff --git a/support/regression/ports/ds390/uCsim.cmd b/support/regression/ports/ds390/uCsim.cmd index 5989cdb8..cd2b1680 100644 --- a/support/regression/ports/ds390/uCsim.cmd +++ b/support/regression/ports/ds390/uCsim.cmd @@ -4,4 +4,5 @@ set error memory off set error stack off break xram r 0x7654 run +state quit diff --git a/support/regression/ports/hc08/spec.mk b/support/regression/ports/hc08/spec.mk index 1c1c8931..27d1b698 100644 --- a/support/regression/ports/hc08/spec.mk +++ b/support/regression/ports/hc08/spec.mk @@ -32,8 +32,9 @@ $(PORTS_DIR)/$(PORT)/%$(OBJEXT): fwk/lib/%.c # run simulator with 10 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` - -fwk/lib/timeout 10 $(UCHC08) -t32 $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \ + -fwk/lib/timeout 10 $(UCHC08) $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \ || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + python get_ticks.py < $@ >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c diff --git a/support/regression/ports/hc08/uCsim.cmd b/support/regression/ports/hc08/uCsim.cmd index 807e4760..fb936ccf 100644 --- a/support/regression/ports/hc08/uCsim.cmd +++ b/support/regression/ports/hc08/uCsim.cmd @@ -3,4 +3,5 @@ set error unknown_code off set error memory off set error stack off run +state quit diff --git a/support/regression/ports/mcs51-stack-auto/spec.mk b/support/regression/ports/mcs51-stack-auto/spec.mk index 1b654dfd..f9e2b863 100644 --- a/support/regression/ports/mcs51-stack-auto/spec.mk +++ b/support/regression/ports/mcs51-stack-auto/spec.mk @@ -2,61 +2,12 @@ # # model small stack-auto -include $(PORTS_DIR)/mcs51/spec.mk - -LIBSRCDIR = ../../device/lib -LIBDIR = gen/$(PORT)/lib - -LIBSDCCFLAGS+=--stack-auto -SDCCFLAGS +=$(LIBSDCCFLAGS) +SDCCFLAGS +=--stack-auto # copy support.c $(PORTS_DIR)/$(PORT)/%.c: $(PORTS_DIR)/mcs51/%.c cp $< $@ -SOURCES = _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \ - _decdptr.c _divsint.c _divslong.c _divuint.c \ - _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \ - _fs2uchar.c _fs2uint.c _fs2ulong.c \ - _fsadd.c _fssub.c _fsdiv.c _fsmul.c \ - _fseq.c _fsneq.c _fsgt.c _fslt.c _fscmp.c \ - fabsf.c sqrtf.c logf.c log10f.c powf.c tanf.c \ - errno.c frexpf.c ldexpf.c tancotf.c \ - _fsget1arg.c _fsget2args.c _fsnormalize.c \ - _fsreturnval.c _fsrshift.c _fsswapargs.c \ - _gptrget.c _gptrput.c \ - _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \ - _islower.c _isprint.c _ispunct.c _isspace.c \ - _isupper.c _isxdigit.c _slong2fs.c \ - _memcmp.c _memcpy.c _memmove.c _memset.c \ - _modsint.c _modslong.c _moduint.c _modulong.c \ - _mulint.c _mullong.c \ - _ser.c _setjmp.c \ - _spx.c _startup.c \ - _strcat.c _strchr.c _strcmp.c _strcpy.c \ - _strcspn.c _strlen.c _strncat.c _strncmp.c \ - _strncpy.c _strpbrk.c _strrchr.c _strspn.c \ - _strstr.c _strtok.c \ - _uchar2fs.c _uint2fs.c _ulong2fs.c \ - calloc.c malloc.c realloc.c free.c \ - serial.c ser_ir.c printfl.c \ - printf_large.c sprintf.c vprintf.c puts.c gets.c \ - assert.c time.c printf_fast.c bpx.c - -OBJECTS = $(patsubst %.c,$(LIBDIR)/%.rel,$(SOURCES)) -MODULES = $(patsubst %.c,%,$(SOURCES)) - -MAKE_LIBRARY = $(LIBDIR) $(OBJECTS) lib-files - -$(LIBDIR): - mkdir -p $(LIBDIR) - -$(LIBDIR)/%.rel: $(LIBSRCDIR)/%.c - -$(SDCC) -I../../device/include $(LIBSDCCFLAGS) -c $< -o $@ +include $(PORTS_DIR)/mcs51/spec.mk -.PHONY: lib-files -lib-files: - make -C $(LIBSRCDIR)/mcs51 all - cp $(LIBSRCDIR)/mcs51/*.rel $(LIBSRCDIR)/mcs51/mcs51.lib $(LIBDIR) - echo $(MODULES) | tr ' ' '\n' > $(LIBDIR)/libsdcc.lib - touch $(LIBDIR)/libfloat.lib $(LIBDIR)/libint.lib $(LIBDIR)/liblong.lib +LIBDIR = $(SDCC_DIR)/device/lib/build/small-stack-auto diff --git a/support/regression/ports/mcs51-xstack-auto/spec.mk b/support/regression/ports/mcs51-xstack-auto/spec.mk index ae82b657..5f43367d 100644 --- a/support/regression/ports/mcs51-xstack-auto/spec.mk +++ b/support/regression/ports/mcs51-xstack-auto/spec.mk @@ -1,8 +1,62 @@ # Port specification for the mcs51 port running with uCsim # -# model small stack-auto +# model small xstack-auto -include $(PORTS_DIR)/mcs51-stack-auto/spec.mk +include $(PORTS_DIR)/mcs51/spec.mk -LIBSDCCFLAGS+= --xstack +LIBSRCDIR = ../../device/lib +LIBDIR = gen/$(PORT)/lib + +LIBSDCCFLAGS+=--stack-auto --xstack SDCCFLAGS +=$(LIBSDCCFLAGS) + +# copy support.c +$(PORTS_DIR)/$(PORT)/%.c: $(PORTS_DIR)/mcs51/%.c + cp $< $@ + +SOURCES = _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \ + _decdptr.c _divsint.c _divslong.c _divuint.c \ + _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \ + _fs2uchar.c _fs2uint.c _fs2ulong.c \ + _fsadd.c _fssub.c _fsdiv.c _fsmul.c \ + _fseq.c _fsneq.c _fsgt.c _fslt.c _fscmp.c \ + fabsf.c sqrtf.c logf.c log10f.c powf.c tanf.c \ + errno.c frexpf.c ldexpf.c tancotf.c \ + _fsget1arg.c _fsget2args.c _fsnormalize.c \ + _fsreturnval.c _fsrshift.c _fsswapargs.c \ + _gptrget.c _gptrput.c \ + _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \ + _islower.c _isprint.c _ispunct.c _isspace.c \ + _isupper.c _isxdigit.c _slong2fs.c \ + _memcmp.c _memcpy.c _memmove.c _memset.c \ + _modsint.c _modslong.c _moduint.c _modulong.c \ + _mulint.c _mullong.c \ + _ser.c _setjmp.c \ + _spx.c _startup.c \ + _strcat.c _strchr.c _strcmp.c _strcpy.c \ + _strcspn.c _strlen.c _strncat.c _strncmp.c \ + _strncpy.c _strpbrk.c _strrchr.c _strspn.c \ + _strstr.c _strtok.c \ + _uchar2fs.c _uint2fs.c _ulong2fs.c \ + calloc.c malloc.c realloc.c free.c \ + serial.c ser_ir.c printfl.c \ + printf_large.c sprintf.c vprintf.c puts.c gets.c \ + assert.c time.c bpx.c + +OBJECTS = $(patsubst %.c,$(LIBDIR)/%.rel,$(SOURCES)) +MODULES = $(patsubst %.c,%,$(SOURCES)) + +MAKE_LIBRARY = $(LIBDIR) $(OBJECTS) lib-files + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/%.rel: $(LIBSRCDIR)/%.c + -$(SDCC) -I../../device/include $(LIBSDCCFLAGS) -c $< -o $@ + +.PHONY: lib-files +lib-files: + make -C $(LIBSRCDIR)/mcs51 all + cp $(LIBSRCDIR)/mcs51/*.rel $(LIBSRCDIR)/mcs51/mcs51.lib $(LIBDIR) + echo $(MODULES) | tr ' ' '\n' > $(LIBDIR)/libsdcc.lib + touch $(LIBDIR)/libfloat.lib $(LIBDIR)/libint.lib $(LIBDIR)/liblong.lib diff --git a/support/regression/ports/mcs51/spec.mk b/support/regression/ports/mcs51/spec.mk index f563510f..6df802ca 100644 --- a/support/regression/ports/mcs51/spec.mk +++ b/support/regression/ports/mcs51/spec.mk @@ -35,8 +35,9 @@ $(PORTS_DIR)/$(PORT)/fwk.lib: # run simulator with 30 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` - -fwk/lib/timeout 30 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \ + -fwk/lib/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 get_ticks.py < $(@:.out=.sim) >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c diff --git a/support/regression/ports/mcs51/uCsim.cmd b/support/regression/ports/mcs51/uCsim.cmd index 5989cdb8..cd2b1680 100755 --- a/support/regression/ports/mcs51/uCsim.cmd +++ b/support/regression/ports/mcs51/uCsim.cmd @@ -4,4 +4,5 @@ set error memory off set error stack off break xram r 0x7654 run +state quit diff --git a/support/regression/ports/ucz80/spec.mk b/support/regression/ports/ucz80/spec.mk index ccd2df81..a4f73bc0 100644 --- a/support/regression/ports/ucz80/spec.mk +++ b/support/regression/ports/ucz80/spec.mk @@ -35,8 +35,9 @@ $(PORTS_DIR)/$(PORT)/%$(OBJEXT): fwk/lib/%.c # run simulator with 10 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` - -fwk/lib/timeout 10 $(UCZ80) -t32 $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \ + -fwk/lib/timeout 10 $(UCZ80) $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \ || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + python get_ticks.py < $@ >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c diff --git a/support/regression/ports/ucz80/uCsim.cmd b/support/regression/ports/ucz80/uCsim.cmd index 807e4760..fb936ccf 100755 --- a/support/regression/ports/ucz80/uCsim.cmd +++ b/support/regression/ports/ucz80/uCsim.cmd @@ -3,4 +3,5 @@ set error unknown_code off set error memory off set error stack off run +state quit -- 2.30.2