jtagbone/openocd: add binary mode on JTAGUART to fix "\n" to "\r" remapping that is not wanted in binary mode.
This commit is contained in:
parent
b589959084
commit
4d1deffbb0
|
@ -96,7 +96,7 @@ proc jtagstream_drain {tap tx chunk_rx max_rx} {
|
||||||
proc jtagstream_rxtx {tap client is_poll} {
|
proc jtagstream_rxtx {tap client is_poll} {
|
||||||
if {![$client eof]} {
|
if {![$client eof]} {
|
||||||
if {!$is_poll} {
|
if {!$is_poll} {
|
||||||
set tx [$client read -nonewline 1]
|
set tx [$client read 1]
|
||||||
} else {
|
} else {
|
||||||
set tx ""
|
set tx ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ def main():
|
||||||
elif args.jtag:
|
elif args.jtag:
|
||||||
from litex.tools.litex_term import JTAGUART
|
from litex.tools.litex_term import JTAGUART
|
||||||
from litex.tools.remote.comm_uart import CommUART
|
from litex.tools.remote.comm_uart import CommUART
|
||||||
bridge = JTAGUART(config=args.jtag_config)
|
bridge = JTAGUART(config=args.jtag_config, binary_mode=True)
|
||||||
bridge.open()
|
bridge.open()
|
||||||
print("[CommUART] port: JTAG / ", end="")
|
print("[CommUART] port: JTAG / ", end="")
|
||||||
comm = CommUART(os.ttyname(bridge.name), debug=args.debug)
|
comm = CommUART(os.ttyname(bridge.name), debug=args.debug)
|
||||||
|
|
|
@ -126,9 +126,10 @@ class CrossoverUART:
|
||||||
from litex.build.openocd import OpenOCD
|
from litex.build.openocd import OpenOCD
|
||||||
|
|
||||||
class JTAGUART:
|
class JTAGUART:
|
||||||
def __init__(self, config="openocd_xc7_ft2232.cfg", port=20000): # FIXME: add command line arguments
|
def __init__(self, config="openocd_xc7_ft2232.cfg", port=20000, binary_mode=False): # FIXME: add command line arguments
|
||||||
self.config = config
|
self.config = config
|
||||||
self.port = port
|
self.port = port
|
||||||
|
self.binary_mode = binary_mode
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
self.file, self.name = pty.openpty()
|
self.file, self.name = pty.openpty()
|
||||||
|
@ -155,9 +156,10 @@ class JTAGUART:
|
||||||
while True:
|
while True:
|
||||||
r = os.read(self.file, 1)
|
r = os.read(self.file, 1)
|
||||||
self.tcp.send(r)
|
self.tcp.send(r)
|
||||||
if r == bytes("\n".encode("utf-8")):
|
if not self.binary_mode:
|
||||||
self.tcp.send("\r".encode("utf-8"))
|
if r == bytes("\n".encode("utf-8")):
|
||||||
self.tcp.send("\n".encode("utf-8"))
|
self.tcp.send("\r".encode("utf-8"))
|
||||||
|
self.tcp.send("\n".encode("utf-8"))
|
||||||
|
|
||||||
def tcp2pty(self):
|
def tcp2pty(self):
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in New Issue