Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Compact Universal Timing Endpoint based on White Rabbit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Compact Universal Timing Endpoint based on White Rabbit
Commits
647a8ec2
Commit
647a8ec2
authored
10 years ago
by
Qiang Du
Browse files
Options
Downloads
Patches
Plain Diff
Command line arguments in mbtest.py
parent
e8e6d9c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tools/lib-multiboot/eb/eb.py
+1
-1
1 addition, 1 deletion
tools/lib-multiboot/eb/eb.py
tools/lib-multiboot/mbtest.py
+72
-23
72 additions, 23 deletions
tools/lib-multiboot/mbtest.py
tools/lib-multiboot/xil_multiboot.py
+2
-2
2 additions, 2 deletions
tools/lib-multiboot/xil_multiboot.py
with
75 additions
and
26 deletions
tools/lib-multiboot/eb/eb.py
+
1
−
1
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%08x
'
%
dlist
[
i
])
return
dlist
This diff is collapsed.
Click to expand it.
tools/lib-multiboot/mbtest.py
+
72
−
23
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
=
0x0ff
file_name
=
'
foo_bit
'
mb
=
XilMultiboot
(
ETHERBONE
,
target
,
baseaddr
,
file_name
)
# read id
# id = mb.flash.read_id()
# logging.info('Flash ID: 0x' + id.encode('hex'))
flash_size
=
0xff
prog_file
=
'
../../syn/cute_wr/wr_core_demo/cute_top_wrc.bit
'
dump_file
=
'
dump_foo
'
# mb.flash.serase(flash_address)
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
'
logging
.
info
(
'
Programming file %s
'
%
file_name
)
mb
.
write
(
flash_address
)
mb
.
read
(
0
,
0xff
)
print
'
action =
'
,
action
mb
.
flash
.
write
(
flash_address
,
range
(
0x0
,
0x0
+
flash_length
)
)
s
ta
tus
=
mb
.
flash
.
rsr
()
logging
.
info
(
'
Status: 0x%x
'
,
status
)
target
=
EB
(
target_ip
)
ta
rget
.
open
()
mb
=
XilMultiboot
(
ETHERBONE
,
target
,
baseaddr
,
prog_file
)
dat
=
mb
.
flash
.
read
(
flash_address
,
flash_length
)
dat_pack
=
struct
.
pack
(
'
B
'
*
len
(
dat
),
*
dat
)
print
'
Flash: 0x
'
+
dat_pack
.
encode
(
'
hex
'
)
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
)
if
__name__
==
"
__main__
"
:
main
()
main
(
sys
.
argv
[
1
:]
)
This diff is collapsed.
Click to expand it.
tools/lib-multiboot/xil_multiboot.py
+
2
−
2
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment