Commit 7a145ab6 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

sw: Small changes in PTS build system and additions to flash test

Mainly, the build system changes consist in organizing the makefile better and
building to a local `ubuntu/' folder, which should then be copied directly to
the PTS system.

Then, the flash test changes consist in checking for a BusException error to not
fall in the trap of continuing on other exceptions occuring in the block of code
under `try'. Also, the flash test is more "modular" in that the gateware
versions to be downloaded can be specified at the beginning of the file.
parent f92d9079
ELMAIP = cfvm-864-celma1
ELMAPWD = Gr@nBr@st0
ELMASLOT = 1
ELMAIP =
ELMAPWD =
ELMASLOT =
all:
mkdir -p pts-conv-ttl-rs485/boot
mkdir -p pts-conv-ttl-rs485/tests
mkdir -p pts-conv-ttl-rs485/lib
cp -r shell/ pts-conv-ttl-rs485/
cp pts-conv-ttl-rs485/shell/program pts-conv-ttl-rs485/boot
cp pts-conv-ttl-rs485/shell/flash pts-conv-ttl-rs485/boot
cp python/pts.py pts-conv-ttl-rs485
cp python/jpts.py pts-conv-ttl-rs485
cp python/vv_pts.py pts-conv-ttl-rs485/lib/
cp python/ptsexcept.py pts-conv-ttl-rs485/lib/
cp python/ptsdefine.py pts-conv-ttl-rs485/lib/
sed -i "s/ELMAIP = \"\"/ELMAIP = \"$(ELMAIP)\"/" pts-conv-ttl-rs485/lib/ptsdefine.py
sed -i "s/ELMAPWD = \"\"/ELMAPWD = \"$(ELMAPWD)\"/" pts-conv-ttl-rs485/lib/ptsdefine.py
sed -i "s/ELMASLOT = 4/ELMASLOT = $(ELMASLOT)/" pts-conv-ttl-rs485/lib/ptsdefine.py
cp python/leds.py pts-conv-ttl-rs485/tests/
cp python/dac_vcxo_pll.py pts-conv-ttl-rs485/tests/
cp python/therm_id.py pts-conv-ttl-rs485/tests/
cp python/ttl_pulse_switch.py pts-conv-ttl-rs485/tests/
cp python/rs485_pulse.py pts-conv-ttl-rs485/tests/
cp python/sfp_eeprom.py pts-conv-ttl-rs485/tests/
cp python/sfp_test.py pts-conv-ttl-rs485/tests/
cp python/flashtest.py pts-conv-ttl-rs485/
ln -s tests/dac_vcxo_pll.py pts-conv-ttl-rs485/test01.py
ln -s tests/leds.py pts-conv-ttl-rs485/test02.py
ln -s tests/ttl_pulse_switch.py pts-conv-ttl-rs485/test03.py
ln -s tests/rs485_pulse.py pts-conv-ttl-rs485/test04.py
ln -s tests/therm_id.py pts-conv-ttl-rs485/test05.py
ln -s tests/sfp_eeprom.py pts-conv-ttl-rs485/test06.py
ln -s tests/sfp_test.py pts-conv-ttl-rs485/test07.py
wget -P pts-conv-ttl-rs485/boot http://www.ohwr.org/attachments/download/3671/pts.bit
wget -P pts-conv-ttl-rs485/boot http://www.ohwr.org/attachments/download/3650/flash_load.bit
wget -P pts-conv-ttl-rs485/boot http://www.ohwr.org/attachments/download/3657/golden-v0.0_release-v1.0.bin
mkdir -p ubuntu/t485/log
touch ubuntu/t485/log/fan-speeds
cp -r shell/ ubuntu/t485/
mkdir -p ubuntu/t485/pyts/
cp python/* ubuntu/t485/pyts/
sed -i "s/ELMAIP = \"\"/ELMAIP = \"$(ELMAIP)\"/" ubuntu/t485/pyts/ptsdefine.py
sed -i "s/ELMAPWD = \"\"/ELMAPWD = \"$(ELMAPWD)\"/" ubuntu/t485/pyts/ptsdefine.py
sed -i "s/ELMASLOT =/ELMASLOT = $(ELMASLOT)/" ubuntu/t485/pyts/ptsdefine.py
cp ubuntu/t485/pyts/pts.py ubuntu/t485/pts
cp ubuntu/t485/pyts/jpts.py ubuntu/t485/jpts
ln -s pyts/dac_vcxo_pll.py ubuntu/t485/test01.py
ln -s pyts/leds.py ubuntu/t485/test02.py
ln -s pyts/ttl_pulse_switch.py ubuntu/t485/test03.py
ln -s pyts/rs485_pulse.py ubuntu/t485/test04.py
ln -s pyts/therm_id.py ubuntu/t485/test05.py
ln -s pyts/sfp_eeprom.py ubuntu/t485/test06.py
ln -s pyts/sfp_test.py ubuntu/t485/test07.py
ln -s pyts/flashtest.py ubuntu/t485/flashtest.py
mkdir -p ubuntu/t485/boot
mv ubuntu/t485/shell/program ubuntu/t485/boot
mv ubuntu/t485/shell/flash ubuntu/t485/boot
wget -P ubuntu/t485/boot http://www.ohwr.org/attachments/download/3671/pts.bit
wget -P ubuntu/t485/boot http://www.ohwr.org/attachments/download/3650/flash_load.bit
wget -P ubuntu/t485/boot http://www.ohwr.org/attachments/download/3657/golden-v0.0_release-v1.0.bin
clean:
rm -rf pts-conv-ttl-rs485
rm -rf ubuntu/
......@@ -77,7 +77,7 @@
# Import system modules
import sys
sys.path.append("../lib/")
sys.path.append("pyts")
import time
import os
import math
......
......@@ -44,7 +44,7 @@
# Import system modules
import sys
sys.path.append("lib/")
sys.path.append("log/")
import time
import os, errno, re, sys, struct
import os.path
......@@ -66,11 +66,30 @@ def main(bus,tname,inf,log):
"""
tests : Flash chip IC62
uses : golden-v0.0_release-v1.0.bit and flashtest.py
uses : golden-v0.0_release-v1.0.bin and flashtest.py
"""
RELEASE_GWVERS = 3.0
GOLDEN_GWVERS = 0.2
GWVERS_RELEASE = 1.0
GWVERS_GOLDEN = 0.0
# Set the precision of gateware versions based on the number of digits the
# fractional part thereof has; this is done to avoid exceptions in the
# printing to file below
#
# gwvers can be between 0.0 to 15.15 (four bits major, four bits minor)
r = GWVERS_RELEASE - int(GWVERS_RELEASE)
r *= 100
r = int(r)
pr = 1
if (r < 20) and (r >= 10):
pr = 2
g = GWVERS_GOLDEN - int(GWVERS_GOLDEN)
g *= 100
g = int(g)
pg = 1
if (g < 20) and (g >= 10):
pg = 2
pel = PTS_ERROR_LOGGER(inf,log)
......@@ -101,11 +120,11 @@ def main(bus,tname,inf,log):
gwvers = maj + min
# and now check if appropriate
if (gwvers == RELEASE_GWVERS):
if (gwvers == GWVERS_RELEASE):
msg = "Release gateware version correct: %2.*f\n" % (p, gwvers)
inf.write(msg)
else:
msg = "ERROR: Release gateware version (%2.*f) incorrect - expected %f" % (p, gwvers, RELEASE_GWVERS)
msg = "ERROR: Release gateware version (%2.*f) incorrect - expected %2.*f" % (p, gwvers, pr, GWVERS_RELEASE)
pel.set(msg)
# Fall-back to golden addres by performing IPROG from wrong address
......@@ -130,6 +149,18 @@ def main(bus,tname,inf,log):
pel.set(msg)
break
# 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 correct: %s\n" % bid
inf.write(msg)
else:
msg = "ERROR: Board ID (%s) incorrect, check IC62" % bid
pel.set(msg)
# Read gateware version after fall-back
gwvers = bus.vv_read(0x04) & 0xff
maj = float(gwvers >> 4)
......@@ -143,16 +174,16 @@ def main(bus,tname,inf,log):
gwvers = maj + min
# and now check if appropriate
if (gwvers == GOLDEN_GWVERS):
if (gwvers == GWVERS_GOLDEN):
msg = "Golden gateware version correct: %2.*f\n" % (p, gwvers)
inf.write(msg)
else:
msg = "ERROR: Golden gateware version (%2.*f) incorrect - expected %f" % (p, gwvers, GOLDEN_GWVERS)
msg = "ERROR: Golden gateware version (%2.*f) incorrect - expected %2.*f" % (p, gwvers, pg, GWVERS_GOLDEN)
pel.set(msg)
# FPGA up from booting, end the loop
break
except:
except BusException:
continue
return pel.get()
......
......@@ -48,7 +48,8 @@
## Import
##------------------------------------------------------------------------------------------------
import sys
sys.path.append('lib/')
sys.path.append('.')
sys.path.append("pyts")
import ptsexcept
import ptsdefine
import time
......
......@@ -47,7 +47,6 @@
# Import system modules
import sys
sys.path.append("../lib/")
import time
import os, errno, re, sys, struct
import os.path
......
......@@ -54,14 +54,15 @@
##-------------------------------------------------------------------------------------------------
import sys
sys.path.append('.')
sys.path.append("pyts")
import time
import traceback
import os
import subprocess
import re
sys.path.append('.')
##-------------------------------------------------------------------------------------------------
## Method to turn on the ELMA crate.
##-------------------------------------------------------------------------------------------------
......@@ -70,14 +71,11 @@ sys.path.append('.')
def men_is_on():
on = 0
subprocess.call("cd shell; ./get-fan-speeds", shell=True, stdout=fnull, stderr=fnull)
try:
btxt = tuple(open("log/fan-speeds","r"))
for i in range(1,len(btxt)):
if btxt[i].find("INTEGER: 0") == -1:
on = on + 1
return on
except IOError:
return 0
btxt = tuple(open("log/fan-speeds","r"))
for i in range(1,len(btxt)):
if btxt[i].find("INTEGER: 0") == -1:
on = on + 1
return on
##-------------------------------------------------------------------------------------------------
## Method to turn on the VME crate.
......@@ -150,7 +148,7 @@ if __name__ == '__main__':
sn2 = "0"
break
# Ask the user to plug in the board, turn on the crate and call the flash_* script to download bitstream
# Ask the user to plug in the board, turn on the crate and call the script to download bitstream
# to FPGA
msg = "\n--> Plug the CONV-TTL-RS485 board '%s-%s' into the VME crate.\n Then type 'ok': " % (sn1, sn2)
ok = raw_input(msg)
......@@ -171,7 +169,7 @@ if __name__ == '__main__':
print "ERROR: Bitstream download fail. Check JTAG connectivity."
else:
# Run JPTS in another shell script; JPTS will handle running each of the test scripts
cmd = "xterm -e ./jpts.py -s %s %s" % (sn1, sn2)
cmd = "xterm -e ./jpts -s %s %s" % (sn1, sn2)
print "Running tests :%s\n" % (cmd)
subprocess.call(cmd, shell=True, stdout=fnull, stderr=fnull)
ret = subprocess.call("grep FAIL log/*.log", shell=True, stdout=fnull, stderr=fnull)
......
......@@ -42,7 +42,7 @@
# ELMA crate definitions
ELMAIP = ""
ELMAPWD = ""
ELMASLOT = 4
ELMASLOT =
# Board ID register
BIDR = 0x000
......
# Import system modules
import sys
sys.path.append("../lib/")
import time
# Import common modules
......
......@@ -49,7 +49,6 @@
# Import system modules
import sys
sys.path.append("../lib/")
import time
import os
......
......@@ -55,7 +55,6 @@
import ctypes
import sys
sys.path.append("../lib/")
import time
import os
import traceback
......
......@@ -47,7 +47,6 @@
# Import system modules
import sys
sys.path.append("../lib/")
import time
import os
......
......@@ -101,7 +101,6 @@
# Import system modules
import sys
sys.path.append("../lib/")
import time
import os, errno, re, struct
import os.path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment