Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Compact Universal Timing Endpoint based on White Rabbit
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
Compact Universal Timing Endpoint based on White Rabbit
Commits
647a8ec2
Commit
647a8ec2
authored
Jan 14, 2015
by
Qiang Du
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Command line arguments in mbtest.py
parent
e8e6d9c0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
26 deletions
+75
-26
eb.py
tools/lib-multiboot/eb/eb.py
+1
-1
mbtest.py
tools/lib-multiboot/mbtest.py
+72
-23
xil_multiboot.py
tools/lib-multiboot/xil_multiboot.py
+2
-2
No files found.
tools/lib-multiboot/eb/eb.py
View file @
647a8ec2
...
...
@@ -59,6 +59,6 @@ class EB:
dlist
=
[]
with
eb
.
Cycle
(
self
.
device
,
0
,
0
)
as
cycle
:
for
i
in
nrregs
:
dlist
.
append
(
cycle
.
read
(
addr
,
v
))
dlist
.
append
(
cycle
.
read
(
addr
))
logging
.
debug
(
'mread: 0x
%08
x'
%
dlist
[
i
])
return
dlist
tools/lib-multiboot/mbtest.py
View file @
647a8ec2
import
os
import
sys
import
sys
,
getopt
import
time
import
struct
import
logging
...
...
@@ -7,37 +7,86 @@ sys.path.append("eb")
from
eb
import
*
from
xil_multiboot
import
*
def
main
():
def
usage
():
print
'usage: mbtest.py [commands]'
print
'-t, --target <ip address>'
print
'-h, --help'
print
'-a, --address <address in hex>'
print
'-d, --dump <filename>'
print
'-p, --program <filename>'
print
'-e, --erase <size in hex (min 64kB)>'
print
'-i, --id'
print
'-s, --status'
def
main
(
argv
):
log_level
=
logging
.
DEBUG
log_level
=
logging
.
INFO
logging
.
basicConfig
(
level
=
log_level
)
ip
=
'rflab2.lbl.gov'
target
=
EB
(
ip
)
target
.
open
()
if
len
(
argv
)
==
0
:
usage
()
sys
.
exit
()
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
'hisa:d:p:e:t:'
,[
'help'
,
'dump='
,
'target='
,
'address='
,
'program='
,
'erase='
,
'id'
,
'status'
])
except
getopt
.
GetoptError
as
err
:
print
str
(
err
)
sys
.
exit
(
2
)
baseaddr
=
0x20800
target_ip
=
'rflab2.lbl.gov'
flash_address
=
0x0
flash_
length
=
0x0
ff
file_name
=
'foo_
bit'
mb
=
XilMultiboot
(
ETHERBONE
,
target
,
baseaddr
,
file_name
)
flash_
size
=
0x
ff
prog_file
=
'../../syn/cute_wr/wr_core_demo/cute_top_wrc.
bit'
dump_file
=
'dump_foo'
# read id
# id = mb.flash.read_id()
# logging.info('Flash ID: 0x' + id.encode('hex'))
for
opt
,
arg
in
opts
:
if
opt
in
(
'-h'
,
'--help'
):
usage
()
sys
.
exit
()
elif
opt
in
(
'--dump'
,
'-d'
):
dump_file
=
arg
action
=
'dump'
elif
opt
in
(
'-t'
,
'--target'
):
target_ip
=
arg
print
'target'
,
target_ip
elif
opt
in
(
'-a'
,
'--address'
):
flash_address
=
int
(
arg
,
base
=
16
)
print
'address: '
,
flash_address
elif
opt
in
(
'--program'
,
'-p'
):
prog_file
=
arg
fileinfo
=
os
.
stat
(
prog_file
)
flash_size
=
fileinfo
.
st_size
action
=
'program'
elif
opt
in
(
'--erase'
,
'-e'
):
flash_size
=
int
(
arg
,
base
=
16
)
action
=
'serase'
elif
opt
in
(
'--id'
,
'-i'
):
action
=
'id'
elif
opt
in
(
'--status'
,
'-s'
):
action
=
'status'
# mb.flash.serase(flash_address)
print
'action ='
,
action
logging
.
info
(
'Programming file
%
s'
%
file_name
)
mb
.
write
(
flash_address
)
mb
.
read
(
0
,
0xff
)
target
=
EB
(
target_ip
)
target
.
open
(
)
mb
=
XilMultiboot
(
ETHERBONE
,
target
,
baseaddr
,
prog_file
)
mb
.
flash
.
write
(
flash_address
,
range
(
0x0
,
0x0
+
flash_length
))
if
(
action
is
'program'
):
logging
.
info
(
'Programming file
%
s'
%
prog_file
)
mb
.
write
(
flash_address
)
elif
(
action
is
'serase'
):
mb
.
flash
.
serase
(
flash_address
)
elif
(
action
is
'id'
):
flash_id
=
mb
.
flash
.
read_id
()
logging
.
info
(
'Flash ID: 0x'
+
flash_id
.
encode
(
'hex'
))
elif
(
action
is
'dump'
):
logging
.
info
(
'Dumping to file
%
s from address 0x
%
x to 0x
%
x'
%
(
dump_file
,
flash_address
,
flash_address
+
flash_size
))
mb
.
read
(
dump_file
,
flash_address
,
flash_address
+
flash_size
)
elif
(
action
is
'status'
):
status
=
mb
.
flash
.
rsr
()
logging
.
info
(
'Status: 0x
%
x'
,
status
)
dat
=
mb
.
flash
.
read
(
flash_address
,
flash_length
)
dat_pack
=
struct
.
pack
(
'B'
*
len
(
dat
),
*
dat
)
print
'Flash: 0x'
+
dat_pack
.
encode
(
'hex'
)
if
__name__
==
"__main__"
:
main
()
main
(
sys
.
argv
[
1
:]
)
tools/lib-multiboot/xil_multiboot.py
View file @
647a8ec2
...
...
@@ -70,9 +70,9 @@ class XilMultiboot:
#
# Read from flash
#
def
read
(
self
,
sa
,
ea
):
def
read
(
self
,
fname
,
sa
,
ea
):
# Ask for and open bitstream file
fname
=
raw_input
(
"Output file name for flash readout: "
)
#
fname = raw_input("Output file name for flash readout: ")
f
=
open
(
fname
,
'wb'
)
# Read the data and dump to file
...
...
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