From 0d8e86eef6cb6f4eb9ac06b695f09b34df67ba43 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Mon, 1 Jan 2024 16:27:30 +0100 Subject: [PATCH] coresight: target: allow algos to run on secondary cores Signed-off-by: Maximilian Deubel --- pyocd/core/memory_map.py | 1 + pyocd/coresight/coresight_target.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyocd/core/memory_map.py b/pyocd/core/memory_map.py index d42d54c85..e79e6228c 100644 --- a/pyocd/core/memory_map.py +++ b/pyocd/core/memory_map.py @@ -474,6 +474,7 @@ class FlashRegion(MemoryRegion): 'erased_byte_value': 0xff, 'access': 'rx', # By default flash is not writable. 'are_erased_sectors_readable': True, + 'core_index': 0, # Core to be used to access this region }) _algo: Optional[Dict[str, Any]] diff --git a/pyocd/coresight/coresight_target.py b/pyocd/coresight/coresight_target.py index 49887d6f9..1c0e8d8b0 100644 --- a/pyocd/coresight/coresight_target.py +++ b/pyocd/coresight/coresight_target.py @@ -286,12 +286,12 @@ def create_flash(self) -> None: argspec = getfullargspec(klass.__init__) if 'flash_algo' in argspec.args: if region.algo is not None: - obj = klass(self, region.algo) + obj = klass(self._cores[region.core_index], region.algo) else: LOG.warning("flash region '%s' has no flash algo" % region.name) continue else: - obj = klass(self) # type:ignore + obj = klass(self._cores[region.core_index]) # type:ignore # Set the region in the flash instance. obj.region = region