Skip to content

Load vendor SVD files with whitespace before the XML declaration - #2094

Open
Solarboaters wants to merge 1 commit into
pyocd:developfrom
Solarboaters:fix/svd-leading-whitespace
Open

Solarboaters wants to merge 1 commit into
pyocd:developfrom
Solarboaters:fix/svd-leading-whitespace

Conversation

@Solarboaters

Copy link
Copy Markdown

GigaDevice.GD32F30x_DFP.2.2.1.pack has two spaces before the XML declaration in all three SVD files. They currently raise ParseError: XML or text declaration not at start of entity, leaving register descriptions unavailable.

Remove only XML whitespace immediately preceding an XML declaration. Preserve the declaration/encoding, document contents and caller-owned streams; other malformed XML still raises. This addresses the SVD-loading failure in #1887 (also reported in #1181), not the separate unknown-board-ID warning.

Validation on Linux/Python 3.12:

  • Regression tests: original 8 failed / 11 passed, fixed 19 passed, covering file paths, binary/text streams, pack members, BOM/UTF-16 and malformed XML.
  • Unmodified vendor pack: all three files fail before; after, CL/HD/XD load 62/54/48 peripherals and 1026/811/731 registers.
  • Full unit suite: 1125 passed, 41 skipped; critical lint and whitespace checks pass.

No physical probe/board or native Windows validation. AI-assisted implementation and validation.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

This branch has not been deployed

No deployments
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.

1 participant