Skip to content

Commit 2824cce

Browse files
authored
Merge pull request #1014 from patrislav1/tpiu-raw-fwd
Publish raw SWV stream to TCP port
2 parents 3f420ec + f7a9474 commit 2824cce

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

docs/options.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,20 @@ Frequency in Hertz of the target's system clock. Used to compute the SWO baud ra
404404
divider.
405405
</td></tr>
406406

407+
<tr><td>swv_raw_enable</td>
408+
<td>bool</td>
409+
<td>True</td>
410+
<td>
411+
Enable flag for the raw SWV stream server.
412+
</td></tr>
413+
414+
<tr><td>swv_raw_port</td>
415+
<td>int</td>
416+
<td>3443</td>
417+
<td>
418+
TCP port number for the raw SWV stream server.
419+
</td></tr>
420+
407421
<tr><td>telnet_port</td>
408422
<td>int</td>
409423
<td>4444</td>

pyocd/core/options.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pyOCD debugger
22
# Copyright (c) 2018-2020 Arm Limited
3+
# Copyright (c) 2020 Patrick Huesmann
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -136,6 +137,10 @@
136137
OptionInfo('swv_system_clock', int, None,
137138
"Frequency in Hertz of the target's system clock. Used to compute the SWO baud rate "
138139
"divider. No default."),
140+
OptionInfo('swv_raw_enable', bool, True,
141+
"Enable flag for the raw SWV stream server."),
142+
OptionInfo('swv_raw_port', int, 3443,
143+
"TCP port number for the raw SWV stream server."),
139144
OptionInfo('telnet_port', int, 4444,
140145
"Base TCP port number for the semihosting telnet server."),
141146
OptionInfo('vector_catch', str, 'h',

pyocd/trace/swv.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pyOCD debugger
22
# Copyright (c) 2019-2020 Arm Limited
3+
# Copyright (c) 2020 Patrick Huesmann
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,6 +28,7 @@
2728
from ..core.target import Target
2829
from ..core import exceptions
2930
from ..probe.debug_probe import DebugProbe
31+
from ..utility.server import StreamServer
3032

3133
LOG = logging.getLogger(__name__)
3234

@@ -155,6 +157,12 @@ def run(self):
155157
if self._lock:
156158
self._lock.acquire()
157159

160+
swv_raw_server = StreamServer(
161+
self._session.options.get('swv_raw_port'),
162+
name="SWV raw",
163+
is_read_only=True) \
164+
if self._session.options.get('swv_raw_enable') else None
165+
158166
# Stop SWO first in case the probe already had it started. Ignore if this fails.
159167
try:
160168
self._session.probe.swo_stop()
@@ -165,6 +173,8 @@ def run(self):
165173
while not self._shutdown_event.is_set():
166174
data = self._session.probe.swo_read()
167175
if data:
176+
if swv_raw_server:
177+
swv_raw_server.write(data)
168178
self._parser.parse(data)
169179

170180
if self._lock:
@@ -177,6 +187,9 @@ def run(self):
177187

178188
self._session.probe.swo_stop()
179189

190+
if swv_raw_server:
191+
swv_raw_server.stop()
192+
180193
if self._lock:
181194
self._lock.release()
182195

0 commit comments

Comments
 (0)