SVD file for E310-G000


(David Craven) #1

Hi,

I’m looking for a SVD file to generate Rust bindings for E310-G000 (I’ve become fed up with hand writing them :slight_smile:. Before writing one myself I thought I’d ask if someone has already written one. Any other equivalent format that can be converted to SVD would also be good…

Also I think I found two documentation bugs:

// NOTE: Sifive docs put plic.target_en[15871] at 0x0C1E_FF80
assert_eq!(address(&plic.target_en[15871]), 0x0C1F_1F80);

pwm0cmp0 interrupt is 40 according to documentation and pwm0cmp3 is 44, I think there is an off by one error somewhere.

Thanks!
David


(Liviu Ionescu) #2

I also planned to prepare a SVD file for E310, to be used by the GNU MCU Eclipse debug plug-ins to display the peripherals.


(Megan A. Wachs) #3

Thanks David:

pwm0cmp0 interrupt is 40 according to documentation and pwm0cmp3 is 44, I think there is an off by one error somewhere.

You’re right, there is an off by one. It should be:

#define INT_PWM0_BASE 40
#define INT_PWM1_BASE 44
#define INT_PWM2_BASE 48

We will correct the docs.

// NOTE: Sifive docs put plic.target_en[15871] at 0x0C1E_FF80
assert_eq!(address(&plic.target_en[15871]), 0x0C1F_1F80);

I don’t follow, what code / docs are you quoting here?


(David Craven) #4

Looks like I was looking at an outdated version of the E31 Coreplex manual… Sorry for wasting your time.


(Laurent GUERBY) #5

Fabien Chouteau from AdaCore wrote some SVD for the E310 as part of the Ada toolchain port:

http://blog.adacore.com/ada-on-the-first-risc-v-microcontroller


(David Craven) #6

Thanks for the link, saved me some time with the GPIO registers. I’m thinking we need a new format based on JSON that is less verbose (i.e describing backup registers or pmu memory registers as an array), allows describing CSR’s, is composable (allows including external files) and is easily convertible to SVD. For now I’ll just bite the bullet…


(David Craven) #7

Here’s my work in progress svd file. Some PLIC registers and OTP registers are missing and some fields are missing enumerated values.


(Liviu Ionescu) #8

The projects generated by the latest GNU MCU Eclipse SiFive1 C/C++ project template include a package that fully defines the current SiFive devices, including the FE310-G000.

The peripheral definitions are in a new format called XSVD, based on JSON.

https://github.com/micro-os-plus/sifive-devices-xpack/tree/xpack/xsvd

These JSON files were already used to generate the device-peripherals.h files for all SiFive devices; for example the FE310 file is:

https://github.com/micro-os-plus/sifive-devices-xpack/blob/xpack/include/sifive-devices/fe310/device-peripherals.h

The specs for this new format are obviously inspired by ARM SVD, but adapted to the more modern JSON format.

https://xpack.github.io/xsvd/files/xsvd-json/

The next version of GNU MCU Eclipse will fully support the XSVD format in the debug plug-ins to populate the Peripheral Views.


(Liviu Ionescu) #9

Hi @dvc, please see the XSVD specs.