tools/litex_term: change TERM prompt to LXTERM

This commit is contained in:
Florent Kermarrec 2019-04-23 17:46:02 +02:00
parent 475deb51ac
commit 9ded2eb20b
1 changed files with 8 additions and 8 deletions

View File

@ -153,14 +153,14 @@ class LiteXTerm:
elif reply == sfl_ack_crcerror: elif reply == sfl_ack_crcerror:
retry = 1 retry = 1
else: else:
print("[TERM] Got unknown reply '{}' from the device, aborting.".format(reply)) print("[LXTERM] 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):
with open(filename, "rb") as f: with open(filename, "rb") as f:
data = f.read() data = f.read()
print("[TERM] Uploading {} ({} bytes)...".format(filename, len(data))) print("[LXTERM] Uploading {} ({} bytes)...".format(filename, len(data)))
current_address = address current_address = address
position = 0 position = 0
length = len(data) length = len(data)
@ -185,11 +185,11 @@ class LiteXTerm:
data = [] data = []
end = time.time() end = time.time()
elapsed = end - start elapsed = end - start
print("[TERM] Upload complete ({0:.1f}KB/s).".format(length/(elapsed*1024))) print("[LXTERM] Upload complete ({0:.1f}KB/s).".format(length/(elapsed*1024)))
return length return length
def boot(self): def boot(self):
print("[TERM] Booting the device.") print("[LXTERM] Booting the device.")
frame = SFLFrame() frame = SFLFrame()
frame.cmd = sfl_cmd_jump frame.cmd = sfl_cmd_jump
frame.payload = self.kernel_address.to_bytes(4, "big") frame.payload = self.kernel_address.to_bytes(4, "big")
@ -203,7 +203,7 @@ class LiteXTerm:
return False return False
def answer_prompt(self): def answer_prompt(self):
print("[TERM] Received serial boot prompt from the device.") print("[LXTERM] Received serial boot prompt from the device.")
self.port.write(sfl_prompt_ack) self.port.write(sfl_prompt_ack)
def detect_magic(self, data): def detect_magic(self, data):
@ -214,12 +214,12 @@ class LiteXTerm:
return False return False
def answer_magic(self): def answer_magic(self):
print("[TERM] Received firmware download request from the device.") print("[LXTERM] Received firmware download request from the device.")
if os.path.exists(self.kernel_image): if os.path.exists(self.kernel_image):
self.port.write(sfl_magic_ack) self.port.write(sfl_magic_ack)
self.upload(self.kernel_image, self.kernel_address) self.upload(self.kernel_image, self.kernel_address)
self.boot() self.boot()
print("[TERM] Done."); print("[LXTERM] Done.");
def reader(self): def reader(self):
try: try:
@ -276,7 +276,7 @@ class LiteXTerm:
self.writer_thread.join() self.writer_thread.join()
def start(self): def start(self):
print("[TERM] Starting....") print("[LXTERM] Starting....")
self.start_reader() self.start_reader()
self.start_writer() self.start_writer()