From: borutr Date: Mon, 22 May 2006 20:04:51 +0000 (+0000) Subject: * support/regression/ports/pic16/specs.mk: removed stack size linker X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=eb3079f1d97e91484f313e56ea90a1d854028821;p=fw%2Fsdcc * support/regression/ports/pic16/specs.mk: removed stack size linker directive * support/regression/tests/array.c, support/regression/tests/bitopcse.c, support/regression/tests/bug-908454.c, support/regression/tests/malloc.c: modified for pic16 regression test * support/regression/tests/bitfields.c: pic16 - excluded bitfileds of size > 8 * support/regression/tests/bp.c: pic16 - reduced data size * support/regression/tests/bug-221100.c: pic16 - reduced data size * support/regression/tests/bug-460010.c: pic16 - used the absolute address the fits in memory * support/regression/tests/bug-716242.c: bug [ 1443651 ] pic 16: redefining symbol that cannot be redefined. * support/regression/tests/float.c: pic16 - excluded - data size too big * support/regression/tests/onebyte.c: pic16 - bug [ 1444425 ] onebyte.c regression tes fails on pic16 * support/regression/tests/shifts.c: pic16 - function names probably have to differ in first X characters (gpasm limitation?) * support/regression/tests/staticinit.c: pic16 - excluded some tests due error: no target memory available for section ".idata" git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4185 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index a58aafcb..9cd477a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2006-05-22 Borut Razem + + * support/regression/ports/pic16/specs.mk: removed stack size linker + directive + * support/regression/tests/array.c, + support/regression/tests/bitopcse.c, + support/regression/tests/bug-908454.c, + support/regression/tests/malloc.c: modified for pic16 regression test + * support/regression/tests/bitfields.c: + pic16 - excluded bitfileds of size > 8 + * support/regression/tests/bp.c: pic16 - reduced data size + * support/regression/tests/bug-221100.c: pic16 - reduced data size + * support/regression/tests/bug-460010.c: + pic16 - used the absolute address the fits in memory + * support/regression/tests/bug-716242.c: + bug [ 1443651 ] pic 16: redefining symbol that cannot be redefined. + * support/regression/tests/float.c: + pic16 - excluded - data size too big + * support/regression/tests/onebyte.c: + pic16 - bug [ 1444425 ] onebyte.c regression tes fails on pic16 + * support/regression/tests/shifts.c: + pic16 - function names probably have to differ in first X characters + (gpasm limitation?) + * support/regression/tests/staticinit.c: + pic16 - excluded some tests due error: no target memory available for + section ".idata" + 2006-05-22 Borut Razem * support/Util/dbuf.c: fixed bug #1489008 fix dbuf_c_str(), diff --git a/support/regression/ports/pic16/spec.mk b/support/regression/ports/pic16/spec.mk index 288edfef..1e77dd02 100644 --- a/support/regression/ports/pic16/spec.mk +++ b/support/regression/ports/pic16/spec.mk @@ -7,9 +7,9 @@ else GPSIM := gpsim endif -SDCCFLAGS += -mpic16 -pp18f452 -I$(top_srcdir)/device/include/pic16 --nostdinc --less-pedantic -Wl,-t255 -Wl,-q -DREENTRANT=reentrant -I$(top_srcdir) -LINKFLAGS = --nostdlib -LINKFLAGS += libsdcc.lib libc18f.lib libm18f.lib +SDCCFLAGS += -mpic16 -pp18f452 -I$(top_srcdir)/device/include/pic16 --nostdinc --less-pedantic -Wl,-q -DREENTRANT=reentrant -I$(top_srcdir) +#LINKFLAGS = --nostdlib +#LINKFLAGS += libsdcc.lib libc18f.lib libm18f.lib LIBDIR = $(top_builddir)device/lib/build/pic16 OBJEXT = .o @@ -27,14 +27,16 @@ EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT) $(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.c $(SDCC) $(SDCCFLAGS) -c $< -o $@ +.PRECIOUS: gen/pic16/testfwk.o gen/pic16/support.o + $(PORT_CASES_DIR)/%$(OBJEXT): fwk/lib/%.c $(SDCC) $(SDCCFLAGS) -c $< -o $@ # run simulator with 25 seconds timeout %.out: %$(EXEEXT) $(CASES_DIR)/timeout mkdir -p $(dir $@) - -$(CASES_DIR)/timeout 25 $(GPSIM) -i -s $< -c $(PORTS_DIR)/pic16/gpsim.cmd > $@ || \ - echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + -$(CASES_DIR)/timeout 25 "$(GPSIM)" -i -s $< -c $(PORTS_DIR)/pic16/gpsim.cmd > $@ || \ + echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ python $(srcdir)/get_ticks.py < $@ >> $@ -grep -n FAIL $@ /dev/null || true diff --git a/support/regression/tests/array.c b/support/regression/tests/array.c index b2e18539..cf8f6450 100644 --- a/support/regression/tests/array.c +++ b/support/regression/tests/array.c @@ -4,11 +4,6 @@ */ #include -#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) -# define xdata -# define code -#endif - #define TC(x) (0x10+(x)) #define TI(x) (0x1020+(x) + 0x100*(x)) #define TL(x) (0x10203040+(x)) diff --git a/support/regression/tests/bitfields.c b/support/regression/tests/bitfields.c index 70077411..4268d74b 100644 --- a/support/regression/tests/bitfields.c +++ b/support/regression/tests/bitfields.c @@ -1,5 +1,7 @@ /** Bitfield tests. + SDCC pic16 port currently does not support bitfields of size > 8, + so they are ifdefed out. */ #include @@ -8,6 +10,7 @@ struct { char c3_5 : 5; } c_bf; +#if !defined(SDCC_pic16) struct { int i0_7 : 7; int i7_9 : 9; @@ -32,6 +35,7 @@ struct { unsigned int b8 : 1; unsigned int b9 : 1; } sb_bf; +#endif /* !SDCC_pic16 */ struct { unsigned int b0 : 1; @@ -56,6 +60,7 @@ struct { unsigned int b1 : 1; } size2a_bf; +#if !defined(SDCC_pic16) struct { unsigned int b0 : 1; unsigned int b1 : 1; @@ -90,7 +95,7 @@ struct { signed int s7_1 : 1; signed int s8_9 : 9; } s_bf; - +#endif /* !SDCC_pic16 */ void testBitfieldSizeof(void) @@ -102,12 +107,13 @@ testBitfieldSizeof(void) ASSERT( sizeof(size1a_bf) >= 1); ASSERT( sizeof(size1b_bf) >= 1); ASSERT( sizeof(size1c_bf) >= 1); +#if !defined(SDCC_pic16) ASSERT( sizeof(size2b_bf) >= 2); ASSERT( sizeof(size2c_bf) >= 2); ASSERT( sizeof(size2d_bf) >= 2); ASSERT( sizeof(size3a_bf) >= 2); ASSERT( sizeof(size1a_bf) <= sizeof(size1b_bf)); - +#endif /* !SDCC_pic16 */ /* Some SDCC specific assertions. SDCC uses 8 bit storage units. Bitfields that are less than 8 bits, but would (due to earlier bitfield declarations) span a storage unit boundary are @@ -120,10 +126,12 @@ testBitfieldSizeof(void) ASSERT( sizeof(size1b_bf) == 1); ASSERT( sizeof(size1c_bf) == 1); ASSERT( sizeof(size2a_bf) == 2); +#if !defined(SDCC_pic16) ASSERT( sizeof(size2b_bf) == 2); ASSERT( sizeof(size2c_bf) == 2); ASSERT( sizeof(size2d_bf) == 2); ASSERT( sizeof(size3a_bf) == 3); +#endif /* !SDCC_pic16 */ #endif } @@ -131,6 +139,7 @@ testBitfieldSizeof(void) void testBitfieldsSingleBitLiteral(void) { +#if !defined(SDCC_pic16) size2b_bf.b0 = 0; size2b_bf.b1 = 0; size2b_bf.b2 = 0; @@ -178,11 +187,13 @@ testBitfieldsSingleBitLiteral(void) ASSERT(size2b_bf.b7==0); ASSERT(size2b_bf.b8==0); ASSERT(size2b_bf.b9==1); +#endif /* !SDCC_pic16 */ } void testBitfieldsSingleBit(void) { +#if !defined(SDCC_pic16) volatile unsigned char c; c = 0; @@ -235,11 +246,13 @@ testBitfieldsSingleBit(void) ASSERT(size2b_bf.b7==0); ASSERT(size2b_bf.b8==0); ASSERT(size2b_bf.b9==1); +#endif /* !SDCC_pic16 */ } void testBitfieldsMultibitLiteral(void) { +#if !defined(SDCC_pic16) size2c_bf.b0 = 0xff; /* should truncate to 0x0f */ size2c_bf.b1 = 0; ASSERT(size2c_bf.b0==0x0f); @@ -279,11 +292,13 @@ testBitfieldsMultibitLiteral(void) size2d_bf.b1 = 5; ASSERT(size2d_bf.b0==0x0a46); ASSERT(size2d_bf.b1==5); +#endif /* !SDCC_pic16 */ } void testBitfieldsMultibit(void) { +#if !defined(SDCC_pic16) volatile int allones = 0xffff; volatile int zero = 0; volatile int x; @@ -321,6 +336,7 @@ testBitfieldsMultibit(void) size2d_bf.b1 = x; ASSERT(size2d_bf.b0==0x0a46); ASSERT(size2d_bf.b1==5); +#endif /* !SDCC_pic16 */ } void @@ -345,6 +361,7 @@ testBitfields(void) void testSignedBitfields(void) { +#if !defined(SDCC_pic16) s_bf.s0_7 = 0xf0; s_bf.s7_1 = 1; s_bf.s8_9 = 0xfff8; @@ -363,4 +380,5 @@ testSignedBitfields(void) ASSERT(s_bf.s8_9 == 0xff); ASSERT(s_bf.s0_7 > 0); ASSERT(s_bf.s8_9 > 0); +#endif /* !SDCC_pic16 */ } diff --git a/support/regression/tests/bitopcse.c b/support/regression/tests/bitopcse.c index b8118bd3..552eadcd 100644 --- a/support/regression/tests/bitopcse.c +++ b/support/regression/tests/bitopcse.c @@ -16,7 +16,7 @@ # define _data idata #endif -#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) || defined(SDCC_hc08) +#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) || defined(SDCC_hc08) || defined(SDCC_pic16) # define NO_BIT_TYPE #endif diff --git a/support/regression/tests/bp.c b/support/regression/tests/bp.c index 1671035b..029ee315 100644 --- a/support/regression/tests/bp.c +++ b/support/regression/tests/bp.c @@ -20,20 +20,20 @@ spoil(int a) return a; } -#ifndef SDCC_mcs51 +#if defined(SDCC_mcs51) || defined(SDCC_pic16) -#define ABOVE_MEM_SIZE 400 +// test devices with much less memory +#define ABOVE_MEM_SIZE 30 #define ABOVE_MEM_TEST_SIZE 17 -#define BELOW_MEM_SIZE 200 -#define BELOW_MEM_TEST_SIZE 74 +#define BELOW_MEM_SIZE 20 +#define BELOW_MEM_TEST_SIZE 7 #else -// test mcs51 with much less memory -#define ABOVE_MEM_SIZE 30 +#define ABOVE_MEM_SIZE 400 #define ABOVE_MEM_TEST_SIZE 17 -#define BELOW_MEM_SIZE 20 -#define BELOW_MEM_TEST_SIZE 7 +#define BELOW_MEM_SIZE 200 +#define BELOW_MEM_TEST_SIZE 74 #endif diff --git a/support/regression/tests/bug-221100.c b/support/regression/tests/bug-221100.c index 347e1ac8..7b6c6f88 100644 --- a/support/regression/tests/bug-221100.c +++ b/support/regression/tests/bug-221100.c @@ -5,11 +5,14 @@ */ #include -#ifdef __mcs51 -xdata +#ifdef SDCC_pic16 +#define ARRAY_SIZE 60 +#else +#define ARRAY_SIZE 130 #endif + static unsigned int -testArray[130]; +testArray[ARRAY_SIZE]; static unsigned int test_int ; static unsigned char test_index ; diff --git a/support/regression/tests/bug-460010.c b/support/regression/tests/bug-460010.c index 2b9bed54..e5bf0ba6 100644 --- a/support/regression/tests/bug-460010.c +++ b/support/regression/tests/bug-460010.c @@ -2,6 +2,14 @@ */ #include +#ifdef SDCC +#ifdef SDCC_pic16 +#define ADDRESS 0x0070 +#else +#define ADDRESS 0xa000 +#endif /* SDCC_pic16 */ +#endif /* SDCC */ + void func( unsigned char a ) { @@ -13,7 +21,7 @@ testBadPromotion(void) { #ifdef SDCC - unsigned char c=*((unsigned xdata char*)(0xa000)); + unsigned char c=*((unsigned xdata char*)(ADDRESS)); #else unsigned char loc_c; unsigned char c=*(unsigned char*)&loc_c; diff --git a/support/regression/tests/bug-716242.c b/support/regression/tests/bug-716242.c index 604bc22b..d0c72a7b 100644 --- a/support/regression/tests/bug-716242.c +++ b/support/regression/tests/bug-716242.c @@ -29,7 +29,14 @@ void f1() /****************************/ +#ifndef SDCC_pic16 +// Ifdefed out for PIC16 port since it generates the error: +// Duplicate label or redefinin g symbol that cannot be redefined. (_g) +// Submitted to the bug tracker: +// [ 1443651 ] pic 16: redefining symbol that cannot be redefined. (_g) + void g (int (*h) (int)); +#endif void f2() { @@ -40,7 +47,14 @@ void f2() /****************************/ +#ifndef SDCC_pic16 +// Ifdefed out for PIC16 port since it generates the error: +// Duplicate label or redefinin g symbol that cannot be redefined. (_g) +// Submitted to the bug tracker: +// [ 1443651 ] pic 16: redefining symbol that cannot be redefined. (_g) + void g (int (*h) (int)); +#endif void f3() { diff --git a/support/regression/tests/bug-908454.c b/support/regression/tests/bug-908454.c index 9a67d263..fa766aed 100644 --- a/support/regression/tests/bug-908454.c +++ b/support/regression/tests/bug-908454.c @@ -2,7 +2,7 @@ #include -#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) || defined(SDCC_hc08) +#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) || defined(SDCC_hc08) || defined(SDCC_pic16) # define NO_BIT_TYPE #endif diff --git a/support/regression/tests/float.c b/support/regression/tests/float.c index 864b83c4..0cc2fbac 100644 --- a/support/regression/tests/float.c +++ b/support/regression/tests/float.c @@ -1,6 +1,7 @@ /* Float tests. operation: ADD, SUB, MUL, DIV, REVDIV + Test excluded from pic16 regression test */ #if 1 @@ -21,7 +22,7 @@ #define REVDIV 1 #endif -#ifdef __mcs51 +#ifdef SDCC_mcs51 #define STORAGE xdata #define XDATA xdata #else @@ -29,6 +30,7 @@ #define XDATA #endif +#ifndef SDCC_pic16 XDATA volatile float left, right, result; struct { @@ -78,10 +80,12 @@ char compare (float is, float should) { return 1; } } +#endif /* SDCC_pic16 */ void testFloatMath(void) { +#ifndef SDCC_pic16 int i; int t = sizeof(cases)/sizeof(cases[0]); float result; @@ -119,6 +123,7 @@ testFloatMath(void) #endif } DEBUG(printf ("%d tests, %d errors\n", tests, errors)); +#endif /* SDCC_pic16 */ } #ifndef REENTRANT diff --git a/support/regression/tests/malloc.c b/support/regression/tests/malloc.c index 6659b949..319de73b 100644 --- a/support/regression/tests/malloc.c +++ b/support/regression/tests/malloc.c @@ -2,29 +2,34 @@ */ #include #include - -/* PENDING */ -#if defined(__gbz80) || defined(__z80) || defined(__GNUC__) -#define XDATA -#else -#define XDATA xdata +#if defined(SDCC_pic16) +#include #endif -XDATA char heap[100]; +xdata char heap[100]; void testMalloc(void) { - void XDATA *p1, *p2, *p3; + void xdata *p1, *p2, *p3; char *p; unsigned char i; -#if !defined(__gbz80) && !defined(__z80) && !defined(__GNUC__) - init_dynamic_memory((MEMHEADER XDATA *)heap, sizeof(heap)); +#if !defined(__GNUC__) && !defined(SDCC_gbz80) && !defined(SDCC_z80) +#if defined(SDCC_pic16) + _initHeap(heap, sizeof heap); +#else + init_dynamic_memory((MEMHEADER xdata *)heap, sizeof(heap)); +#endif p1 = malloc(200); ASSERT(p1 == NULL); LOG(("p1 == NULL when out of memory\n")); +#ifdef PORT_HOST + LOG(("p1: %p\n", p1)); +#else + LOG(("p1: %u\n", (unsigned) p1)); +#endif #endif p1 = malloc(5); diff --git a/support/regression/tests/onebyte.c b/support/regression/tests/onebyte.c index b3ce9781..7ac65fa6 100644 --- a/support/regression/tests/onebyte.c +++ b/support/regression/tests/onebyte.c @@ -8,6 +8,7 @@ void testMul(void) { +#ifndef SDCC_pic16 /* bug [ 1444425 ] onebyte.c regression tes fails on pic16 */ {attrL} char cL; {attrL} unsigned char ucL; {attrR} char cR; @@ -35,6 +36,7 @@ testMul(void) ucL = 128; cR = 1; ur8 = ucL * cR; ur8b = cR * ucL; ASSERT(ur8 == 128); ASSERT(ur8b == 128); ucL = 128; ucR = 5; r16 = ucL * ucR; r16b = ucR * ucL; ASSERT(r16 == 640); ASSERT(r16b == 640); ucL = 128; ucR = 1; ur8 = ucL * ucR; ur8b = ucR * ucL; ASSERT(ur8 == 128); ASSERT(ur8b == 128); +#endif } void diff --git a/support/regression/tests/shifts.c b/support/regression/tests/shifts.c index 200caffb..0eb607f9 100644 --- a/support/regression/tests/shifts.c +++ b/support/regression/tests/shifts.c @@ -1,4 +1,5 @@ /** Tests covering the shift operators. + disabled for pic16 sign: signed, unsigned type: char, int, long @@ -12,7 +13,7 @@ #include void -testShiftClasses(void) +test1ShiftClasses(void) { {attr} {storage} {sign} {type} i, result; @@ -30,7 +31,7 @@ testShiftClasses(void) } void -testShiftRight(void) +test2ShiftRight(void) { {attr} {storage} {type} i, result; @@ -48,8 +49,8 @@ testShiftRight(void) ASSERT(result == -15); } -static void -testShiftByteMultiples(void) +void +test3ShiftByteMultiples(void) { {attr} {storage} {type} i; @@ -64,8 +65,8 @@ testShiftByteMultiples(void) ASSERT((({type}) i<<24) == (({type}) {vals} << 24)); } -static void -testShiftOne(void) +void +test4ShiftOne(void) { {attr} {storage} {sign} {type} i; {sign} {type} result; diff --git a/support/regression/tests/staticinit.c b/support/regression/tests/staticinit.c index 6a2480f4..e20063d8 100644 --- a/support/regression/tests/staticinit.c +++ b/support/regression/tests/staticinit.c @@ -3,6 +3,9 @@ type: char, int, long */ + +//error: no target memory available for section ".idata" + #include static {type} smallDense[] = { @@ -69,6 +72,7 @@ testSmallSparseZero(void) ASSERT(smallSparseZeroTail[0] == 1); } +#ifndef SDCC_pic16 #ifdef __mcs51 xdata #endif @@ -109,10 +113,12 @@ static {type} largeMixed[] = { 3, 4, 5, 6, 3, 4, 5, 6, 3, 4, 5, 6, 3, 4, 5, 6 }; +#endif static void testLargeMixed(void) { +#ifndef SDCC_pic16 ASSERT(largeMixed[0] == 1); ASSERT(largeMixed[1] == 2); ASSERT(largeMixed[7] == 1); @@ -123,4 +129,5 @@ testLargeMixed(void) ASSERT(largeMixed[143+1] == 4); ASSERT(largeMixed[143+8+1] == 4); ASSERT(largeMixed[143+16+1] == 4); +#endif }