Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL RS485 - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
Conv TTL RS485 - Testing
Commits
4c799bc0
Commit
4c799bc0
authored
Nov 06, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: Finished work on flash test
parent
3344589e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
20 deletions
+102
-20
flashtest.py
pts/python/flashtest.py
+100
-19
pts.py
pts/python/pts.py
+2
-1
No files found.
pts/python/flashtest.py
View file @
4c799bc0
...
...
@@ -53,7 +53,6 @@ from ptsexcept import *
from
vv_pts
import
*
from
ptsdefine
import
*
##-------------------------------------------------------------------------------------------------
## main --
##-------------------------------------------------------------------------------------------------
...
...
@@ -61,23 +60,93 @@ from ptsdefine import *
def
main
(
bus
,
tname
,
inf
,
log
):
"""
tests :
EEPROM
chip IC62
uses :
release.bit and flash_
test.py
tests :
Flash
chip IC62
uses :
golden-v0.0_release-v1.0.bit and flash
test.py
"""
pel
=
PTS_ERROR_LOGGER
(
inf
,
log
)
try
:
# Get board ID and convert it to string
bid
=
bus
.
vv_read
(
0x00
)
bid
=
binascii
.
unhexlify
(
"
%
s"
%
"{0:x}"
.
format
(
bid
))
# and now check if appropriate
if
(
bid
==
"T485"
):
msg
=
"Board ID '
%
s' correct
\n
"
%
bid
msg
=
"Board ID correct:
%
s
\n
"
%
bid
inf
.
write
(
msg
)
else
:
msg
=
"ERROR: Board ID (
%
s) incorrect, check IC62"
%
bid
pel
.
set
(
msg
)
# Get gateware version and convert it to major-minor float number
gwvers
=
bus
.
vv_read
(
0x04
)
&
0xff
maj
=
float
(
gwvers
>>
4
)
min
=
float
(
gwvers
&
0x0f
)
if
min
<
10
:
p
=
1
# decimal precision for printing below
min
/=
10
else
:
p
=
2
# decimal precision for printing below
min
/=
100
gwvers
=
maj
+
min
# and now check if appropriate
if
(
gwvers
==
1.0
):
msg
=
"Release gateware version correct:
%2.*
f
\n
"
%
(
p
,
gwvers
)
inf
.
write
(
msg
)
else
:
msg
=
"ERROR:
Board ID incorrect, check IC62"
msg
=
"ERROR:
Release gateware version (
%2.*
f) incorrect - expected 1.0"
%
(
p
,
gwvers
)
pel
.
set
(
msg
)
# Fall-back to golden addres by performing IPROG from wrong address
print
(
"Trying fallback to golden gateware..."
)
bus
.
vv_write
(
0x108
,
0x44
|
(
0x0b
<<
24
))
bus
.
vv_write
(
0x10c
,
0x180000
|
(
0x0b
<<
24
))
# release bitstream at 0x170000
bus
.
vv_write
(
0x100
,
0x10000
)
try
:
# This write will issue IPROG and an NACK, so we avoid the exception here
bus
.
vv_write
(
0x100
,
0x20000
)
except
:
pass
# Try to read out gateware version and time out after 60 seconds
t0
=
time
.
time
()
t1
=
t0
+
60
while
(
1
):
try
:
if
(
time
.
time
()
>=
t1
):
msg
=
"ERROR: Timeout, fallback unsuccessful"
print
msg
pel
.
set
(
msg
)
break
# Read gateware version after fall-back
gwvers
=
bus
.
vv_read
(
0x04
)
&
0xff
maj
=
float
(
gwvers
>>
4
)
min
=
float
(
gwvers
&
0x0f
)
if
min
<
10
:
p
=
1
# decimal precision for printing below
min
/=
10
else
:
p
=
2
# decimal precision for printing below
min
/=
100
gwvers
=
maj
+
min
# and now check if appropriate
if
(
gwvers
==
0.0
):
msg
=
"Golden gateware version correct:
%2.*
f
\n
"
%
(
p
,
gwvers
)
inf
.
write
(
msg
)
else
:
msg
=
"ERROR: Golden gateware version (
%2.*
f) incorrect - expected 0.0"
%
(
p
,
gwvers
)
pel
.
set
(
msg
)
# FPGA up from booting, end the loop
break
except
:
continue
return
pel
.
get
()
except
BusException
,
e
:
...
...
@@ -87,6 +156,7 @@ def main(bus,tname,inf,log):
raise
PtsError
(
"SKT Warning:
%
s"
%
(
e
))
if
__name__
==
'__main__'
:
bus
=
SKT
(
ELMASLOT
)
os
.
chdir
(
"log"
)
logname
=
glob
.
glob
(
'*.log'
)
...
...
@@ -94,20 +164,31 @@ if __name__ == '__main__':
log
=
open
(
logname
[
0
],
'a'
)
inf
=
open
(
infname
[
0
],
'a'
)
log
.
write
(
"Run:1 Begin: test08
\n
"
)
inf
.
write
(
"Run:1 Begin: test08
\n
"
)
msg
=
"Run:1 Begin: test08"
print
msg
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
try
:
ret
=
main
(
bus
,
'test08'
,
inf
,
log
)
if
(
ret
==
0
):
log
.
write
(
"PASS: test08
\n
"
)
else
:
log
.
write
(
"FAIL: test08->flashtest.py
\n
"
)
print
main
.
__doc__
ret
=
main
(
bus
,
'test08'
,
inf
,
log
)
if
(
ret
==
0
):
msg
=
"PASS: test08"
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
else
:
msg
=
"FAIL: test08->flashtest.py
\n
"
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
except
Exception
as
e
:
msg
=
"FAIL: test08->flashtest.py (
%
s)"
%
e
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
log
.
write
(
"Run:1 End: test08
\n
"
)
inf
.
write
(
"Run:1 End: test08
\n
"
)
msg
=
"FAIL: test08->flashtest.py (
%
s)"
%
e
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
print
msg
msg
=
"Run:1 End: test08"
print
msg
log
.
write
(
msg
+
'
\n
'
)
inf
.
write
(
msg
+
'
\n
'
)
pts/python/pts.py
View file @
4c799bc0
...
...
@@ -192,7 +192,7 @@ if __name__ == '__main__':
time
.
sleep
(
5
)
# .. and run the flash test
cmd
=
"python ./flashtest.py"
cmd
=
"
xterm -e
python ./flashtest.py"
subprocess
.
call
(
cmd
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
# After all testing has finished, grep the log files for PASS and FAIL messages and print the outcomes to the console
...
...
@@ -234,3 +234,4 @@ if __name__ == '__main__':
sys
.
exit
(
1
)
else
:
ok
=
raw_input
(
"--> To exit PTS, type 'ok': "
)
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