sipeed / bl602-pac

Embedded Rust's Peripheral Access Crate for BL602 microcontrollers
MIT License
19 stars 9 forks source link

Add reset values and access modifiers from the SDK #6

Closed username223 closed 3 years ago

username223 commented 3 years ago

This PR adds reset values and access modifiers directly from the SDK.

The struct fields (specific structs in each commit) parsed looked like

Unused      Name                       Width   LSB/MSB      Access       Reset value
V           V                          V         V           V           V
uint32_t field_name                 :  1; /* [   16],        r/w,        0x0 */

There are some fields with access values as w1c and w1p, although I do not know how to represent this in the SVD so they have not been included. In the future those modifiers should also be added.

username223 commented 3 years ago

I've rechecked every value and came up with some misapplied reset values and access modifiers, as well as some registers in GLB that I missed because I assumed that I had done them in PR #4.

The se_trng_0_rosc_en register is called se_trng_0_rosc_dis in the SDK, at the same bit position and in the same register. The name has been changed and a note has been added in the description.

username223 commented 3 years ago

Fixed merge conflict from PR https://github.com/sipeed/bl602-pac/pull/5.

username223 commented 3 years ago

Build fails due to warnings

*** WARNING M223: soc602_reg.svd (Line 2) 
  Input File Name 'soc602_reg' does not match the tag <name> in the <device> section: 'BL602'

*** WARNING M209: soc602_reg.svd
  CPU section not set. This is required for CMSIS Headerfile generation and debug support.

Found 0 Error(s) and 2 Warning(s).

Error: Process completed with exit code 1.

Until these are fixed the return code of SVDConv should be ignored.

9names commented 3 years ago

Ignoring the return code from program using GHA is painful. I'm going to remove the execution of SVDConv from the workflow for now, and put it in a script or something later so that's easier to test locally

username223 commented 3 years ago

Couldn't you do something like

#! /usr/bin/env bash
./SVDConv soc602_reg.svd
if [ $? == 1 ]; then
    exit 0
fi

Since return code 0 is nothing, 1 is warning and 2 is error, only capturing 1 will still fail on errors.

9names commented 3 years ago

Yep, that's exactly what we need to do

username223 commented 3 years ago

Ah, I see what you meant in your original comment now, Github Actions is indeed a little annoying to use at times.

username223 commented 3 years ago

Corrected duplicated resetValues to resetMasks as was originally intended.