svdpatch collect array requires base address as string

Open
#12 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
cli, tooling

Research direction

Start in scripts/svdpatch.py at collect_in_array around line 511, then reproduce the failure with the shown _modify and _array input. Check how addressOffset is parsed before int() is called. Done means numeric base addresses work in the same case while quoted values continue to work.

Written by the indexing model from the issue text.

Description

When running svdpatch against register with modified base address written as number I get the following error:

Traceback (most recent call last):
  File "scripts/svdpatch.py", line 883, in <module>
    main()
  File "scripts/svdpatch.py", line 876, in main
    process_device(svd, root)
  File "scripts/svdpatch.py", line 855, in process_device
    update_fields)
  File "scripts/svdpatch.py", line 400, in process_peripheral
    p.collect_in_array(rspec, rmod)
  File "scripts/svdpatch.py", line 511, in collect_in_array
    int(rtag.findtext('addressOffset'), 0)])
TypeError: int() can't convert non-string with explicit base
Makefile:38: recipe for target 'svd/stm32f427.svd.patched' failed
make: *** [svd/stm32f427.svd.patched] Error 1

Input used to generate this error:

OTG_HS_GLOBAL:
  _modify:
    DIEPTXF3:
      addressOffset: 0x10C
  
  _array:
    DIEPTXF[12345]: {}

If I put the address in quotes like this: addressOffset: 0x10C everything works fine.

Dominant language
Rust
Stars
123
Forks
41
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from rust-embedded/svdtools

All issues in rust-embedded/svdtools

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.