sipeed / bl602-pac

Embedded Rust's Peripheral Access Crate for BL602 microcontrollers
MIT License
19 stars 10 forks source link

Fix peripheral address range overlap in SVD #5

Closed 9names closed 3 years ago

9names commented 3 years ago

A few of the peripherals in the original SVD had the same start address, and a bunch had their size set to 0x1000 regardless of their actual number of registers which caused them to overlap. After adjusting these, SVDConv in validation mode now produces no errors or warnings about addresses, which means we only have to worry about the 2 warnings and 5249 INFO messages remaining (mostly lack of description fields and enumeratedValue tags).

mkroman commented 3 years ago

Oh, very cool - I had no idea such a tool existed. I'll see about adding this to the CI later.

Where did you get the efuse and AON addresses from?

mkroman commented 3 years ago

Oh, also, please keep the first line in git commit messages at most 72 characters - GitHub wraps them when they're longer :stuck_out_tongue_closed_eyes:

9names commented 3 years ago

Oh, very cool - I had no idea such a tool existed.

It's the official tool from ARM for generating C code + headers from SVD files, so I hope it's flagging things correctly

Where did you get the efuse and AON addresses from

Just used the first address that had a register in the SVD. I did not verify in the SDK that these addresses are correct. So for AON, the original start was 0x4000F800, but the first register was at offset 0x800 To fix it, I added 0x800 to start(now 0x40010000), subtract 0x800 from all registers so they start at offset 0x0

Oh, also, please keep the first line in git commit messages at most 72 characters - GitHub wraps them when they're longer

I plan to make this a squash merge with a nice short commit message I'll try to get it right in the future. This is the biggest downside to my addiction to git commit -m :(

username223 commented 3 years ago

Confirmed that values are correctly calculated.

For posterity, the SVDConv tool is located here for Linux and here for Windows. It is IMO very difficult to find.