Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PHASE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PHASE
Commits
bc29c6b8
Commit
bc29c6b8
authored
Apr 11, 2011
by
Wesley W. Terpstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GDB over my ROM
parent
e0e5eb0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
+24
-13
main.cpp
src/main.cpp
+24
-13
No files found.
src/main.cpp
View file @
bc29c6b8
...
...
@@ -17,6 +17,10 @@
#include "components/lm32/lm32-reboot.h"
#include "components/lm32/lm32-read.h"
#include "components/lm32/lm32-write.h"
#include "components/lm32/lm32-drom.h"
// GDB
#include "components/gdb-rsp/gdb-rsp.h"
#include "components/gdb-rsp/gdb-serial.h"
#include <iostream>
#include <iomanip>
...
...
@@ -164,12 +168,13 @@ int main() {
LM32Reboot
lm32reboot
(
&
ic
);
LM32Write
lm32write
(
&
ic
,
false
);
LM32Read
lm32read
(
&
ic
,
false
);
LM32DROM
lm32drom
(
&
ic
);
GDB_RSP
gdb_rsp
(
&
ic
,
32
,
32
,
lm32drom
.
PC
,
lm32drom
.
SP
,
lm32drom
.
SIG
);
GDB_Serial
gdb_serial
(
&
ic
);
SlavePort
&
cbreak
=
ic
.
head
().
addControl
().
port
();
SlavePort
&
creboot
=
ic
.
head
().
addControl
().
port
();
SlavePort
&
cread
=
ic
.
head
().
addControl
(
uint8_pinout
,
(
void
*
)
0
,
&
got
).
port
();
SlavePort
&
cpoll
=
ic
.
head
().
addControl
().
port
();
SlavePort
&
cwrite
=
ic
.
head
().
addControl
(
uint8_pinout
).
port
();
SlavePort
&
uart
=
ic
.
head
().
addControl
(
uint8_pinout
,
(
void
*
)
0
,
&
got
).
port
();
ic
.
configure
()
.
connect
(
dev0_ir
.
slave
,
*
hub
.
findMaster
(
"00000000/IR/write"
))
...
...
@@ -187,11 +192,22 @@ int main() {
.
connect
(
creboot
,
lm32reboot
.
execute
)
.
connect
(
lm32write
.
lm32_write
,
lm32_w
.
addClient
().
port
())
.
connect
(
lm32write
.
lm32_read_write
,
lm32_rw
.
addClient
().
port
())
.
connect
(
cwrite
,
lm32write
.
write
)
.
connect
(
lm32read
.
lm32_write
,
lm32_w
.
addClient
().
port
())
.
connect
(
lm32read
.
lm32_read_write
,
lm32_rw
.
addClient
().
port
())
.
connect
(
cread
,
lm32read
.
read
)
.
connect
(
cpoll
,
lm32read
.
poll
);
.
connect
(
lm32drom
.
echo
,
echos
.
addClient
().
port
())
.
connect
(
lm32drom
.
uart_write
,
lm32write
.
write
)
.
connect
(
lm32drom
.
uart_read
,
lm32read
.
read
)
.
connect
(
gdb_rsp
.
echo
,
echos
.
addClient
().
port
())
.
connect
(
gdb_rsp
.
register_address
,
lm32drom
.
register_address
)
.
connect
(
gdb_rsp
.
register_write
,
lm32drom
.
register_write
)
.
connect
(
gdb_rsp
.
register_read
,
lm32drom
.
register_read
)
.
connect
(
gdb_rsp
.
memory_address
,
lm32drom
.
memory_address
)
.
connect
(
gdb_rsp
.
memory_write
,
lm32drom
.
memory_write
)
.
connect
(
gdb_rsp
.
memory_read
,
lm32drom
.
memory_read
)
.
connect
(
gdb_rsp
.
run
,
lm32drom
.
run
)
.
connect
(
gdb_serial
.
echo
,
echos
.
addClient
().
port
())
.
connect
(
gdb_serial
.
packet
,
gdb_rsp
.
packet
)
.
connect
(
uart
,
gdb_serial
.
uart
);
try
{
ic
.
reset
();
...
...
@@ -203,7 +219,6 @@ int main() {
signal
(
SIGINT
,
&
trapSIGINT
);
std
::
cerr
<<
"Executing break -- and entering pipe-mode
\n
"
;
cbreak
();
while
(
1
)
{
if
(
stop
)
{
cbreak
();
...
...
@@ -211,16 +226,12 @@ int main() {
}
// Poll device
if
(
lm32read
.
amReady
())
cread
();
else
cpoll
();
ic
.
execute
();
/* Check for stdin ready */
struct
timeval
tv
;
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
lm32read
.
amReady
()
?
0
:
10000
;
/* 10ms */
tv
.
tv_usec
=
10000
;
/* 10ms */
fd_set
ifds
;
FD_ZERO
(
&
ifds
);
FD_SET
(
0
,
&
ifds
);
...
...
@@ -231,7 +242,7 @@ int main() {
int
got
=
read
(
0
,
buf
,
sizeof
(
buf
));
if
(
got
<=
0
)
break
;
// EOF
for
(
int
i
=
0
;
i
<
got
;
++
i
)
cwrite
(
Bits
(
buf
[
i
]));
uart
(
Bits
(
buf
[
i
]));
}
}
creboot
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment