-
Notifications
You must be signed in to change notification settings - Fork 244
[scripts/makehtml] Fix displaying of registers with the same addressOffset and parsing of addressOffset #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[scripts/makehtml] Fix displaying of registers with the same addressOffset and parsing of addressOffset #591
Conversation
Note about the memory map comparison: |
…ffset and parsing of addressOffset
Co-authored-by: Adam Greig <adam@adamgreig.com>
9a12c78
to
2064371
Compare
scripts/makehtml.py
Outdated
@@ -146,7 +146,7 @@ def parse_device(svdfile): | |||
# Bodge to prevent /0 when there are no fields in a register | |||
if register_fields_total == 0: | |||
register_fields_total = 1 | |||
registers[roffset] = {"name": rname, | |||
registers[rname] = {"name": rname, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registers[rname] = {"name": rname, | |
registers[(roffset, rname)] = {"name": rname, |
I had to check to remember what this is used for, but it's inside makehtml.template.html
, where the registers are iterated over by sorted key order, so previously they were in register-offset order but now they'd be in register-alphabetical order. If we make this key (offset, name), we preserve the sort order but allow the overlapping registers to still appear.
I think it would be good to also change makehtml.template.html
L121 to something like {% for _, register in peripheral.registers|dictsort %}
(changing roffset
to _
) to make it clear that the key isn't used later, since it's now a tuple.
Finally the indentation of the fields below needs updating since this line changes length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I thought registers were inserted by their roffset already, but I missed the sorting function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
bors merge
This pull request fix two bugs in the
makehtml.py
script:The first bug is fixed by checking if the addressOffset starts with
0x
to parse from base16, or parse from base10 by default (when a register is generated from a patch).The second bug is fixed by changing the index used for the list of registers from the addressOffset to the register name.