pyocd / pyocd/pyOCD

PDSC `/package/devices/family/.../debug` parsing logic dropping common attributes

Open
#1,796 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Consider the following partial device element:

<device Dname="SNC733xx">
	<debug svd="SVD\SN_M3B.svd"/>
	<debug Pname= "CORE0" __ap= "0" defaultResetSequence="ResetProcessor"/>
	<debug Pname= "CORE1" __ap= "1" defaultResetSequence="ResetProcessor"/>
</device>

In CmsisPackDescription._extract_debugs, when an element with a Pname is discovered, the map is cleared if an element with no Pname was previously encountered (and labeled as *). This causes the initial element specifying the svd attribute to be removed, and there is no logic to inherit attributes from an unlabeled debug element. The same logic may also cause any debug element specified before the unlabeled element to be removed.

While the pack description format (from Open-CMSIS-Pack Version 1.7.51) specifies for the Pname attribute that "This attribute must be set if defining multiple debug elements within the same section", I ran the PDSC through packChk, and while there were other errors, there was no mention about unlabeled debug elements. The description for the debug element specifies "Multiple debug elements can be defined which are either specific to a processor identified by attribute Pname, or which apply to all connections", which suggests that a mix of debug elements with and without Pname is allowed.

The end result in this case was the SVD file cannot be located as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at CmsisPackDescription._extract_debugs and reproduce the issue with the partial PDSC XML shown in the report. Trace how unlabeled and Pname-specific debug elements are stored, then verify that the mixed elements retain the SVD path while preserving processor-specific attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.