Skip to content

Commit 0f0dd27

Browse files
haduongquangkartben
authored andcommitted
west: update to support for S32DS3.6
S32DS3.6 requires to use python 3.10, so update PYTHONPATH for S32DS3.6 when debug on windows. Update to verify new behavior of supported commands with S32D3.6 on windows. Update to find out the usb device connected by VID and PID instead of class "NXP Probes" on windows Because based on the S32 Debug probe OS version the device class of USB is changed. Therefore a reliable way to identify the probe is check the USB VID and PID. Signed-off-by: Ha Duong Quang <[email protected]>
1 parent be0a0f1 commit 0f0dd27

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

scripts/west_commands/runners/nxp_s32dbg.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 NXP
1+
# Copyright 2023, 2025 NXP
22
# SPDX-License-Identifier: Apache-2.0
33
"""
44
Runner for NXP S32 Debug Probe.
@@ -17,10 +17,8 @@
1717

1818
from runners.core import BuildConfiguration, RunnerCaps, RunnerConfig, ZephyrBinaryRunner
1919

20-
NXP_S32DBG_USB_CLASS = 'NXP Probes'
21-
NXP_S32DBG_USB_VID = 0x15a2
22-
NXP_S32DBG_USB_PID = 0x0067
23-
20+
NXP_S32DBG_USB_VID = 0x1FC9
21+
NXP_S32DBG_USB_PID = 0x014D
2422

2523
@dataclass
2624
class NXPS32DebugProbeConfig:
@@ -133,8 +131,10 @@ def find_usb_probes() -> list[str]:
133131
# require priviledged permissions to access the device info
134132
macaddr_pattern = r'(?:[0-9a-f]{2}[:]){5}[0-9a-f]{2}'
135133
if platform.system() == 'Windows':
136-
cmd = f'pnputil /enum-devices /connected /class "{NXP_S32DBG_USB_CLASS}"'
137-
serialid_pattern = f'instance id: +usb\\\\.*\\\\({macaddr_pattern})'
134+
cmd = 'pnputil /enum-devices /connected'
135+
serialid_pattern = 'instance id: +usb\\\\' \
136+
f'VID_{NXP_S32DBG_USB_VID:04X}&PID_{NXP_S32DBG_USB_PID:04X}\\\\' \
137+
f'({macaddr_pattern})'.lower()
138138
else:
139139
cmd = f'lsusb -v -d {NXP_S32DBG_USB_VID:x}:{NXP_S32DBG_USB_PID:x}'
140140
serialid_pattern = f'iserial +.*({macaddr_pattern})'
@@ -192,10 +192,11 @@ def runtime_environment(self) -> dict[str, str] | None:
192192
"""Execution environment used for the client process."""
193193
if platform.system() == 'Windows':
194194
python_lib = (self.s32ds_path / 'S32DS' / 'build_tools' / 'msys32'
195-
/ 'mingw32' / 'lib' / 'python2.7')
195+
/ 'mingw64' / 'lib' / 'python3.10')
196196
return {
197197
**os.environ,
198-
'PYTHONPATH': f'{python_lib}{os.pathsep}{python_lib / "site-packages"}'
198+
'PYTHONPATH': f'{python_lib}{os.pathsep}{python_lib / "site-packages"}{os.pathsep}'
199+
f'{python_lib / "lib-dynload"}'
199200
}
200201

201202
return None

scripts/west_commands/tests/test_nxp_s32dbg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 NXP
1+
# Copyright 2023, 2025 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

44
import argparse
@@ -27,9 +27,10 @@
2727
TEST_SERVER_CMD = Path('S32DS') / 'tools' / 'S32Debugger' / 'Debugger' / 'Server' / 'gta' / 'gta'
2828
TEST_ARM_GDB_CMD = Path('S32DS') / 'tools' / 'gdb-arm' / 'arm32-eabi' / 'bin' / 'arm-none-eabi-gdb-py'
2929

30-
TEST_S32DS_PYTHON_LIB = Path('S32DS') / 'build_tools' / 'msys32' / 'mingw32' / 'lib' / 'python2.7'
30+
TEST_S32DS_PYTHON_LIB = Path('S32DS') / 'build_tools' / 'msys32' / 'mingw64' / 'lib' / 'python3.10'
3131
TEST_S32DS_RUNTIME_ENV = {
32-
'PYTHONPATH': f'{TEST_S32DS_PYTHON_LIB}{os.pathsep}{TEST_S32DS_PYTHON_LIB / "site-packages"}'
32+
'PYTHONPATH': f'{TEST_S32DS_PYTHON_LIB}{os.pathsep}{TEST_S32DS_PYTHON_LIB / "site-packages"}{os.pathsep}'
33+
f'{TEST_S32DS_PYTHON_LIB / "lib-dynload"}'
3334
}
3435

3536
TEST_ALL_KWARGS = {

0 commit comments

Comments
 (0)