`xml.etree.ElementTree.ParseError: XML or text declaration not at start of entity: line 1, column 2` while resetting `gd32f470zg`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 560
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 3
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce pyocd reset --target gd32f470zg in the reported environment, then inspect pyocd/debug/svd/loader.py and pyocd/debug/svd/parser.py around the SVD load and XML parse shown in the traceback. Identify which SVD file is selected for gd32f470zg and verify its XML declaration; done means resetting this target no longer crashes with the reported ParseError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools, embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100