You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix TypeError where address_offset and base_address are treated as strings
This happened for example for the rp2040 pac:
```
$ svd patch svd/rp2040.yaml
Traceback (most recent call last):
File "/home/jan/.local/bin/svd", line 10, in <module>
sys.exit(svdtools_cli())
File "/home/jan/.local/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/jan/.local/lib/python3.7/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/jan/.local/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/jan/.local/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/jan/.local/lib/python3.7/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/jan/.local/lib/python3.7/site-packages/svdtools/cli.py", line 16, in patch
svdtools.patch.main(yaml_file)
File "/home/jan/.local/lib/python3.7/site-packages/svdtools/patch.py", line 1639, in main
process_device(svd, root)
File "/home/jan/.local/lib/python3.7/site-packages/svdtools/patch.py", line 1616, in process_device
d.process_peripheral(periphspec, device[periphspec], update_fields)
File "/home/jan/.local/lib/python3.7/site-packages/svdtools/patch.py", line 717, in process_peripheral
p.derive_register(rname, rderive)
File "/home/jan/.local/lib/python3.7/site-packages/svdtools/patch.py", line 865, in derive_register
ET.SubElement(rtag, "addressOffset").text = address_offset
File "src/lxml/etree.pyx", line 1041, in lxml.etree._Element.text.__set__
File "src/lxml/apihelpers.pxi", line 748, in lxml.etree._setNodeText
File "src/lxml/apihelpers.pxi", line 736, in lxml.etree._createTextNode
File "src/lxml/apihelpers.pxi", line 1539, in lxml.etree._utf8
TypeError: Argument must be bytes or unicode, got 'int'
```
To fix that error, convert the addresses to hex strings explicitly.
0 commit comments