Skip to content

Commit

Permalink
rtos: Add hint for zephyr’s Thread Info configuration
Browse files Browse the repository at this point in the history
This should allow for easier discoverability of that parameter.
  • Loading branch information
ithinuel committed Nov 12, 2024
1 parent 456cbf8 commit f388f8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pyocd/rtos/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ def __init__(self, target):
self._last_run_token = -1
self._read_from_target = False

def _lookup_symbols(self, symbolList, symbolProvider):
def _lookup_symbols(self, symbolList, symbolProvider, allowPartial = False):
syms = {}
for name in symbolList:
addr = symbolProvider.get_symbol_value(name)
LOG.debug("Value for symbol %s = %s", name, hex(addr) if addr is not None else "<none>")
if addr is None:
if addr is not None:
syms[name] = addr
elif not allowPartial:
return None
syms[name] = addr
return syms

def init(self, symbolProvider):
Expand Down
6 changes: 5 additions & 1 deletion pyocd/rtos/zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,13 @@ def __init__(self, target):

def init(self, symbolProvider):
# Lookup required symbols.
self._symbols = self._lookup_symbols(self.ZEPHYR_SYMBOLS, symbolProvider)
self._symbols = self._lookup_symbols(self.ZEPHYR_SYMBOLS, symbolProvider, True)
if self._symbols is None:
return False
if len(self._symbols) != len(self.ZEPHYR_SYMBOLS):
LOG.warning("Zephyr kernel detected. Build your Zephyr application with `CONFIG_DEBUG_THREAD_INFO=y` to " +
"enable thread awareness.")
return False

self._update()
self._target.session.subscribe(self.event_handler, Target.Event.POST_FLASH_PROGRAM)
Expand Down

0 comments on commit f388f8c

Please sign in to comment.