Skip to content
Open
Changes from all commits
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
6 changes: 5 additions & 1 deletion pyocd/probe/jlink_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright (c) 2021-2022 Chris Reed
# Copyright (c) 2023 Marian Muller Rebeyrol
# Copyright (c) 2026 Christophe Dufaza
# Copyright (c) 2026 Aditya Nikam
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -498,7 +499,10 @@ def swo_stop(self):

def swo_read(self):
try:
return self._link.swo_read(0, self._link.swo_num_bytes(), True)
count = self._link.swo_num_bytes()
if count <= 0:
return bytearray()
return self._link.swo_read(0, count, True)
except JLinkException as exc:
raise self._convert_exception(exc) from exc

Expand Down