-
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
Fix parsing of nested register groups #4
Comments
I've pushed commit 59bf4b3 ("peripheral: Make sure child nodes have the correct name") to at least make files affected by this generate SVD output for all the other stuff. |
I wanted to tackle that one. However, it does not seem to be that simple (not the implementation, but the way how to handle it). On the attiny412 the
How should those two groups - the register in the above case have per coincidence the same meaning (others don't) - involving the same register addresses (but with different meaning) be combined? Or shouldn't they be combined (which in my opinion would violate the ownership/soundness of the generated code)? |
If the register have the same name in both cases, we could just add redundant bitfields with different meanings. But I'm not 100% sure if the register always have the same name. |
In the attached files are all occurrences of the nested register-groups. For all MCUs of the newer generation (except ATxmega), its only the TCA making problems. For the ATxmega also other peripherals have nested groups. |
@trembel is there anything I can do to assist in this? I'm trying to add support for the ATtiny1607. |
First it must be decided how to handle it. |
Just to make sure we're all on the same page: This "feature" is not a blocker for supporting the devices; any peripheral that is not using nested register-groups will work fine with the current |
In the c header files, modes are modelled as a union of structs: /* 16-bit Timer/Counter Type A - Single Mode */
typedef struct TCA_SINGLE_struct
{
register8_t CTRLA; /* Control A */
...
} TCA_SINGLE_t;
/* 16-bit Timer/Counter Type A - Split Mode */
typedef struct TCA_SPLIT_struct
{
register8_t CTRLA; /* Control A */
...
} TCA_SPLIT_t;
/* 16-bit Timer/Counter Type A */
typedef union TCA_union
{
TCA_SINGLE_t SINGLE; /* 16-bit Timer/Counter Type A - Single Mode */
TCA_SPLIT_t SPLIT; /* 16-bit Timer/Counter Type A - Split Mode */
} TCA_t; Nested register-groups are modelled as structs of structs: /* DMA Channel */
typedef struct DMA_CH_struct
{
register8_t CTRLA; /* Channel Control */
register8_t CTRLB; /* Channel Control */
register8_t ADDRCTRL; /* Address Control */
...
} DMA_CH_t;
/*
--------------------------------------------------------------------------
DMA - DMA Controller
--------------------------------------------------------------------------
*/
/* DMA Controller */
typedef struct DMA_struct
{
register8_t CTRL; /* Control */
...
DMA_CH_t CH0; /* DMA Channel 0 */
DMA_CH_t CH1; /* DMA Channel 1 */
DMA_CH_t CH2; /* DMA Channel 2 */
DMA_CH_t CH3; /* DMA Channel 3 */
} DMA_t; |
Example:
ATxmega128A1
Some ATDF files contain nested
<register-group />
elements, for example:These register groups are defined right next to this one, in the same
<module>
:The parser needs to expand those sub-register groups into registers in the peripheral, probably by appending the names. E.g. the above example would create a
CH0_CTRLA
register.The text was updated successfully, but these errors were encountered: