forked from h4tr3d/smbusb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fx2lib.patch
77 lines (68 loc) · 1.82 KB
/
fx2lib.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff --git a/include/serial.h b/include/serial.h
index 7cdd4d7..5c3008c 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -51,5 +51,5 @@ void sio0_init( DWORD baud_rate ) __critical ; // baud_rate max should be 57600
putchar('\\n') or putchar('\\r') both transmit \\r\\n
Just use one or the other. (This makes terminal echo easy)
**/
-void putchar(char c);
-char getchar();
+int putchar(int c);
+int getchar(void);
diff --git a/lib/Makefile b/lib/Makefile
index 560c500..8fb9834 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -24,7 +24,7 @@ LIBS = fx2.lib
all: $(LIBS)
$(LIBS): $(FX2_OBJS)
- sdcclib fx2.lib $?
+ sdar -rc fx2.lib $?
usbav.rel: usbav.a51
$(AS8051) -logs usbav.a51
diff --git a/lib/fx2.mk b/lib/fx2.mk
index d876a6d..c404ce0 100644
--- a/lib/fx2.mk
+++ b/lib/fx2.mk
@@ -41,11 +41,11 @@ VID?=0x04b4
PID?=0x8613
INCLUDES?=""
-DSCR_AREA?=-Wl"-b DSCR_AREA=0x3e00"
-INT2JT?=-Wl"-b INT2JT=0x3f00"
-CODE_SIZE?=--code-size 0x3c00
+DSCR_AREA?=-Wl"-b DSCR_AREA=0x1e00"
+INT2JT?=-Wl"-b INT2JT=0x1f00"
+CODE_SIZE?=--code-size 0x1c00
XRAM_SIZE?=--xram-size 0x0200
-XRAM_LOC?=--xram-loc 0x3c00
+XRAM_LOC?=--xram-loc 0x1c00
BUILDDIR?=build
FX2LIBDIR?=$(dir $(lastword $(MAKEFILE_LIST)))../
diff --git a/lib/serial.c b/lib/serial.c
index ce98b2c..88863a2 100644
--- a/lib/serial.c
+++ b/lib/serial.c
@@ -69,7 +69,7 @@ void sio0_init( DWORD baud_rate ) __critical { // baud_rate max should be 57600
}
-char getchar() {
+int getchar(void) {
char c;
while (!RI)
;
@@ -78,15 +78,16 @@ char getchar() {
return c;
}
-void _transchar(char c) {
+void _transchar(int c) {
while ( !TI ); // wait for TI=1
TI=0;
SBUF0=c;
}
-void putchar (char c) {
+int putchar (int c) {
if (c=='\n') _transchar('\r'); // transmit \r\n
_transchar(c);
if (c == '\r' ) _transchar('\n'); // transmit \r\n
+ return c;
}