soc/tools/litex_term: also rename inside file
This commit is contained in:
parent
601c91a3e2
commit
6c71811138
|
@ -133,7 +133,7 @@ def get_file_data(filename):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
class Flterm:
|
class LiteXTerm:
|
||||||
def __init__(self, kernel_image, kernel_address):
|
def __init__(self, kernel_image, kernel_address):
|
||||||
self.kernel_image = kernel_image
|
self.kernel_image = kernel_image
|
||||||
self.kernel_address = kernel_address
|
self.kernel_address = kernel_address
|
||||||
|
@ -178,13 +178,13 @@ class Flterm:
|
||||||
elif reply == sfl_ack_crcerror:
|
elif reply == sfl_ack_crcerror:
|
||||||
retry = 1
|
retry = 1
|
||||||
else:
|
else:
|
||||||
print("[FLTERM] Got unknown reply '{}' from the device, aborting.".format(reply))
|
print("[TERM] Got unknown reply '{}' from the device, aborting.".format(reply))
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def upload(self, filename, address):
|
def upload(self, filename, address):
|
||||||
data = get_file_data(filename)
|
data = get_file_data(filename)
|
||||||
print("[FLTERM] Uploading {} ({} bytes)...".format(filename, len(data)))
|
print("[TERM] Uploading {} ({} bytes)...".format(filename, len(data)))
|
||||||
current_address = address
|
current_address = address
|
||||||
position = 0
|
position = 0
|
||||||
length = len(data)
|
length = len(data)
|
||||||
|
@ -209,11 +209,11 @@ class Flterm:
|
||||||
data = []
|
data = []
|
||||||
end = time.time()
|
end = time.time()
|
||||||
elapsed = end - start
|
elapsed = end - start
|
||||||
print("[FLTERM] Upload complete ({0:.1f}KB/s).".format(length/(elapsed*1024)))
|
print("[TERM] Upload complete ({0:.1f}KB/s).".format(length/(elapsed*1024)))
|
||||||
return length
|
return length
|
||||||
|
|
||||||
def boot(self):
|
def boot(self):
|
||||||
print("[FLTERM] Booting the device.")
|
print("[TERM] Booting the device.")
|
||||||
frame = SFLFrame()
|
frame = SFLFrame()
|
||||||
frame.length = 4
|
frame.length = 4
|
||||||
frame.cmd = sfl_cmd_jump
|
frame.cmd = sfl_cmd_jump
|
||||||
|
@ -229,12 +229,12 @@ class Flterm:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def answer_magic(self):
|
def answer_magic(self):
|
||||||
print("[FLTERM] Received firmware download request from the device.")
|
print("[TERM] Received firmware download request from the device.")
|
||||||
if os.path.exists(self.kernel_image):
|
if os.path.exists(self.kernel_image):
|
||||||
self.write_exact(sfl_magic_ack)
|
self.write_exact(sfl_magic_ack)
|
||||||
self.upload(self.kernel_image, self.kernel_address)
|
self.upload(self.kernel_image, self.kernel_address)
|
||||||
self.boot()
|
self.boot()
|
||||||
print("[FLTERM] Done.");
|
print("[TERM] Done.");
|
||||||
|
|
||||||
def reader(self):
|
def reader(self):
|
||||||
try:
|
try:
|
||||||
|
@ -293,7 +293,7 @@ class Flterm:
|
||||||
self.writer_thread.join()
|
self.writer_thread.join()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
print("[FLTERM] Starting....")
|
print("[TERM] Starting....")
|
||||||
self.start_reader()
|
self.start_reader()
|
||||||
self.start_writer()
|
self.start_writer()
|
||||||
|
|
||||||
|
@ -318,11 +318,11 @@ def _get_args():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = _get_args()
|
||||||
flterm = Flterm(args.kernel, args.kernel_adr)
|
term = LiteXTerm(args.kernel, args.kernel_adr)
|
||||||
flterm.open(args.port, args.speed)
|
term.open(args.port, args.speed)
|
||||||
flterm.start()
|
term.start()
|
||||||
try:
|
try:
|
||||||
flterm.join(True)
|
term.join(True)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue