Skip to content

Commit

Permalink
openocd: finer-grained error msg if board unknown
Browse files Browse the repository at this point in the history
When trying to set up tockloader to use openocd, I kept getting
the generic message saying "Could not determine the current board
or arch or openocd board name". Not only did it not mention missing
page_size parameter, but also was too coarse-grained. With splitting
the error message, I managed to debug this, so I believe this could be
beneficial to anyone.
  • Loading branch information
wprzytula committed Feb 8, 2024
1 parent a3d173a commit 4401776
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tockloader/openocd.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,21 @@ def determine_current_board(self):
self._configure_from_known_boards()

# Check that we learned what we needed to learn.
if (
self.board == None
or self.arch == None
or self.openocd_board == "cortex-m0"
or self.page_size == 0
):
if self.board is None:
raise TockLoaderException(
"Could not determine the current board or arch or openocd board name"
"Could not determine the current board"
)
if self.arch is None:
raise TockLoaderException(
"Could not determine the current arch"
)
if self.openocd_board == "cortex-m0":
raise TockLoaderException(
"Could not determine the current openocd board name"
)
if self.page_size == 0:
raise TockLoaderException(
"Could not determine the current page size"
)

def run_terminal(self):
Expand Down

0 comments on commit 4401776

Please sign in to comment.