Skip to content
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

nrf51.svd device_description quotes and also %s unevaluated #2

Open
markfirmware opened this issue Feb 29, 2020 · 10 comments
Open

nrf51.svd device_description quotes and also %s unevaluated #2

markfirmware opened this issue Feb 29, 2020 · 10 comments

Comments

@markfirmware
Copy link
Contributor

  1. device_description needs quotes?

  2. 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.*;
}

...
@markfirmware markfirmware changed the title device_description quotes and also %s unevaluated nRF51.svd device_description quotes and also %s unevaluated Feb 29, 2020
@markfirmware markfirmware changed the title nRF51.svd device_description quotes and also %s unevaluated nrf51.svd device_description quotes and also %s unevaluated Feb 29, 2020
@justinbalexander
Copy link
Owner

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.

1 similar comment
@justinbalexander
Copy link
Owner

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.

@markfirmware
Copy link
Contributor Author

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.

@justinbalexander
Copy link
Owner

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.

@markfirmware
Copy link
Contributor Author

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.

@markfirmware
Copy link
Contributor Author

markfirmware commented Mar 10, 2020

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.

@justinbalexander
Copy link
Owner

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.

@markfirmware
Copy link
Contributor Author

I read some of cm7.zig. Have you defined all the cm7 registers already?

@justinbalexander
Copy link
Owner

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.

@markfirmware
Copy link
Contributor Author

Ok, I have an atsame70-xpld and I think I’ll see what it takes to blink its led.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants