RTT Autodetect works with J-Link RTT Viewer, but for pylink I have to explicitly provide the address
NOhs opened this issue · 1 comments
Hello there,
I have a little cortex-M33 chip to which I connect using J-Link (V7.86h, but also tested V7.5). Using the J-Link RTT viewer and the following settings:
I can connect to my device and read out the text it prints to the channel 0 buffer.
If I use the pylink example from this repo:
def main(target_device, block_address=None):
"""Creates an interactive terminal to the target via RTT.
The main loop opens a connection to the JLink, and then connects
to the target device. RTT is started, the number of buffers is presented,
and then two worker threads are spawned: one for read, and one for write.
The main loops sleeps until the JLink is either disconnected or the
user hits ctrl-c.
Args:
target_device (string): The target CPU to connect to.
block_address (int): optional address pointing to start of RTT block.
Returns:
Always returns ``0`` or a JLinkException.
Raises:
JLinkException on error.
"""
jlink = pylink.JLink()
print("connecting to JLink...")
jlink.open()
print("connecting to %s..." % target_device)
jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
jlink.connect(target_device)
print("connected, starting RTT...")
jlink.rtt_start(block_address)
while True:
try:
num_up = jlink.rtt_get_num_up_buffers()
num_down = jlink.rtt_get_num_down_buffers()
print("RTT started, %d up bufs, %d down bufs." % (num_up, num_down))
break
except pylink.errors.JLinkRTTException:
time.sleep(0.1)
It hangs in the while loop unless I explicitly provide the block_address
.
Note:
- I am using pylink-square 0.14.3.
- The actual address of the buffer is:
0x20180f0c
Am I missing something else to get auto-detection to work in pylink-square?
Thank you for any tips or pointers that could help me getting auto-detect to work on my side.
For anybody having the same issue: My mistake was to pass the target_chip_name instead of the full target_name to connect(...)
.
From the Segger wiki:
For Auto-Detection to work, J-Link needs to be passed the correct target device name (the target core name alone is NOT sufficient for Auto-detection)