-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from rheineke/python3
Python3
- Loading branch information
Showing
39 changed files
with
1,994 additions
and
1,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,7 @@ output/*/index.html | |
|
||
# Sphinx | ||
docs/_build | ||
|
||
# Intellij PyCharm | ||
.idea/ | ||
ipsh.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libusb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
wheel==0.23.0 | ||
# pip install --user --trusted-host wxpython.org -r requirements.txt | ||
###### Requirements without Version Specifiers ###### | ||
# TODO: replicate pip command | ||
# pip install --user --trusted-host wxpython.org --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix | ||
http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2562+33fadd8-cp27-cp27m-macosx_10_6_intel.whl; sys_platform == 'darwin' and python_version == '2.7.0' | ||
http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2562+33fadd8-cp35-cp35m-macosx_10_6_intel.whl; sys_platform == 'darwin' and python_version == '3.5' | ||
###### Requirements with Version Specifiers ###### | ||
bitstring==3.1.5 | ||
future==0.15.2; python_version < '3.0.0' | ||
intelhex==2.1 | ||
pypubsub==3.3.0 | ||
pyserial==2.7 | ||
pyusb==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import unittest | ||
|
||
from intelhex import IntelHex | ||
|
||
from xstools.xilbitstr import XilinxBitstream | ||
from xstools.xsboard import Xula2lx25, Xula2lx9, Xula50, Xula200, Xula2, Xula | ||
|
||
|
||
class ExampleTest(unittest.TestCase): | ||
def test_bitstreams(self): | ||
# Why does each board bitstream have a characteristic length? | ||
board_bit_lengths = [ | ||
(Xula2lx25, 6411696), | ||
(Xula2lx9, 2724832), | ||
(Xula50, 437312), | ||
(Xula200, 1196128) | ||
] | ||
bitstreams = ['cfg_flash', 'sdram', 'test'] | ||
for b, exp_bit_len in board_bit_lengths: | ||
for bs in bitstreams: | ||
xbs = XilinxBitstream() | ||
fp = getattr(b, bs + '_bitstream') | ||
xbs.from_file(fp) | ||
self.assertEqual(len(xbs.bits), exp_bit_len) | ||
ih = xbs.to_intel_hex() | ||
self.assertEqual(ih.minaddr(), 0) | ||
self.assertEqual(ih.maxaddr(), (exp_bit_len + 120) // 8) | ||
|
||
def test_intel_hex(self): | ||
boards = [Xula2, Xula] | ||
for b in boards: | ||
hex_fp = b.firmware | ||
ih = IntelHex(hex_fp) | ||
self.assertEqual(ih.minaddr(), 2048) | ||
self.assertEqual(ih.maxaddr(), 3145741) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import unittest | ||
from intelhex import IntelHex | ||
|
||
from xstools.xsboard import XsBoard | ||
from xstools.xsusb import XsUsb | ||
|
||
|
||
class Sdramtest(unittest.TestCase): | ||
def setUp(self): | ||
self.board = XsBoard.get_xsboard() | ||
|
||
@unittest.skipUnless(XsUsb.get_xsusb_ports(), 'No Xula board found') | ||
def test_readwrite(self): | ||
""" | ||
test read and write sdram | ||
writes 14 values to sdram, hereafter reads 14 values | ||
from sdram and checks equality | ||
""" | ||
for v in [0, 255]: | ||
keys = range(0, 14) | ||
values = 14 * [v] | ||
data = IntelHex() | ||
data.fromdict(dict(zip(keys, values))) | ||
self.board.write_sdram(data, 0, len(keys)-1) | ||
result = self.board.read_sdram(0, len(keys)-1) | ||
self.assertEqual(data.todict(), result.todict()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import unittest | ||
|
||
from xstools.xsbitarray import XsBitArray | ||
|
||
|
||
class TestXSBitArray(unittest.TestCase): | ||
def test_head(self): | ||
arr = XsBitArray('0b01') | ||
self.assertEqual(arr.head(), XsBitArray('0b1')) | ||
self.assertNotEqual(arr.head(), XsBitArray('0b0')) | ||
|
||
def test_tail(self): | ||
arr = XsBitArray('0b01') | ||
self.assertEqual(arr.tail(), XsBitArray('0b0')) | ||
self.assertNotEqual(arr.tail(), XsBitArray('0b1')) | ||
|
||
def test_to_usb(self): | ||
a_arr = XsBitArray('0b00010') | ||
b_arr = XsBitArray('0b1111001') | ||
c_arr = a_arr + b_arr | ||
self.assertEqual(c_arr, XsBitArray('0xf22')) | ||
self.assertEqual(c_arr.to_usb(), b'"\x0f') | ||
|
||
def test_to_intel_hex(self): | ||
arr = XsBitArray('0b01') | ||
hex_arr = arr.to_intel_hex() | ||
binstr = hex_arr.tobinstr() | ||
# Getting an error here in IntelHex 2.1 on Python 2 | ||
# Traceback (most recent call last): | ||
# File "/Users/xilinx/code/XSTOOLs/tests/test_xsbitarray.py", line 27, in test_to_intel_hex | ||
# binstr = hex_arr.tobinstr() | ||
# File "/Users/xilinx/.local/lib/python2.7/site-packages/intelhex/__init__.py", line 375, in tobinstr | ||
# return self._tobinstr_really(start, end, pad, size) | ||
# File "/Users/xilinx/.local/lib/python2.7/site-packages/intelhex/__init__.py", line 378, in _tobinstr_really | ||
# return asbytes(self._tobinarray_really(start, end, pad, size).tostring()) | ||
# File "/Users/xilinx/.local/lib/python2.7/site-packages/intelhex/__init__.py", line 352, in _tobinarray_really | ||
# bin.append(self._buf.get(i, pad)) | ||
# TypeError: an integer is required | ||
# TODO: What should this output? | ||
self.assertEqual(binstr, b'@') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import unittest | ||
|
||
from xstools.xsboard import XsBoard, XulaNoJtag, all_xsboards | ||
from xstools.xsusb import XsUsb | ||
|
||
|
||
@unittest.skipUnless(XsUsb.get_xsusb_ports(), 'No Xula board found') | ||
class XsBoardTest(unittest.TestCase): | ||
def setUp(self): | ||
self.board = XsBoard.get_xsboard() | ||
|
||
def test_get_xsboard(self): | ||
# TODO(rheineke): What is the point of None? Not used in project | ||
board = XsBoard.get_xsboard(xsusb_id=None) | ||
self.assertIsNone(board) | ||
|
||
# If an explicit board name is provided, then this is chosen first | ||
# Ensure all boards are accessible by name | ||
boards = all_xsboards() | ||
for b in boards: | ||
board = XsBoard.get_xsboard(xsboard_name=b.name) | ||
# Will fail on XulaNoJtag | ||
if b is not XulaNoJtag: | ||
self.assertEqual(board.__class__, b) | ||
|
||
# If the provided board name is not found, the return the board indexed | ||
# by xsusb_id | ||
with self.assertRaises(IndexError): | ||
XsBoard.get_xsboard(xsusb_id=-2) | ||
board = XsBoard.get_xsboard(xsusb_id=0) | ||
self.assertIsNotNone(board) | ||
|
||
def test_blink(self): | ||
info = self.board.get_board_info() | ||
self.assertIsNotNone(info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,3 @@ | |
|
||
""" | ||
""" | ||
|
||
from xsdutio import * | ||
from xsmemio import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import os | ||
|
||
# Make a global variable for finding resources the programs need like icon and bitstream files. | ||
# Make a global variable for finding resources the programs need like icon and | ||
# bitstream files. | ||
install_dir = os.path.dirname(__file__) | ||
|
||
__author__ = 'XESS Corporation' | ||
__email__ = 'info@xess.com' | ||
__version__ = '0.1.31' | ||
__version__ = '0.1.31-python3-dev' |
Oops, something went wrong.