Commit 8fa136a0 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

sw: Work on flash chip test

parent 22fb2160
......@@ -7,7 +7,8 @@ all:
mkdir -p pts-conv-ttl-rs485/tests
mkdir -p pts-conv-ttl-rs485/lib
cp -r shell/ pts-conv-ttl-rs485/
mv pts-conv-ttl-rs485/shell/program pts-conv-ttl-rs485/boot
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/
......@@ -18,21 +19,25 @@ all:
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/sfp_eeprom.py pts-conv-ttl-rs485/tests/
cp python/sfp_test.py pts-conv-ttl-rs485/tests/
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/sfp_eeprom.py pts-conv-ttl-rs485/tests/
cp python/sfp_test.py pts-conv-ttl-rs485/tests/
cp python/flash.py pts-conv-ttl-rs485/tests/
ln -s tests/dac_vcxo_pll.py pts-conv-ttl-rs485/test01.py
ln -s tests/therm_id.py pts-conv-ttl-rs485/test02.py
ln -s tests/ttl_pulse_switch.py pts-conv-ttl-rs485/test03.py
ln -s tests/sfp_eeprom.py pts-conv-ttl-rs485/test04.py
ln -s tests/sfp_test.py pts-conv-ttl-rs485/test05.py
ln -s tests/leds.py pts-conv-ttl-rs485/test06.py
ln -s tests/dac_vcxo_pll.py pts-conv-ttl-rs485/test01.py
ln -s tests/therm_id.py pts-conv-ttl-rs485/test02.py
ln -s tests/ttl_pulse_switch.py pts-conv-ttl-rs485/test03.py
ln -s tests/sfp_eeprom.py pts-conv-ttl-rs485/test04.py
ln -s tests/sfp_test.py pts-conv-ttl-rs485/test05.py
ln -s tests/leds.py pts-conv-ttl-rs485/test06.py
ln -s tests/flash.py pts-conv-ttl-rs485/test08.py
wget -P pts-conv-ttl-rs485/boot http://www.ohwr.org/attachments/download/3648/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/3649/golden-v0.0_release-v1.0.bin
clean:
rm -rf pts-conv-ttl-rs485
......
##_______________________________________________________________________________________________
##
## CONV-TTL-RS485 PTS
##
## CERN,BE/CO-HT
##_______________________________________________________________________________________________
##
##-----------------------------------------------------------------------------------------------
##
## CONV-TTL-RS485 flash test
##
##-----------------------------------------------------------------------------------------------
##
## Description FILL ME!!! FILL ME!!! FILL ME!!! FILL ME!!! FILL ME!!! FILL ME!!! FILL ME!!!
##
##
## Authors Julian Lewis (Julian.Lewis@cern.ch)
## Theodor-Adrian Stana (t.stana@cern.ch)
## Website http://www.ohwr.org/projects/pts
## Date 05/11/2014
##-----------------------------------------------------------------------------------------------
##
##------------------------------------------------------------------------------------------------
## GNU LESSER GENERAL PUBLIC LICENSE
## ------------------------------------
## This source file is free software; you can redistribute it and/or modify it under the terms of
## the GNU Lesser General Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
## without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU Lesser General Public License for more details.
## You should have received a copy of the GNU Lesser General Public License along with this
## source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
##-------------------------------------------------------------------------------------------------
##-------------------------------------------------------------------------------------------------
## Import
##-------------------------------------------------------------------------------------------------
# Import system modules
import sys
import time
import os, errno, re, sys, struct
import os.path
import traceback
import glob
import binascii
# Import common modules
from ctypes import *
from ptsexcept import *
from vv_pts import *
from ptsdefine import *
##-------------------------------------------------------------------------------------------------
## main --
##-------------------------------------------------------------------------------------------------
def main(bus,tname,inf,log):
"""
tests : EEPROM chip IC62
uses : release.bit and flash_test.py
"""
pel = PTS_ERROR_LOGGER(inf,log)
try:
bid = bus.vv_read(0x00)
bid = binascii.unhexlify("%s" % "{0:x}".format(bid))
if (bid == "T485"):
msg = "Board ID '%s' correct\n" % bid
inf.write(msg)
else:
msg = "ERROR: Board ID incorrect, check IC62"
pel.set(msg)
return pel.get()
except BusException, e:
raise PtsError("SKT Exception: %s" % (e))
except BusWarning, e:
raise PtsError("SKT Warning: %s" % (e))
if __name__ == '__main__':
bus = SKT(ELMASLOT)
os.chdir("log")
logname = glob.glob('*.log')
infname = glob.glob('*.inf')
log = open(logname[0],'a')
inf = open(infname[0],'a')
log.write("Run:1 Begin: test08\n")
inf.write("Run:1 Begin: test08\n")
ret = main(bus, 'test08', inf, log)
if (ret == 0):
log.write("PASS: test08\n")
else:
log.write("FAIL: test08\n")
log.write("Run:1 End: test08\n")
inf.write("Run:1 End: test08\n")
......@@ -178,24 +178,26 @@ if __name__ == '__main__':
print "Running tests :%s\n" % (cmd)
subprocess.call(cmd, shell=True, stdout=fnull, stderr=fnull)
# # After JPTS has finished, download release bitstream to EEPROM chip if none of the tests has failed
# print "Loading CONV-TTL-RS485 release bitstream\n"
# ret = subprocess.call("cd /home/pts/ubuntu/ttlbl/boot; ./flash_release.sh", shell=True, stdout=sys.stdout, stderr=sys.stderr)
# if (ret == 0):
# time.sleep(1)
#
# After JPTS has finished, download release bitstream to EEPROM chip if none of the tests has failed
print "Loading CONV-TTL-RS485 golden and release bitstream...\n"
ret = subprocess.call("cd boot; ./flash", shell=True, stdout=sys.stdout,
stderr=sys.stderr)
if (ret != 0):
print "ERROR: Bitstream download failed"
else:
time.sleep(1)
# # ... power-cycle the crate
# print "VME Crate power-cycle..."
# men_off()
# time.sleep(5)
# men_on()
#
# time.sleep(5)
#
# print ''
# # .. and run the flash test
# cmd = "cd /home/pts/ubuntu/ttlbl/pyts; python flash_test.py"
# subprocess.call(cmd, shell=True, stdout=sys.stdout, stderr=sys.stderr)
time.sleep(5)
# .. and run the flash test
cmd = "./test08.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
subprocess.call("grep PASS log/*.log", shell=True, stdout=sys.stdout, stderr=sys.stderr)
......
#!/bin/bash
xc3sprog -c xpc flash_load.bit
xc3sprog -c xpc -I golden-v0.0_release-v1.0.bin:w:0:bin
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