You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the following command inside tools/regz:
zig build run -- --format atdf ../../port/microchip/avr/src/chips/ATmega328P.atdf
The end of the generated file looks like this:
/// USART Control and Status Register CUCSR0C: mmio.Mmio(packedstruct(u8) {
/// Clock PolarityUCPOL0: u1,
/// Character Size - together with UCSZ2 in UCSR0BUCSZ0: u2,
padding: u5,
}),
Expected output
Whereas I believe it should be:
/// USART Control and Status Register CUCSR0C: mmio.Mmio(packedstruct(u8) {
/// Clock PolarityUCPOL0: u1,
/// Character Size - together with UCSZ2 in UCSR0BUCSZ0: u2,
/// Stop Bit SelectUSBS0: COMM_STOP_BIT_SEL,
/// Parity Mode BitsUPM0: COMM_UPM_PARITY_MODE,
/// USART Mode SelectUMSEL0: COMM_USART_MODE_2BIT,
}),
Note that the padding is replaced by enums.
The enum cannot be found because the register-group has a different struct-id than the enum (due to having a different name).
Possible workarounds / fixes
change the name of the register-group to match the name of the module (drop the 0)
Reproducible example
When running the following command inside
tools/regz
:The end of the generated file looks like this:
Expected output
Whereas I believe it should be:
Note that the
padding
is replaced by enums.The enum cannot be found because the register-group has a different struct-id than the enum (due to having a different name).
Possible workarounds / fixes
change the name of the register-group to match the name of the module (drop the 0)
microzig/port/microchip/avr/src/chips/ATmega328P.atdf
Line 551 in ce28cf3
It works because the following line reuses the struct-id
microzig/tools/regz/src/atdf.zig
Line 366 in ce28cf3
pass
parent_struct_id
in the "child" caseChanging
microzig/tools/regz/src/atdf.zig
Line 481 in ce28cf3
to
works as well (but breaks the tests)
Since I just got started with microzig, I have no Idea what the proper solution should be and would appreciate any pointers!
The text was updated successfully, but these errors were encountered: