Skip to content

Commit 5b04cf9

Browse files
committed
fix most tests for the changed repo structure
Now most tests can be compiled again. Some are too old to compile with the current state of sduino, they are marked by an empty file NON-FUNCTIONAL. Later, they might be either removed or adopted.
1 parent b811a59 commit 5b04cf9

26 files changed

Lines changed: 343 additions & 56 deletions

File tree

test/adc1/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ BOARD_TAG = stm8sblue
22

33
CFLAGS= --debug -DSUPPORT_ALTERNATE_MAPPINGS
44

5-
include ../../sduino/sduino.mk
5+
include ../../sduino/stm8/sduino.mk

test/adc1/adc1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ void loop (void)
3333
// skip channel 3 (used as TX), use dummy value 1234 instead
3434
val = (i==3) ? 1234 : analogRead(i);
3535
Serial_print_u(val);
36-
printChr('\t');
36+
Serial_write('\t');
3737
};
38-
println();
38+
Serial_println();
3939

4040
delay(200);
4141
}

test/digitalWrite/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
BOARD_TAG = stm8sblue
22

3-
include ../../sduino/sduino.mk
3+
include ../../sduino/stm8/sduino.mk

test/digitalWrite/digitalWrite.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44

55
#include "Arduino.h"
66

7+
/* A reference of main() is required to properly pull in main() from the
8+
* core library. For .ino and .pde files this is done automatically by the
9+
* sduino.mk makefile include, for .c files this has to be done by the user.
10+
*/
11+
//void main(void);
12+
//void (*dummy_variable) () = main;
13+
714
void setup (void)
815
{
16+
runSerialEvent = 0; // alternative way to pull in main.c
917
pinMode(1, OUTPUT);
1018
}
1119

test/iolib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ CC=$(BINDIR)/sdcc
88
LD=$(BINDIR)/sdld
99
AS=$(BINDIR)/sdasstm8
1010

11-
LIBBASE=../../STM8S_StdPeriph_Driver
11+
LIBBASE=../../sduino/stm8/STM8S_StdPeriph_Driver
1212
SDUINO=../../sduino
1313

1414
CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DSUPPORT_ALTERNATE_MAPPINGS \
1515
-I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/
1616

17-
LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103
17+
LDFLAGS=-L$(LIBBASE)/lib -L$(SDCCBASE)/share/sdcc/lib/stm8 -lSTM8S103
1818
ASFLAGS=
1919

2020
OBJECTS=$(BASENAME).rel

test/libmake/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
BOARD_TAG = stm8sblue
22

3-
include ../../sduino/sduino.mk
3+
include ../../sduino/stm8/sduino.mk

test/libmake/Makefile.classic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BINDIR=$(SDCCBASE)/bin
77
CC=$(BINDIR)/sdcc
88
LD=$(BINDIR)/sdld
99

10-
LIBBASE=../../STM8S_StdPeriph_Driver
10+
LIBBASE=../../sduino/stm8/STM8S_StdPeriph_Driver
1111
SDUINO=../../sduino
1212

1313
CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DARDUINO=180 \
@@ -17,7 +17,7 @@ CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DARDUINO=180 \
1717
-I$(LIBBASE)/inc -I/usr/share/sdcc/include/
1818
# -DSUPPORT_ALTERNATE_MAPPINGS
1919

20-
LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103
20+
LDFLAGS=-L$(LIBBASE)/lib -L/opt/sdcc/share/sdcc/lib/stm8 -lSTM8S103
2121

2222
OBJECTS=$(BASENAME).rel
2323
#SDLIBS=I2C

test/libmake/NON-FUNCTIONAL

Whitespace-only changes.

test/pinmode/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BINDIR=$(SDCCBASE)/bin
77
CC=$(BINDIR)/sdcc
88
LD=$(BINDIR)/sdld
99

10-
SDBASE=../../sduino/hardware/sduino/stm8
10+
SDBASE=../../sduino/stm8
1111
LIBBASE=$(SDBASE)/STM8S_StdPeriph_Driver
1212
SDUINO=$(SDBASE)/cores/sduino
1313

