microzig icon indicating copy to clipboard operation
microzig copied to clipboard

Regz Fails To Generate Register Types

Open Bud-ro opened this issue 1 year ago • 1 comments

When generating a Zig header from the SVD found here: https://github.com/adafruit/broadcom-peripherals/blob/main-build/svd/gen/bcm2711_lpa.svd I noticed that it lacks the GPIO and UART1 types.

Another tool, SVDConv, was able to successfully generate both so I believe it's an edge case that regz was unable to handle here.

UPDATE: I have also discovered that it failed to generate:

  • All the Interrupt Number Definitions
  • A large number of registers inside of the ARM GIC-400 Generic Interrupt Controller Distributor (GICD)
    • In this case a huge 3316 byte reserved block is generated, skipping from GICD_IIDR directly to GICD_PPISR. Everything in this range is either reserved or a subtype of related register. I'd expect for these subtypes to be correctly generated.
  • I'm sure there are others I missed, I will update as I find more

Commit Tested On: cca83d508e6ea7f024ac95fb74980ff04cfbf554 OS: Windows 10 Version: Zig 0.13.0

Bud-ro avatar Dec 11 '24 00:12 Bud-ro

I had some time and made quick test using that file. I checked only UART1 and found line that is causing issue because of which entrire UART1 section is ignored:

<enumeratedValues derivedFrom="UART1.CNTL.CTS_ASSERT.ASSERT_LEVEL"></enumeratedValues>

When I remove this line I am able to get UART1 in output zig file. I think same line is causing problems for other missing sections or maybe all of them as <enumeratedValues derivedFrom ... is used quite extensively in that file.

CC: @mattnite

EDIT:

I think it might be related to this line in regz: https://github.com/ZigEmbeddedGroup/microzig/blob/da30fd04c161106843c3a5448dead53809c6042a/tools/regz/src/svd.zig#L505

arkadiuszwojcik avatar Dec 18 '24 19:12 arkadiuszwojcik