Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
Production Test Suite
Commits
76c5a50d
Commit
76c5a50d
authored
Jan 19, 2017
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svec pts: add an exportable patch adding MAC address assignment to existing PTSes
parent
98f1c44c
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
383 additions
and
0 deletions
+383
-0
Readme.txt
test/svec/patches/Readme.txt
+17
-0
flash_svec.sh
.../ubuntu/pts/boot/Flasher/production_flasher/flash_svec.sh
+15
-0
svec-bootloader-v3-20140815.bin
...lasher/production_flasher/svec-bootloader-v3-20140815.bin
+0
-0
pts.py
test/svec/patches/macaddr/ubuntu/pts/pyts/pts.py
+177
-0
gen_flash_image.py
.../svec/patches/macaddr/ubuntu/pts/sdbfs/gen_flash_image.py
+108
-0
gensdbfs
test/svec/patches/macaddr/ubuntu/pts/sdbfs/gensdbfs
+0
-0
--SDB-CONFIG--
...atches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/--SDB-CONFIG--
+32
-0
bitstream
...vec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/bitstream
+0
-0
calibration
...c/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/calibration
+0
-0
mac-address
...c/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/mac-address
+0
-0
sfp-database
.../patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/sfp-database
+0
-0
wr-init
.../svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/wr-init
+0
-0
--SDB-CONFIG--
...atches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/--SDB-CONFIG--
+34
-0
bitstream
...vec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/bitstream
+0
-0
calibration
...c/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/calibration
+0
-0
mac-address
...c/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/mac-address
+0
-0
sfp-database
.../patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/sfp-database
+0
-0
svec-bootloader.bin
...s/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/svec-bootloader.bin
+0
-0
wr-init
.../svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/wr-init
+0
-0
No files found.
test/svec/patches/Readme.txt
0 → 100644
View file @
76c5a50d
This folder contains patches to the original SVEC PTS that is used by the
companies producing boards. To export one of these patches, please go into the
appropriate directory for the patch and create an archive of _ubuntu_ directory,
e.g.:
# cd macaddr
# tar czf svecpts_macaddr.tar.gz ubuntu
Before applying the patch on a working PTS, please create a backup archive of the
main PTS directory, This archive caould be then used to restore the original PTS
if something goes wrong with applying the patches:
# cd ~
# tar czf pts_backup.tar.gz ubuntu
To apply the patch on a working PTS, the content has to be extracted in the home
directory of the _pts_ user, on the SVEC PTS laptop:
# cd ~
# tar xzf svecpts_macaddr.tar.gz
test/svec/patches/macaddr/ubuntu/pts/boot/Flasher/production_flasher/flash_svec.sh
0 → 100755
View file @
76c5a50d
#!/bin/bash
xc3sprog
-p
0
-c
xpc svec_app.bit
xc3sprog
-p
1
-c
xpc svec_sys.bit
if
[
"
$1
"
==
"sdbfs"
]
;
then
echo
"Flashing SDBFS, this takes a while..."
xc3sprog
-p
0
-c
xpc
-I
sdbfs-svec.bin:W:0:BIN
else
echo
"Flashing only bootloader"
xc3sprog
-p
0
-c
xpc
-I
svec-bootloader-v3-20140815.bin:W:0:BIN
fi
xc3sprog
-p
1
-c
xpc svec-bootloader-v3-20140815.bin:w:0:BIN
test/svec/patches/macaddr/ubuntu/pts/boot/Flasher/production_flasher/svec-bootloader-v3-20140815.bin
0 → 100644
View file @
76c5a50d
File added
test/svec/patches/macaddr/ubuntu/pts/pyts/pts.py
0 → 100755
View file @
76c5a50d
#! /usr/bin/python
# coding: utf8
import
sys
import
time
import
traceback
import
os
import
subprocess
import
re
sys
.
path
.
append
(
'sdbfs'
)
sys
.
path
.
append
(
'/home/pts/ubuntu/pts/sdbfs'
)
import
gen_flash_image
sys
.
path
.
append
(
'.'
)
def
men_is_on
():
on
=
0
subprocess
.
call
(
"/home/pts/ubuntu/pts/get-fan-speeds"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
btxt
=
tuple
(
open
(
"/home/pts/ubuntu/pts/log/fan-speeds"
,
"r"
))
for
i
in
range
(
1
,
len
(
btxt
)):
if
btxt
[
i
]
.
find
(
"INTEGER: 0"
)
==
-
1
:
on
=
on
+
1
return
on
def
men_on
():
tmo
=
1
while
men_is_on
()
==
0
:
print
"Try:
%
d Switching ON the VME Crate"
%
(
tmo
)
subprocess
.
call
(
"/home/pts/ubuntu/pts/men-on"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
tmo
=
tmo
+
1
if
tmo
>
10
:
print
"FATAL ERROR: VME Crate: Unable to switch ON"
sys
.
exit
(
1
)
time
.
sleep
(
1
)
def
men_off
():
tmo
=
1
while
men_is_on
()
!=
0
:
print
"Try:
%
d Switching OFF the VME Crate"
%
(
tmo
)
subprocess
.
call
(
"/home/pts/ubuntu/pts/men-off"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
tmo
=
tmo
+
1
if
tmo
>
10
:
print
"FATAL ERROR: VME Crate: Unable to switch OFF"
sys
.
exit
(
1
)
time
.
sleep
(
10
)
if
__name__
==
'__main__'
:
print
"
\n
Hello and Welcome to the SVEC PTS!
\n
"
fnull
=
open
(
os
.
devnull
,
"w"
)
men_off
()
while
True
:
sn1
=
raw_input
(
"--> Scan the 1st barcode: "
)
m
=
re
.
search
(
r"[^a-z\-A-Z0-9_]+"
,
sn1
)
if
m
:
print
"Bad character in barcode"
else
:
break
while
True
:
sn2
=
raw_input
(
"--> Scan the 2nd barcode: "
)
if
len
(
sn2
)
>
2
:
m
=
re
.
search
(
r"[^a-z\-A-Z0-9_]+"
,
sn2
)
if
m
:
print
"Bad character in barcode"
else
:
break
else
:
sn2
=
"0"
break
while
True
:
mac
=
raw_input
(
"--> Type the MAC address: "
)
if
len
(
mac
)
>
1
:
if
gen_flash_image
.
check_mac
(
mac
):
break
else
:
mac
=
""
break
msg
=
"
\n
--> Plug the SVEC board '
%
s-
%
s' into the VME crate.
\n
Then type 'ok': "
%
(
sn1
,
sn2
)
ok
=
raw_input
(
msg
)
while
True
:
if
ok
.
find
(
"ok"
)
!=
-
1
or
ok
.
find
(
"OK"
)
!=
-
1
:
break
else
:
ok
=
raw_input
(
"--> Please type 'ok' to continue: "
)
print
"
\n
"
print
"Initializing the test environment"
men_on
()
# give some time for the things to settle before flashing
time
.
sleep
(
10
)
# generate SDBFS image for a given MAC (if no MAC was given, function
# returns immediatelly
if
mac
:
gen_flash_image
.
gen_sdb_image
(
"svec"
,
mac
,
""
,
"/home/pts/ubuntu/pts/boot/Flasher/production_flasher/sdbfs-svec.bin"
)
# Programming Flash
cmd
=
"cd /home/pts/ubuntu/pts/boot/Flasher/production_flasher; ./flash_svec.sh"
if
mac
:
print
"Programming SDBFS with MAC address and bootloader, this will take ~8 minutes..."
cmd
+=
" sdbfs"
else
:
print
"Programming the bootloader..."
subprocess
.
call
(
cmd
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
print
"Programming complete"
print
"VME Crate power cycle"
men_off
()
time
.
sleep
(
2
)
men_on
()
print
"VME Crate booting...this will take 1 min"
time
.
sleep
(
60
)
subprocess
.
call
(
"cd /home/pts/ubuntu/pts; rm -rf ./log; mkdir log; chmod 777 log"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
subprocess
.
call
(
"cd /home/pts/ubuntu/pts; ./allow_tty"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
time
.
sleep
(
10
)
print
"
\n
Running tests!
\n
"
subprocess
.
call
(
"/home/pts/ubuntu/pts/query-bootloader"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
time
.
sleep
(
2
)
sinfo
=
os
.
stat
(
"/home/pts/ubuntu/pts/log/flash_result.txt"
)
if
sinfo
.
st_size
==
0
:
print
"FAIL: test00: Bootloader NOT Found"
print
"ERROR: Flash IC14: Flash found empty after power cycle"
sys
.
exit
(
1
)
else
:
print
"PASS: test00"
subprocess
.
call
(
"/home/pts/ubuntu/pts/load-uart-test"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
subprocess
.
call
(
"/home/pts/ubuntu/pts/run-uart-test"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
cmd
=
"ssh -X pts@men /home/pts/ubuntu/pts/jpts-men-root
%
s
%
s"
%
(
sn1
,
sn2
)
subprocess
.
call
(
cmd
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
subprocess
.
call
(
"grep PASS /home/pts/ubuntu/pts/log/*.log"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
subprocess
.
call
(
"grep FAIL /home/pts/ubuntu/pts/log/*.log"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
print
"
\n
Saving test results on USB key"
try
:
subprocess
.
call
(
"mkdir -p /media/pts/log"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
subprocess
.
call
(
"cp /home/pts/ubuntu/pts/log/*.log /media/pts/log"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
subprocess
.
call
(
"cp /home/pts/ubuntu/pts/log/*.inf /media/pts/log"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
except
e
:
print
"ERROR: No access to USB key at /media/pts"
print
e
print
"
\n
Testing completed!"
men_off
()
msg
=
"
\n
--> To see all the PTS errors, type 'ok': "
ok
=
raw_input
(
msg
)
if
ok
.
find
(
"ok"
)
!=
-
1
:
subprocess
.
call
(
"grep ERROR /home/pts/ubuntu/pts/log/*.inf"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
subprocess
.
call
(
"grep WARNING /home/pts/ubuntu/pts/log/*.inf"
,
shell
=
True
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stderr
)
print
""
print
"--> You may now unplug the SVEC board
%
s-
%
s
\n
"
%
(
sn1
,
sn2
)
msg
=
"--> To exit PTS, type 'ok': "
ok
=
raw_input
(
msg
)
while
True
:
if
ok
.
find
(
"ok"
)
!=
-
1
or
ok
.
find
(
"OK"
)
!=
-
1
:
print
"Exited PTS"
time
.
sleep
(
1
)
sys
.
exit
(
1
)
else
:
ok
=
raw_input
(
"--> To exit PTS, type 'ok': "
)
test/svec/patches/macaddr/ubuntu/pts/sdbfs/gen_flash_image.py
0 → 100755
View file @
76c5a50d
#!/usr/bin/python
################################################################################
##
## The script is part of the SPEC and SVEC PTS. It is used to generate SDBFS
## image that is then stored in Flash or EEPROM memory. The image contains MAC
## address and optionally also an FPGA bitstream. The main purpose of including
## it to the PTS is to allow manufacturers assigning official MAC addresses to
## SPEC and SVEC boards.
##
## Copyright (C) 2017 CERN (www.cern.ch)
## Author: Grzegorz Daniluk <grzegorz.daniluk@cern.ch>
##
################################################################################
import
sys
import
re
import
subprocess
import
os
import
shutil
#class CSDBGenerator :
SDBFS_MAC
=
"{path}sdbfs-{type}/mac-address"
SDBFS_BSTR
=
"{path}sdbfs-{type}/bitstream"
SDBFS_IMG
=
"{path}sdbfs-{type}-{mac}.bin"
GEN_SPEC_CMD
=
"{path}./gensdbfs -b 65536 {path}sdbfs-spec {img}"
GEN_SVEC_CMD
=
"{path}./gensdbfs -b 262144 {path}sdbfs-svec {img}"
###########################################################
def
check_mac
(
mac
):
if
not
re
.
match
(
"[0-9a-f]{2}([-:])[0-9a-f]{2}(
\\
1[0-9a-f]{2}){4}$"
,
mac
.
lower
()):
print
"Not a valid MAC address"
return
0
return
1
###########################################################
# type can be either "spec" or "svec"
def
gen_sdb_image
(
type
,
mac
,
bstr
,
output
=
None
):
if
mac
and
not
check_mac
(
mac
):
return
# Translate MAC to be always in XX-XX-XX-XX-XX-XX format
mac
=
mac
.
replace
(
':'
,
'-'
)
# Get the absolute path where this script resides. This lets us have always
# access to the sdbfs-spec/svec structure, no matter where this script is
# called.
abs_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
+
'/'
# 1. write MAC address to the file in SDBFS
mac_bytes
=
[
int
(
i
,
16
)
for
i
in
mac
.
split
(
'-'
)]
sdbfs_mac
=
SDBFS_MAC
.
format
(
path
=
abs_path
,
type
=
type
)
f
=
open
(
sdbfs_mac
,
'wb'
)
f
.
truncate
()
for
byte
in
mac_bytes
:
f
.
write
(
chr
(
byte
))
f
.
close
()
# 2. copy bitstream to SDBFS, if needed
sdbfs_bstr
=
SDBFS_BSTR
.
format
(
path
=
abs_path
,
type
=
type
)
#<abs_path>/sdbfs-<type>/bitstream
if
bstr
:
print
"Including bitstream "
+
bstr
shutil
.
copy
(
bstr
,
sdbfs_bstr
)
else
:
#truncate bitstream file if not given
f
=
open
(
sdbfs_bstr
,
'wb'
)
f
.
truncate
()
f
.
close
()
# 3. generate SDBFS image
sdbfs_img
=
SDBFS_IMG
.
format
(
path
=
abs_path
,
type
=
type
,
mac
=
mac
)
# gensdbfs for spec/svec
if
type
==
"spec"
:
cmd
=
GEN_SPEC_CMD
.
format
(
path
=
abs_path
,
img
=
sdbfs_img
)
else
:
cmd
=
GEN_SVEC_CMD
.
format
(
path
=
abs_path
,
img
=
sdbfs_img
)
subprocess
.
Popen
(
cmd
,
shell
=
True
)
.
wait
()
print
"Generated "
+
sdbfs_img
# 4. Copy generated SDBFS image to <output>
if
output
:
shutil
.
copy
(
sdbfs_img
,
output
)
print
"Generated image ("
+
sdbfs_img
+
") copied to "
+
output
###########################################################
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
<
3
:
print
"Wrong syntax"
print
sys
.
argv
[
0
]
+
" <spec/svec> <mac> [bitstream]"
sys
.
exit
()
type
=
sys
.
argv
[
1
]
if
type
!=
"spec"
and
type
!=
"svec"
:
print
"Wrong syntax"
print
sys
.
argv
[
0
]
+
" <spec/svec> <mac> [bitstream]"
sys
.
exit
()
#mac = check_mac(sys.argv[2])
mac
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
>
3
:
bitstream
=
sys
.
argv
[
3
]
else
:
bitstream
=
""
gen_sdb_image
(
type
,
mac
,
bitstream
)
test/svec/patches/macaddr/ubuntu/pts/sdbfs/gensdbfs
0 → 100755
View file @
76c5a50d
File added
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/--SDB-CONFIG--
0 → 100644
View file @
76c5a50d
#
# We want to store WRPC parameters but also the FPGA bitstream in the same
# FLASH. That is why our default position for various parameters is right after
# the bitstream.
.
position = 1507328
# Allocation granularity is 64 bytes
# We start with bitstream file at position 0, later the same set of files as for
# EEPROM image is used.
bitstream
write = 1
position = 0
maxsize = 1507328
mac-address
write = 1
maxsize = 6
wr-init
write = 1
maxsize = 256
# each sfp takes 29 bytes, 4 of them fit in 128 bytes
sfp-database
write = 1
maxsize = 128
calibration
write = 1
maxsize = 128
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/bitstream
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/calibration
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/mac-address
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/sfp-database
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-spec/wr-init
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/--SDB-CONFIG--
0 → 100644
View file @
76c5a50d
# This is an example config file, that can be used to build a filesystem
# from this very directory. Please note that gensdbfs doesn't look for
# config files in subdirectories but only in the tol-level one.
.
vendor = 0xce42
device = 0x5fec
position = 0x600000
# System FPGA bitstream
svec-bootloader.bin
position = 0
# Application FPGA bitstream
bitstream
position = 0x100000
mac-address
write = 1
maxsize = 6
wr-init
write = 1
maxsize = 256
# each sfp takes 29 bytes, 4 of them fit in 128 bytes
sfp-database
write = 1
maxsize = 128
calibration
write = 1
maxsize = 128
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/bitstream
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/calibration
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/mac-address
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/sfp-database
0 → 100644
View file @
76c5a50d
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/svec-bootloader.bin
0 → 100644
View file @
76c5a50d
File added
test/svec/patches/macaddr/ubuntu/pts/sdbfs/sdbfs-svec/wr-init
0 → 100644
View file @
76c5a50d
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