pyOCD icon indicating copy to clipboard operation
pyOCD copied to clipboard

`xml.etree.ElementTree.ParseError: XML or text declaration not at start of entity: line 1, column 2` while resetting `gd32f470zg`

Open WangYihang opened this issue 6 months ago • 1 comments

Description

pyocd crashes while using the following command to reset a GD32F470ZG chip.

Command

# pyocd reset --target gd32f470zg
0000498 W Board ID 5V-I is not recognized [mbed_board]
Exception in thread load-svd:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/root/.local/share/pipx/venvs/pyocd/lib/python3.9/site-packages/pyocd/debug/svd/loader.py", line 72, in run
    self._svd_location.load()
  File "/root/.local/share/pipx/venvs/pyocd/lib/python3.9/site-packages/pyocd/debug/svd/loader.py", line 48, in load
    self.device = SVDParser.for_xml_file(self.filename).get_device()
  File "/root/.local/share/pipx/venvs/pyocd/lib/python3.9/site-packages/pyocd/debug/svd/parser.py", line 74, in for_xml_file
    return cls(ET.parse(path), remove_reserved)
  File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1229, in parse
    tree.parse(source, parser)
  File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: XML or text declaration not at start of entity: line 1, column 2
0000848 W Invalid coresight component, cidr=0x0 [rom_table]

Environments

# uname -a
Linux pve 5.15.116-1-pve #1 SMP PVE 5.15.116-1 (2023-08-29T13:46Z) x86_64 GNU/Linux

# pyocd --version
0.36.0

WangYihang avatar Dec 21 '23 12:12 WangYihang

try to this

During the use of the script, an XML or text declaration not at start of entity error message will be reported, as \ cmsis pack manager \ cmsis pack manager \ GigaDevice \ GD32F4xx_ There is an issue with the XML format in the DFP \ 3.0.3. pack file, which contains an extra space; The solution is to open 3.0.3. pack in the format of a compressed file and rename the file with the suffix. svd in the SVD folder as<? XML version="1.0" encoding="utf-8" standalone="no" Remove the preceding space

USTHzhanglu avatar Jan 03 '24 02:01 USTHzhanglu