Open-CMSIS-Pack / svd-spec

CMSIS-SVD Specification
https://open-cmsis-pack.github.io/svd-spec/main/index.html
Apache License 2.0
5 stars 6 forks source link

[Question] Dynamic register offset #12

Open rmsyn opened 5 months ago

rmsyn commented 5 months ago

In some peripherals, a register offset is defined by reading the value of another register at runtime.

For example, the USB XHCI op and run registers:

The structure of the register clusters are static, and it looks like the value for those registers is likely to be static per actual implementation.

Is there a way to define these type of registers in SVD?

Something like leaving the addressOffset empty, and requiring the generated code to supply the offset as a parameter?

Another alternative I guess would be to run code on the board to query the values of the relevant registers, and use the result in the SVD per-implementation.

It may just be that higher-level abstractions (like actual drivers or HALs) are a better place to handle register definitions like those above.