-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add patch to remove prefixes from register names #33
Conversation
2137604
to
f43d742
Compare
In general, I personally think it is best to keep the original names as much as possible so they can be easily referenced in the datasheet. But I don't know what MCUs you're dealing with so the situation might be different for you.
I think this is the best approach. This way I can keep it disabled for our builds but people like you can opt-in to this behavior where needed. |
See 17cf656. Added a |
8f4b281
to
7155ea7
Compare
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.
Thanks! Now I got around to looking at the actual patch implementation in more detail as well. I have two more comments but overall I am fine with the change.
One more thing: What ATDF files are you testing against? If I can download them as well, I can incorporate them into my own testing in the future. This will help to make sure your files also don't get regressed by other changes.
It would be especially interesting when (if) I get around to adding a proper regression test-suite here...
SAMA5D2's ATDF files:
|
* Adds a --auto-patches command line flag
7155ea7
to
573d2d9
Compare
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.
Thanks!
This is just a proof of concept, remove prefixes from register names on each peripheral.
For example on ADC when there is a list of registers named
ADC_<name>
it will remove theADC_
part leaving<name>
.I've thought of using the peripheral name as a guess but on the ATDF file I'm converting the FLEXCOM peripherals have registers named
FLEX_<>
so it wasn't possible, so I opted to find the longest matching common prefix on the registers name that ended with an underscore.This could be under a command line flag if it causes problems on other ATDF files, for example it can also mistakenly remove prefixes that should probably not be removed (e.g.: a set of registers that are
CH_CR
,CH_SR
, etc.), haven't found something like that though.