test/pinmode/README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
1+
# Test the optimized versions of pinMode
2+
3+
After each test the content of the GPIO registers is checked against
4+
the expected values. The table results[] contains the number of mismatched
5+
bytes after each test.
6+
7+
Expected result: all bytes in results[] == 0x00
8+
9+
10+
## Usage
11+
12+
The compiled functions are executed in the simulator:
13+
14+
$ make sim
15+
uCsim 0.6-pre54, Copyright (C) 1997 Daniel Drotos.
16+
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
17+
This is free software, and you are welcome to redistribute it
18+
under certain conditions; type `show c' for details.
19+
Loading from pinmode.ihx
20+
920 words read from pinmode.ihx
21+
fill ram_chip 0 1023 0
22+
fill io_chip 0 44 0
23+
s 10000
24+
du io_chip 0 4
25+
du io_chip 5 9
26+
du io_chip 10 14
27+
du io_chip 15 19
28+
du ram_chip 1 6
29+
du ram_chip 0x0100
30+
quit
31+
Stop at 0x00838a: (109)
32+
V-IHINZC Flags= 0x22 34 " A= 0x00 0 .
33+
0-100010 X= 0x0006 6 . Y= 0x5013 20499 .
34+
SP= 0x17fd [SP+1]= 00 0 .
35+
? 0x0838a 20 fe jra 0x838a
36+
F 0x00838a
37+
Simulated 19210 ticks in 0.003475 sec, rate=0.690970
38+
0x000 00 00 00 00 00 .....
39+
0x005 00 00 20 20 00 .. .
40+
0x00a 00 00 20 10 00 .. ..
41+
0x00f 00 00 42 02 42 ..B.B
42+
0x0001 00 00 00 00 00 00 ......
43+
0x0100 00 00 00 00 00 00 00 00 ........
44+
0x0108 00 00 00 00 00 00 00 00 ........
45+
0x0110 00 00 00 00 00 00 00 00 ........
46+
0x0118 00 00 00 00 00 00 00 00 ........
47+
0x0120 00 00 00 00 00 00 00 00 ........
48+
0x0128 00 00 00 00 00 00 00 00 ........
49+
0x0130 00 00 00 00 00 00 00 00 ........
50+
0x0138 00 00 00 00 00 00 00 00 ........
51+
0x0140 00 00 00 00 00 00 00 00 ........
52+
0x0148 00 00 00 00 00 00 00 00 ........
53+
$
54+
55+
56+
## Meaning of the output
57+
58+
The first block of data is the content of the GPIO registers:
59+
60+
0x000 00 00 00 00 00 .....
61+
0x005 00 00 20 20 00 .. .
62+
0x00a 00 00 20 10 00 .. ..
63+
0x00f 00 00 42 02 42 ..B.B
64+
65+
The next line contains the result bytes, one for each test step. Zero means
66+
no differences to the expected result:
67+
68+
0x0001 00 00 00 00 00 00 ......
69+
70+
The last block is a simple memory dump. It might contain additional
71+
information (but not used here and always zero):
72+
73+
0x0100 00 00 00 00 00 00 00 00 ........
74+
0x0108 00 00 00 00 00 00 00 00 ........
75+
0x0110 00 00 00 00 00 00 00 00 ........
76+
0x0118 00 00 00 00 00 00 00 00 ........
77+
0x0120 00 00 00 00 00 00 00 00 ........
78+
0x0128 00 00 00 00 00 00 00 00 ........
79+
0x0130 00 00 00 00 00 00 00 00 ........
80+
0x0138 00 00 00 00 00 00 00 00 ........
81+
0x0140 00 00 00 00 00 00 00 00 ........
82+
0x0148 00 00 00 00 00 00 00 00 ........
83+
84+
85+
86+
87+
## Results
88+
189
original version (276 bytes)
290
0080A0 47 _pinMode1:
391
0081B4 268 _setup:

0 commit comments

Comments
 (0)