---
cores/monitor/rtl/gdbstub.rom | 190 ++++++++++++++++++++--------------------
software/gdbstub/gdbstub.c | 27 ++----
2 files changed, 103 insertions(+), 114 deletions(-)
diff --git a/cores/monitor/rtl/gdbstub.rom b/cores/monitor/rtl/gdbstub.rom
index 8072957..961e1d3 100644
--- a/cores/monitor/rtl/gdbstub.rom
+++ b/cores/monitor/rtl/gdbstub.rom
@@ -12,7 +12,7 @@ e0000005
581d0000
f8000034
5b9f0080
-f80001c9
+f80001ca
e000008f
98000000
78001000
@@ -20,7 +20,7 @@ e000008f
581d0000
f800002c
5b9e0080
-f80001c1
+f80001c2
e0000079
98000000
78001000
@@ -28,7 +28,7 @@ e0000079
581d0000
f8000024
5b9f0080
-f80001b9
+f80001ba
e000007f
98000000
78001000
@@ -36,7 +36,7 @@ e000007f
581d0000
f800001c
5b9e0080
-f80001b1
+f80001b2
e0000069
98000000
78001000
@@ -44,7 +44,7 @@ e0000069
581d0000
f8000014
5b9e0080
-f80001a9
+f80001aa
e0000061
98000000
78001000
@@ -52,7 +52,7 @@ e0000061
581d0000
f800000c
5b9e0080
-f80001a1
+f80001a2
e0000059
98000000
78001000
@@ -60,7 +60,7 @@ e0000059
581d0000
f8000004
5b9e0080
-f8000199
+f800019a
e0000051
3400ff64
58010004
@@ -179,11 +179,12 @@ c3e00000
34210004
e3fffffd
c3a00000
-90400800
-20210001
-4420fffe
-34010001
-d0410000
+78021000
+38420f7c
+28410000
+28220000
+20420001
+4440fffe
7801e000
28210000
b0200800
@@ -191,11 +192,11 @@ c3a00000
7802e000
58410000
78021000
-38420f90
+38420f7c
28410000
28220000
20420002
-5c40fffe
+4440fffe
c3a00000
b8201000
3421ff9f
@@ -216,7 +217,7 @@ c3a00000
3441ffc9
c3a00000
78041000
-38840fe0
+38840fd0
e000000d
40250000
3463ffff
@@ -307,7 +308,7 @@ c3a00000
b8205800
29620084
78011000
-38210fd8
+38210fc8
20420007
b4220800
10230000
@@ -317,7 +318,7 @@ b4220800
14640004
30410000
78011000
-38210fe0
+38210fd0
2063000f
2084000f
b4242000
@@ -368,7 +369,7 @@ c3a00000
780d1000
780b1000
39ad1804
-396b0f98
+396b0f88
3410002b
34010024
fbffff49
@@ -392,7 +393,7 @@ b56c6000
fbffff37
11810000
fbffff35
-fbffff2b
+fbffff2a
5c30ffe9
2b9d0004
2b8b001c
@@ -460,10 +461,10 @@ b4823800
e0000002
fbffff20
78011000
-38210fac
+38210f9c
e0000003
78011000
-38210fb0
+38210fa0
fbffffc3
2b9d0004
2b8b0008
@@ -488,35 +489,34 @@ c3a00000
5b9b0008
5b9d0004
78021000
-38420f90
+38420f80
b8206800
28410000
78031000
-38630f94
+38630f84
58200000
28610000
28220000
5c400004
34020001
58220000
-fbfffeb7
+fbfffeb6
78081000
-39080f90
+39080f7c
29010000
28220000
20420002
-5c40fffe
-9040d800
+4440fffe
78011000
38211800
10210000
-237b0002
-44220004
+44200004
b9a00800
-fbffff2a
-fbffff63
-78101000
+fbffff2c
+fbffff65
780c1000
+78101000
+398c1b28
78171000
78161000
780f1000
@@ -526,15 +526,15 @@ fbffff63
780e1000
78121000
3a101804
-398c1b28
3af71800
3ad61b2b
-39ef0fb0
-3ab50fb8
-3a730fac
+39ef0fa0
+3ab50fa8
+3a730f9c
396b1e50
39ce1e4c
3a521e64
+359b0009
32000000
34190024
34180023
@@ -558,27 +558,27 @@ b5918800
5c58ffef
fbfffe87
202100ff
-fbfffe97
+fbfffe98
3c210004
203100ff
fbfffe82
202100ff
-fbfffe92
+fbfffe93
b6210800
202100ff
46810004
3401002d
-fbfffe84
+fbfffe85
e3ffffe1
3401002b
-fbfffe81
+fbfffe82
11820002
3401003a
5c410005
11810000
-fbfffe7c
+fbfffe7d
11810001
-fbfffe7a
+fbfffe7b
11830000
34010001
32e10000
@@ -594,17 +594,17 @@ fbfffe7a
3401003f
44610020
34010044
-5c610165
+5c610163
e000006a
3401004d
-5c610162
+5c610160
e0000041
34010058
44610041
3401005a
44610086
34010052
-5c61015b
+5c610159
e0000148
34010070
4461003d
@@ -614,7 +614,7 @@ e0000148
3401006d
44610018
34010067
-5c610151
+5c61014f
e000000c
34010072
4461013c
@@ -622,11 +622,11 @@ e000000c
34010073
44610060
3401007a
-5c610149
+5c610147
e0000071
b9a00800
-fbfffeba
-e0000145
+fbfffebb
+e0000143
b9a00800
ba001000
34030094
@@ -641,7 +641,7 @@ e0000040
5b810050
3782004c
37810050
-fbfffe8a
+fbfffe8b
4c010121
2b810050
10220000
@@ -651,43 +651,43 @@ fbfffe8a
5c41011b
37810050
37820048
-fbfffe80
+fbfffe81
4c010117
2b830048
3401018f
54610114
2b81004c
ba001000
-fbfffe45
-5c200124
+fbfffe46
+5c200122
78011000
-38210fb4
-e000014a
+38210fa4
+e0000145
34010000
e0000002
34010001
-fbffff04
-e000011c
+fbffff05
+e000011a
78011000
38211b29
5b810050
3782004c
37810050
-fbfffe6a
+fbfffe6b
4c010101
2b81004c
ba001000
34030004
3c210002
b5a10800
-fbfffe2f
-e000010e
+fbfffe30
+e000010c
78011000
38211b29
5b810050
3782004c
37810050
-fbfffe5c
+fbfffe5d
4c0100f3
2b810050
3402003d
@@ -699,7 +699,7 @@ fbfffe5c
34030004
3c420002
b5a21000
-fbfffe2f
+fbfffe30
e00000e3
d1000000
d2000000
@@ -710,18 +710,18 @@ d2600000
38211800
30200000
34010044
-5c6100f3
+5c6100f1
78011000
-38210fac
-fbfffeca
-fbfffe9b
-e00000ee
+38210f9c
+fbfffecb
+fbfffe9c
+e00000ec
78011000
38211b29
5b810050
3782004c
37810050
-fbfffe3a
+fbfffe3b
4c010003
2b81004c
59a10080
@@ -729,20 +729,20 @@ fbfffe3a
38211b28
10220000
34010073
-5c4100e0
+5c4100de
78011000
38211e4c
28210000
38210001
d1010000
-e00000da
+e00000d8
11910002
5b960050
3401002c
5e2100c0
37810050
3782004c
-fbfffe25
+fbfffe26
4c0100bc
2b820050
10410000
@@ -751,19 +751,19 @@ fbfffe25
5c3100b7
37810050
37820048
-fbfffe1c
+fbfffe1d
4c0100b3
11820001
34010032
4441000a
48410004
34010031
-5c4100c1
+5c4100bf
e0000008
34010033
44410067
34010034
-5c4100bc
+5c4100ba
e0000062
34020008
e0000063
@@ -928,31 +928,29 @@ e0000009
3c840002
e3ffffeb
ba600800
-e0000040
+e000003b
baa00800
-e000003e
+e0000039
b9e00800
-e000003c
+e0000037
7802e000
34010001
3842103c
58410000
-e000000e
+e000000c
78021000
78031000
38421b29
-38630fbc
+38630fac
40440000
40610000
-5c810007
-78081000
-39081b31
-4448002b
+5c810005
+445b0028
34420001
34630001
-e3fffff8
-fbfffdae
-e3fffe5f
+e3fffffa
+fbfffdb1
+e3fffe61
d0600000
34000000
34000000
@@ -963,11 +961,8 @@ d0800000
34000000
34000000
34000000
-5f600003
-34010002
-d0410000
78031000
-38630f90
+38630f80
28610000
34020001
58220000
@@ -991,10 +986,11 @@ d0410000
379c0050
c3a00000
78011000
-38210fc8
-fbfffdb3
-e3ffffd6
-e000000c
+38210fb8
+fbfffdb9
+e3ffffd9
+e0000008
+e0000010
e0001030
30313233
34353637
@@ -1019,7 +1015,11 @@ e0001030
38396162
63646566
00000000
-02ef8670
+b4b9ed76
+00000000
+00000000
+00000000
+00000000
00000000
00000000
00000000
diff --git a/software/gdbstub/gdbstub.c b/software/gdbstub/gdbstub.c
index 4535ddd..b3ff61c 100644
--- a/software/gdbstub/gdbstub.c
+++ b/software/gdbstub/gdbstub.c
@@ -109,17 +109,14 @@ static int memcmp(const void *cs, const void *ct, size_t
count)
static char get_debug_char(void)
{
- while (!(irq_pending() & IRQ_UARTRX));
- irq_ack(IRQ_UARTRX);
+ while (!(CSR_UART_STAT & UART_STAT_DR));
return (char)CSR_UART_RXTX;
}
static void put_debug_char(char c)
{
CSR_UART_RXTX = c;
- /* Blocking on UART pending bit is intended here! Have a
- * look at the end of handle_exception() too. */
- while (CSR_UART_BREAK & UART_TX_PENDING);
+ while (!(CSR_UART_STAT & UART_STAT_THRE));
}
/*
@@ -671,8 +668,6 @@ static void cmd_query(void)
*/
void handle_exception(unsigned int *registers)
{
- int irq;
-
/*
* make sure break is disabled.
* we can enter the stub with break enabled when the application calls it.
@@ -681,7 +676,7 @@ void handle_exception(unsigned int *registers)
* applications should disable debug exceptions before jumping to debug
* ROM.
*/
- CSR_UART_BREAK = 0;
+ CSR_UART_DEBUG = 0;
/* clear BSS there was a board reset */
if (!CSR_DBG_SCRATCHPAD) {
@@ -689,11 +684,10 @@ void handle_exception(unsigned int *registers)
clear_bss();
}
- /* wait until TX transaction is finished */
- while (CSR_UART_BREAK & UART_TX_PENDING);
-
- /* remember if irq was set */
- irq = irq_pending() & IRQ_UARTTX;
+ /* wait until TX transaction is finished. If there was a transmission in
+ * progress, the uart irq will be pending and serviced after gdbstub is
+ * terminated */
+ while(!(CSR_UART_STAT & UART_STAT_THRE));
/* reply to host that an exception has occured */
if (gdb_connected) {
@@ -768,11 +762,6 @@ void handle_exception(unsigned int *registers)
out:
flush_cache();
- /* ack TX IRQ only if it wasn't set before */
- if (!irq) {
- irq_ack(IRQ_UARTTX);
- }
-
/* reenable break */
- CSR_UART_BREAK = UART_BREAK_EN;
+ CSR_UART_DEBUG = UART_DEBUG_BREAK_EN;
}
--
1.7.2.5
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com