mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Automatically detect BlackMagic probe GDB port
This commit is contained in:
@ -116,20 +116,23 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
|||||||
]
|
]
|
||||||
if any([isfile(p) for p in mbed_pages]):
|
if any([isfile(p) for p in mbed_pages]):
|
||||||
return item['disk']
|
return item['disk']
|
||||||
if (item['name']
|
if item['name'] \
|
||||||
and any([l in item['name'].lower() for l in msdlabels])):
|
and any([l in item['name'].lower() for l in msdlabels]):
|
||||||
return item['disk']
|
return item['disk']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _look_for_serial_port():
|
def _look_for_serial_port():
|
||||||
port = None
|
port = None
|
||||||
board_hwids = []
|
board_hwids = []
|
||||||
|
upload_protocol = env.subst("$UPLOAD_PROTOCOL")
|
||||||
if "BOARD" in env and "build.hwids" in env.BoardConfig():
|
if "BOARD" in env and "build.hwids" in env.BoardConfig():
|
||||||
board_hwids = env.BoardConfig().get("build.hwids")
|
board_hwids = env.BoardConfig().get("build.hwids")
|
||||||
for item in util.get_serialports(filter_hwid=True):
|
for item in util.get_serialports(filter_hwid=True):
|
||||||
if not _is_match_pattern(item['port']):
|
if not _is_match_pattern(item['port']):
|
||||||
continue
|
continue
|
||||||
port = item['port']
|
port = item['port']
|
||||||
|
if upload_protocol.startswith("blackmagic") and "GDB" in port:
|
||||||
|
return port
|
||||||
for hwid in board_hwids:
|
for hwid in board_hwids:
|
||||||
hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "")
|
hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "")
|
||||||
if hwid_str in item['hwid']:
|
if hwid_str in item['hwid']:
|
||||||
@ -140,7 +143,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
|||||||
print env.subst("Use manually specified: $UPLOAD_PORT")
|
print env.subst("Use manually specified: $UPLOAD_PORT")
|
||||||
return
|
return
|
||||||
|
|
||||||
if "mbed" in env.subst("$PIOFRAMEWORK"):
|
if "mbed" in env.subst("$PIOFRAMEWORK") \
|
||||||
|
and not env.subst("$UPLOAD_PROTOCOL"):
|
||||||
env.Replace(UPLOAD_PORT=_look_for_mbed_disk())
|
env.Replace(UPLOAD_PORT=_look_for_mbed_disk())
|
||||||
else:
|
else:
|
||||||
if (system() == "Linux" and not any([
|
if (system() == "Linux" and not any([
|
||||||
|
@ -512,8 +512,8 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
|||||||
config = PlatformBoardConfig(manifest_path)
|
config = PlatformBoardConfig(manifest_path)
|
||||||
if "platform" in config and config.get("platform") != self.name:
|
if "platform" in config and config.get("platform") != self.name:
|
||||||
return
|
return
|
||||||
elif ("platforms" in config
|
elif "platforms" in config \
|
||||||
and self.name not in config.get("platforms")):
|
and self.name not in config.get("platforms"):
|
||||||
return
|
return
|
||||||
config.manifest['platform'] = self.name
|
config.manifest['platform'] = self.name
|
||||||
self._BOARDS_CACHE[board_id] = config
|
self._BOARDS_CACHE[board_id] = config
|
||||||
|
Reference in New Issue
Block a user