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
+2006-05-22 Borut Razem <borut.razem AT siol.net>
+
+ * 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 <borut.razem AT siol.net>
* support/Util/dbuf.c: fixed bug #1489008 fix dbuf_c_str(),
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
$(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
*/
#include <testfwk.h>
-#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))
/** Bitfield tests.
+ SDCC pic16 port currently does not support bitfields of size > 8,
+ so they are ifdefed out.
*/
#include <testfwk.h>
char c3_5 : 5;
} c_bf;
+#if !defined(SDCC_pic16)
struct {
int i0_7 : 7;
int i7_9 : 9;
unsigned int b8 : 1;
unsigned int b9 : 1;
} sb_bf;
+#endif /* !SDCC_pic16 */
struct {
unsigned int b0 : 1;
unsigned int b1 : 1;
} size2a_bf;
+#if !defined(SDCC_pic16)
struct {
unsigned int b0 : 1;
unsigned int b1 : 1;
signed int s7_1 : 1;
signed int s8_9 : 9;
} s_bf;
-
+#endif /* !SDCC_pic16 */
void
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
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
}
void
testBitfieldsSingleBitLiteral(void)
{
+#if !defined(SDCC_pic16)
size2b_bf.b0 = 0;
size2b_bf.b1 = 0;
size2b_bf.b2 = 0;
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;
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);
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;
size2d_bf.b1 = x;
ASSERT(size2d_bf.b0==0x0a46);
ASSERT(size2d_bf.b1==5);
+#endif /* !SDCC_pic16 */
}
void
void
testSignedBitfields(void)
{
+#if !defined(SDCC_pic16)
s_bf.s0_7 = 0xf0;
s_bf.s7_1 = 1;
s_bf.s8_9 = 0xfff8;
ASSERT(s_bf.s8_9 == 0xff);
ASSERT(s_bf.s0_7 > 0);
ASSERT(s_bf.s8_9 > 0);
+#endif /* !SDCC_pic16 */
}
# 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
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
*/
#include <testfwk.h>
-#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 ;
*/
#include <testfwk.h>
+#ifdef SDCC
+#ifdef SDCC_pic16
+#define ADDRESS 0x0070
+#else
+#define ADDRESS 0xa000
+#endif /* SDCC_pic16 */
+#endif /* SDCC */
+
void
func( unsigned char a )
{
{
#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;
/****************************/
+#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()
{
/****************************/
+#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()
{
#include <testfwk.h>
-#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
/* Float tests.
operation: ADD, SUB, MUL, DIV, REVDIV
+ Test excluded from pic16 regression test
*/
#if 1
#define REVDIV 1
#endif
-#ifdef __mcs51
+#ifdef SDCC_mcs51
#define STORAGE xdata
#define XDATA xdata
#else
#define XDATA
#endif
+#ifndef SDCC_pic16
XDATA volatile float left, right, result;
struct {
return 1;
}
}
+#endif /* SDCC_pic16 */
void
testFloatMath(void)
{
+#ifndef SDCC_pic16
int i;
int t = sizeof(cases)/sizeof(cases[0]);
float result;
#endif
}
DEBUG(printf ("%d tests, %d errors\n", tests, errors));
+#endif /* SDCC_pic16 */
}
#ifndef REENTRANT
*/
#include <testfwk.h>
#include <stdlib.h>
-
-/* PENDING */
-#if defined(__gbz80) || defined(__z80) || defined(__GNUC__)
-#define XDATA
-#else
-#define XDATA xdata
+#if defined(SDCC_pic16)
+#include <malloc.h>
#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);
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;
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
/** Tests covering the shift operators.
+ disabled for pic16
sign: signed, unsigned
type: char, int, long
#include <testfwk.h>
void
-testShiftClasses(void)
+test1ShiftClasses(void)
{
{attr} {storage} {sign} {type} i, result;
}
void
-testShiftRight(void)
+test2ShiftRight(void)
{
{attr} {storage} {type} i, result;
ASSERT(result == -15);
}
-static void
-testShiftByteMultiples(void)
+void
+test3ShiftByteMultiples(void)
{
{attr} {storage} {type} i;
ASSERT((({type}) i<<24) == (({type}) {vals} << 24));
}
-static void
-testShiftOne(void)
+void
+test4ShiftOne(void)
{
{attr} {storage} {sign} {type} i;
{sign} {type} result;
type: char, int, long
*/
+
+//error: no target memory available for section ".idata"
+
#include <testfwk.h>
static {type} smallDense[] = {
ASSERT(smallSparseZeroTail[0] == 1);
}
+#ifndef SDCC_pic16
#ifdef __mcs51
xdata
#endif
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);
ASSERT(largeMixed[143+1] == 4);
ASSERT(largeMixed[143+8+1] == 4);
ASSERT(largeMixed[143+16+1] == 4);
+#endif
}