svd2zig
svd2zig copied to clipboard
nrf51.svd device_description quotes and also %s unevaluated
-
device_description needs quotes?
-
there are unevaluated %s expressions
Can you advise on next steps?
Thanks, Mark
pub const device_name = nrf51;
pub const device_revision = 522;
pub const device_description = nRF51 reference description for radio MCU with ARM 32-bit Cortex-M0 Microcontroller at 16MHz CPU clock;
...
/// Device address base segment.
pub const RADIO_DAB[%s]_Address = 0x40001000 + 0x600;
pub const RADIO_DAB[%s]_Reset_Value = 0x0;
pub inline fn RADIO_DAB[%s]_Read() u32 {
const mmio_ptr = @intToPtr(*volatile u32, RADIO_DAB[%s]_Address);
return mmio_ptr.*;
}
...
Hey Mark, the missing quotes is obviously wrong and will be a quick fix so I'll look at that today.
The %s thing must be a missing syntax that is not being translated currently and would be a larger fix so I won't be able to get to it quickly due to obligations in my normal life.
I wrote this repo to translate the file I needed and also just to get some Zig code under my belt. In the posborne repo they have some python that parses every svd file they claim. Adding to those to print out the zig you want will probably be a faster route for your project. Thank you for the bug reports and I will be improving this over time but it will be at a slow pace most likely.
Hey Mark, the missing quotes is obviously wrong and will be a quick fix so I'll look at that today.
The %s thing must be a missing syntax that is not being translated currently and would be a larger fix so I won't be able to get to it quickly due to obligations in my normal life.
I wrote this repo to translate the file I needed and also just to get some Zig code under my belt. In the posborne repo they have some python that parses every svd file they claim. Adding to those to print out the zig you want will probably be a faster route for your project. Thank you for the bug reports and I will be improving this over time but it will be at a slow pace most likely.
Your update fixed the device_description - thanks.
I see that the %s comes from data such as
<name>CONFIG[%s]</name>
and I can look at that myself next week.
I think it might be more efficient to write a python script that takes advantage of the posborne svd file parser. I haven't confirmed how correct it is, but it will be a lot of work to get the Zig one fully up to speed. Of course, once it's up to speed, it will be cool to incorporate it into the package manager.
I think it might be more efficient to write a python script that takes advantage of the posborne svd file parser. I haven't confirmed how correct it is, but it will be a lot of work to get the Zig one fully up to speed. Of course, once it's up to speed, it will be cool to incorporate it into the package manager.
Noted.
May I ask what reference manual you are using for your design? I am using https://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf for the microbit.
My burnedhead project is using an STM32F767ZG so there are a lot of documents on the STM website. There's a reference manual, programming manual (for the CPU), etc. I'm also directly pulling from the armv7m architecture reference manual.
I'd love your help on my cmsis-like repo where I'm remaking much of the CMSIS functionality in zig. Look for zig-cortex in my repos. I'm working on the cortex-m7 part since that is the part I'm using first.
I read some of cm7.zig. Have you defined all the cm7 registers already?
I wasn't planning on defining them all at this point. It seems to me like the main use for CMSIS is the functions. I'm not planning on doing an exact reproduction of CMSIS, but rather to make useful common functionality to cortex processors available in idiomatic Zig. CMSIS is an inspiration but it will be divergent.
Ok, I have an atsame70-xpld and I think I’ll see what it takes to blink its led.