fix for python 3.8

This commit is contained in:
Sergey Shchelkanov 2023-10-02 17:18:11 +03:00
parent 1febc24a8e
commit cd17b47770

View File

@ -1,6 +1,7 @@
import re import re
import socket import socket
from logging import getLogger from logging import getLogger
from typing import List
logger = getLogger(__name__) logger = getLogger(__name__)
class TclException(Exception): class TclException(Exception):
@ -120,7 +121,7 @@ class OpenOcdTclRpc:
"""Write the word on addr and raise an error if it returns an error""" """Write the word on addr and raise an error if it returns an error"""
return self.run(f"capture \"mww {addr:#0x} {word:#0x}\"") return self.run(f"capture \"mww {addr:#0x} {word:#0x}\"")
def write_memory(self, address:int, width:int, data:list[int]): def write_memory(self, address:int, width:int, data:List[int]):
"""This function provides an efficient way to write to the target memory """This function provides an efficient way to write to the target memory
from a Tcl script from a Tcl script
@ -129,7 +130,7 @@ class OpenOcdTclRpc:
width ... memory access bit size, can be 8, 16, 32 or 64 width ... memory access bit size, can be 8, 16, 32 or 64
data ... Tcl list with the elements to write """ data ... Tcl list with the elements to write """
data_words: list[str] = [] data_words: List[str] = []
for word in data: for word in data:
data_words.append(str(f"{word:#0x}")) data_words.append(str(f"{word:#0x}"))
data_string = " ".join(data_words) data_string = " ".join(data_words)