-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes to support missing comments and missing access fields #6
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR, exciting to have more people joining the Zig party =D Can you link to the SVD and chip you ran into problems on? |
I ran into issues with ATSAMD09D14A and ATSAMD51G19A. Note, I've not actually used the generated zig files after these changes. The regex change in enums-by-usage solves (I think) this error on the Microchip SVDs:
The Microchip SVDs also don't have docs on all register enums, which was causing a lot of empty lines in the re-formatted zig files, so I added a check there. Lastly, not all registers have an "access" field on the top level, so generated zig sometimes looked like this:
Where NAME and VALUE were good, but code had "nil" instead of "Register". It also looks like Microchip SVDs sometimes have access entries on individual register fields, but not on the parent register -- right now those field attributes are completely ignored. I'm exited to dive more into Zig on bare metal. If you have any public code which uses this SVD-generated code, I've love to take a look at it -- I think it would help bringup on these SAMD processors I'd like to use. |
Thanks for the context! I'll take a look at those SVDs and see if I can replicate the issue and understand your fixes. Makes sense from what you've described though --- not surprised there are more vendor differences in the SVDs. I haven't done much Zig embedded because of this open compiler bug #5 and because I've been researching some other ideas about how to choose pins and set registers using constraint solvers rather than manually from an imperative programming language (some notes: https://kevinlynagh.com/pinfigurator/). I expect once that's fleshed out I'll revisit Zig. |
Thanks @osterwood for noticing this #6
Thanks @osterwood for noticing this #6
I pushed up some commits fixing the issues you noticed, thanks! Unfortunately the generated Zig isn't quite ready to go yet; the DHCSR register has at bit offset 16 two fields: DBGKEY field (write-only) and S_REGRDY (read-only). svd2zig/generate_registers.clj Line 86 in d51bd94
assumes that a register's fields don't overlap and in this situation generates invalid output (negative "reserved space"). Any thoughts on how we should resolve this? One possibility would be to separate the fields into synthetic read-only and write-only views into the entire register. |
No description provided.