Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trunner: add multi possible device search for targets #376

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maska989
Copy link
Contributor

@maska989 maska989 commented Oct 4, 2024

JIRA: CI-500

Description

In replace target to new version, there was problem with new device ID and vendor ID.
That means we are forced to replace it in target variables, but we want also have the possibility to run older versions of the boards. That's why we want to utilize multiple possible vid/pid configuration to the same target.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: armv7m7-imxrt117x-evk.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

Copy link

github-actions bot commented Oct 4, 2024

Unit Test Results

7 725 tests  ±0   7 010 ✅ ±0   38m 44s ⏱️ + 3m 24s
  445 suites ±0     715 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 8efe664. ± Comparison against base commit c3b2ba6.

♻️ This comment has been updated with latest results.

trunner/target/armv7m4.py Outdated Show resolved Hide resolved
Comment on lines +29 to +36
all_ports = list_ports.comports()
vid_pid_list = vid_pid_parser(port_hint)
ports = []

for port in all_ports:
for vid, pid in vid_pid_list:
if port.vid == vid and port.pid == pid:
ports.append(port)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
all_ports = list_ports.comports()
vid_pid_list = vid_pid_parser(port_hint)
ports = []
for port in all_ports:
for vid, pid in vid_pid_list:
if port.vid == vid and port.pid == pid:
ports.append(port)
vid_pid_list = vid_pid_parser(port_hint)
ports = [port for port in list_ports.comports() if (port.vid, port.pid) in vid_pid_list]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be simple, so I'd prefer to use this version

def find_port(port_hint: str) -> str:
port = None

for p in list_ports.grep(port_hint):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some thinking, we can simply pass a part of port name, which is correct for both older and newer board. For older the device string from list_ports() is:

/dev/ttyACM0 - DAPLink CMSIS-DAP - mbed Serial Port

for newer one:

/dev/ttyACM0 - MCU-LINK on-board (r0E2) CMSIS-DAP V2.250 - VCOM

So I propose looking for CMSIS-DAP for armv7m7 targets. Then all this additional code is not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants