Skip to content

Commit

Permalink
rtt: fix cb not found when the first character of the cb_id was not i…
Browse files Browse the repository at this point in the history
…n the memory of this read (#1729)
  • Loading branch information
Darren authored and Darren committed Oct 16, 2024
1 parent 456cbf8 commit 0d70a28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyocd/debug/rtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ def __init__(self, target: SoCTarget, address: int = None,

def _find_control_block(self) -> Optional[int]:
addr: int = self._cb_search_address & ~0x3
search_addr: int = addr
search_size: int = self._cb_search_size_bytes
if search_size < len(self._control_block_id):
search_size = len(self._control_block_id)
Expand All @@ -435,7 +436,7 @@ def _find_control_block(self) -> Optional[int]:

while search_size:
read_size = min(search_size, 32)
data = self.target.read_memory_block8(addr, read_size)
data = self.target.read_memory_block8(search_addr, read_size)

if not data:
break
Expand All @@ -454,6 +455,8 @@ def _find_control_block(self) -> Optional[int]:
if offset == id_len:
break

search_addr += read_size

return addr if offset == id_len else None

def start(self):
Expand Down

0 comments on commit 0d70a28

Please sign in to comment.