Skip to content

Commit 6ae68c4

Browse files
committed
feat(sysview): update multicore files for testing
1 parent 9af60ff commit 6ae68c4

File tree

11 files changed

+18014
-15760
lines changed

11 files changed

+18014
-15760
lines changed

tools/esp_app_trace/sysviewtrace_proc.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import tempfile
1818
import traceback
19+
from urllib.parse import urlparse
1920

2021
import espytrace.apptrace as apptrace
2122
import espytrace.sysview as sysview
@@ -24,27 +25,27 @@
2425
def is_segger_multicore_format(file_path):
2526
"""Check if the file has offsets in header"""
2627
try:
27-
with open(file_path, 'rb') as f:
28-
header = f.read(200)
29-
header_str = header.decode('utf-8', errors='ignore')
30-
31-
if (
32-
'; Version SEGGER SystemViewer' in header_str
33-
and '; Author Espressif Inc' in header_str
34-
and '; Offset Core0' in header_str
35-
and '; Offset Core1' in header_str
36-
):
37-
logging.info('Detected SEGGER multicore format in file:', file_path)
38-
return True
28+
url = urlparse(file_path)
29+
if len(url.scheme) == 0 or url.scheme == 'file':
30+
with open(url.path, 'rb') as f:
31+
header = f.read(200)
32+
header_str = header.decode('utf-8', errors='ignore')
33+
if (
34+
'; Version SEGGER SystemViewer' in header_str
35+
and '; Author Espressif Inc' in header_str
36+
and '; Offset Core0' in header_str
37+
and '; Offset Core1' in header_str
38+
):
39+
return True
3940
except Exception as e:
40-
logging.error('Error checking file format:', e)
41+
logging.error('Error checking SEGGER multicore file format:', e)
4142
return False
4243

4344

4445
def split_segger_multicore_file(file_path):
4546
"""Split SEGGER multicore file into separate core files."""
4647
try:
47-
with open(file_path, 'rb') as f:
48+
with open(urlparse(file_path).path, 'rb') as f:
4849
# Read first few lines to get offsets for each core
4950
header = f.read(200)
5051
header_str = header.decode('utf-8', errors='ignore')
@@ -165,15 +166,15 @@ def sig_int_handler(signum, frame):
165166

166167
logging.basicConfig(level=verbosity_levels[args.verbose], format='[%(levelname)s] %(message)s')
167168

168-
segger_files = []
169+
temp_files = []
169170
# Only check for SEGGER format if there's exactly one trace source
170171
if len(args.trace_sources) == 1:
171172
trace_source = args.trace_sources[0]
172173
if is_segger_multicore_format(trace_source):
173174
core0_file, core1_file = split_segger_multicore_file(trace_source)
174175
if core0_file and core1_file:
175-
segger_files.extend([core0_file, core1_file])
176-
args.trace_sources = segger_files
176+
temp_files.extend([core0_file, core1_file])
177+
args.trace_sources = temp_files
177178
else:
178179
sys.exit(2)
179180

@@ -257,8 +258,8 @@ def sig_int_handler(signum, frame):
257258
proc.print_report()
258259
proc.cleanup()
259260

260-
if segger_files:
261-
for file in segger_files:
261+
if len(temp_files) > 0:
262+
for file in temp_files:
262263
try:
263264
os.remove(file)
264265
except Exception as e:

tools/esp_app_trace/test/sysview/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
```
2626
cd $IDF_PATH/examples/system/sysview_tracing_heap_log
27-
xtensa-esp32-elf-gdb -x gdbinit build/sysview_tracing_heap_log.elf
27+
xtensa-esp32-elf-gdb -x $IDF_PATH/tools/esp_app_trace/test/sysview/gdbinit build/sysview_tracing_heap_log.elf
2828
```
2929
When program stops at `heap_trace_stop` quit GDB and OpenOCD
3030
@@ -45,7 +45,7 @@
4545
4646
```
4747
cd $IDF_PATH/examples/system/sysview_tracing_heap_log
48-
xtensa-esp32-elf-gdb -x gdbinit-mcore build/sysview_tracing_heap_log.elf
48+
xtensa-esp32-elf-gdb -x $IDF_PATH/tools/esp_app_trace/test/sysview/gdbinit-mcore build/sysview_tracing_heap_log.elf
4949
```
5050
When program stops at `heap_trace_stop` quit GDB and OpenOCD
5151
@@ -59,6 +59,7 @@
5959
You can use the commands from the `test.sh` to generate expected result files
6060
6161
```
62+
cd $IDF_PATH/tools/esp_app_trace/test/sysview/
6263
$IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &> expected_output
6364
$IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &> expected_output.json
6465
$IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log_mcore.svdat &> expected_output_mcore

tools/esp_app_trace/test/sysview/expected_output

Lines changed: 3058 additions & 3041 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)