Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/1553 rtt cb not found #1583

Merged
merged 4 commits into from
Aug 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions pyocd/debug/rtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,7 @@ def __init__(self, target: SoCTarget, address: int = None,
self._cb_search_size_words = 0
else:
self._cb_search_size_words = size // 4
flit marked this conversation as resolved.
Show resolved Hide resolved

extra_id_bytes = SEGGER_RTT_CB.acID.size - len(control_block_id)
control_block_bytes = control_block_id + b'\0' * extra_id_bytes
self._control_block_id = struct.unpack("<IIII", control_block_bytes)
self._control_block_id = control_block_id

def _find_control_block(self) -> Optional[int]:
addr: int = self._cb_search_address & ~0x3
Expand All @@ -436,20 +433,20 @@ def _find_control_block(self) -> Optional[int]:
offset: int = 0

while search_size:
read_size = min(search_size, 32)
data = self.target.read_memory_block32(addr, read_size)
read_size = min(search_size, 8)
flit marked this conversation as resolved.
Show resolved Hide resolved
data = self.target.read_memory_block8(addr, read_size)

if not data:
break

for word in data:
if word == self._control_block_id[offset]:
for byte in data:
if byte == self._control_block_id[offset]:
offset += 1
if offset == id_len:
break
else:
num_skip_words = (offset + 1)
addr += (num_skip_words * 4)
addr += (num_skip_words * 1)
search_size -= num_skip_words
offset = 0

Expand Down
Loading