import targets
import testlib
from testlib import assertEqual, assertNotEqual, assertIn
-from testlib import assertGreater, assertTrue, assertRegexpMatches, assertLess
+from testlib import assertGreater, assertRegexpMatches, assertLess
from testlib import GdbTest
MSTATUS_UIE = 0x00000001
def server(self):
"""Start the debug server that gdb connects to, eg. OpenOCD."""
if self.openocd_config:
- return testlib.Openocd(server_cmd=self.server_cmd, config=self.openocd_config)
+ return testlib.Openocd(server_cmd=self.server_cmd,
+ config=self.openocd_config)
else:
raise NotImplementedError
def compile(args, xlen=32): # pylint: disable=redefined-builtin
cc = os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gcc")
cmd = [cc, "-g"]
- if (xlen == 32):
+ if xlen == 32:
cmd.append("-march=rv32imac")
cmd.append("-mabi=ilp32")
else:
cmd.append("-march=rv64imac")
- cmd.append("-mabi=lp64")
+ cmd.append("-mabi=lp64")
for arg in args:
found = find_file(arg)
if found:
else:
openocd = os.path.expandvars("$RISCV/bin/riscv-openocd")
cmd = [openocd]
- if (debug):
+ if debug:
cmd.append("-d")
-
+
# This command needs to come before any config scripts on the command
# line, since they are executed in order.
cmd += [
if config:
f = find_file(config)
if f is None:
- print("Unable to read file " + config)
+ print "Unable to read file " + config
exit(1)
cmd += ["-f", f]
gdb_cmd = parsed.gdb
todo = []
- if (parsed.misaval):
+ if parsed.misaval:
target.misa = int(parsed.misaval, 16)
- print "Assuming $MISA value of 0x%x. Skipping ExamineTarget." % target.misa
+ print "Assuming $MISA value of 0x%x. Skipping ExamineTarget." % \
+ target.misa
else:
todo.append(("ExamineTarget", ExamineTarget))
parser.add_argument("--gdb",
help="The command to use to start gdb.")
parser.add_argument("--misaval",
- help="Don't run ExamineTarget, just assume the misa value which is specified.")
+ help="Don't run ExamineTarget, just assume the misa value which is "
+ "specified.")
def header(title, dash='-'):
if title: