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

Add rtt control block into YAML config #1418

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 11 additions & 7 deletions pyocd/subcommands/rtt_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ def invoke(self) -> int:

memory_map: MemoryMap = target.get_memory_map()
ram_region: MemoryRegion = memory_map.get_default_region_of_type(MemoryType.RAM)

if self._args.address is None or self._args.size is None:
rtt_range_start = ram_region.start
rtt_range_size = ram_region.length
elif ram_region.start <= self._args.address and self._args.size <= ram_region.length:
rtt_range_start = self._args.address
rtt_range_size = self._args.size
def valid_range(start, size):
return start != None and size != None \
and ram_region.start <= start and size + start <= ram_region.start + ram_region.length
rtt_range_start, rtt_range_size = None, None
crides marked this conversation as resolved.
Show resolved Hide resolved
config_start, config_size = session.options.get('rtt.start'), session.options.get('rtt.size')
crides marked this conversation as resolved.
Show resolved Hide resolved
if valid_range(self._args.address, self._args.size):
rtt_range_start, rtt_range_size = self._args.address, self._args.size
elif valid_range(config_start, config_size):
rtt_range_start, rtt_range_size = config_start, config_size
else:
rtt_range_start, rtt_range_size = ram_region.start, ram_region.length

LOG.info(f"RTT control block search range [{rtt_range_start:#08x}, {rtt_range_size:#08x}]")

Expand Down