Skip to content

Commit

Permalink
Populate Device and Pack information from cbuild-run
Browse files Browse the repository at this point in the history
  • Loading branch information
TeoMahnic committed Feb 20, 2025
1 parent 6606edf commit 97a4f24
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyocd/board/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def __init__(self,

# Create target from cbuild-run information.
if cbuild_run and cbuild_run.target:
cbuild_run.populate_target(target)
# cbuild_run.populate_target(target)
pack_target.PackTargets.populate_targets_from_pack(cbuild_run.device_pack)

# Create targets from provided CMSIS pack.
if session.options['pack'] is not None:
Expand Down
14 changes: 14 additions & 0 deletions pyocd/target/pack/cbuild_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import logging
import yaml
import os

from .. import (normalise_target_type_name, TARGET)
from ...coresight.coresight_target import CoreSightTarget
Expand Down Expand Up @@ -52,6 +53,19 @@ def target(self) -> str:
else:
return ''

@property
def device_pack(self) -> list:
"""@brief Device Pack (DFP).
@return Value of 'device-pack'.
"""
if self._valid and ('device-pack' in self._data['cbuild-run']):
vendor, _pack = self._data['cbuild-run']['device-pack'].split('::', 1)
name, version = _pack.split('@', 1)
pack = f"${{CMSIS_PACK_ROOT}}/{vendor}/{name}/{version}"
return [os.path.expandvars(pack)]
else:
return []

def populate_target(self, target: str) -> None:
"""@brief Generates and populates the target defined by the .cbuild-run.yml file.
@param self This object.
Expand Down

0 comments on commit 97a4f24

Please sign in to comment.