rust-embedded / rust-embedded/svd2rust

Build Errors in Code Generated from Renesas RA6M3 SVD

Open
#852 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
857
Forks
164
PR merge metrics
No merged PRs in 30d

Description

Hello, I am seeing many errors when attempting to build a PAC from a Renesas RA6M3 SVD file. I've already fixed some errors that I found in the Renesas provided file. I've attached the modified file below.

R7FA6M3AH.svd.txt

Here is a sample of the errors that I'm seeing:

Error E0412

error[E0412]: cannot find type `P40pfs` in this scope
    --> src\pfs.rs:68:15
     |
68   |     p400pfs: [P40pfs; 10],
     |               ^^^^^^ help: a type alias with a similar name exists: `P400pfs`
...
2702 | pub type P100pfs = crate::Reg<p100pfs::P100pfsSpec>;
     | ---------------------------------------------------- similarly named type alias `P400pfs` defined here

Error E0592

error[E0592]: duplicate definitions with name `offset`
   --> src\generic.rs:223:5
    |
223 |     pub const fn offset(&self) -> u8 {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `offset`
    |
   ::: src\glcdc\tcon_tim.rs:28:5
    |
28  |     pub fn offset(self) -> &'a mut crate::W<REG> {
    |     -------------------------------------------- other definition for `offset`

Error E0599

error[E0599]: the method `variant` exists for struct `FieldWriter<'a, REG, 11, Fh, Safe>`, but its trait bounds were not satisfied
   --> src\glcdc\bg_peri.rs:29:14
    |
7   | pub struct Fh(u16);
    | ------------- doesn't satisfy `Fh: generic::IsEnum`
...
29  |         self.variant(Fh::Fh)
    |              ^^^^^^^ method cannot be called on `FieldWriter<'a, REG, 11, Fh, Safe>` due to unsatisfied trait bounds
    |
   ::: src\generic\raw.rs:44:1
    |
44  | pub struct FieldWriter<'a, REG, const WI: u8, FI = u8, Safety = Unsafe>
    | ----------------------------------------------------------------------- method `variant` not found for this struct
    |
note: trait bound `Fh: generic::IsEnum` was not satisfied
   --> src\generic.rs:312:9
    |
309 | impl<'a, REG, const WI: u8, FI, Safety> FieldWriter<'a, REG, WI, FI, Safety>
    |                                         ------------------------------------
...
312 |     FI: IsEnum,
    |         ^^^^^^ unsatisfied trait bound introduced here
note: the trait `generic::IsEnum` must be implemented
   --> src\generic.rs:54:1
    |
54  | pub trait IsEnum: FieldSpec {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here is the full log:
cargo_check.txt

I've tested this SVD file with several versions of svd2rust. I found that version 0.30.x works without error, but I begin to have trouble starting with version 0.31.x and up. These error logs are from the latest tagged version, v 0.33.4.

Here is my PAC that I'm working on:
ra6m3-pac.zip

Please let me know if I can offer up any more detail or assist with debugging. Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing cargo check with R7FA6M3AH.svd.txt and ra6m3-pac.zip, comparing svd2rust 0.30.x with v0.33.4. Inspect the reported generated files src/pfs.rs, generic.rs, glcdc/tcon_tim.rs, glcdc/bg_peri.rs, and generic/raw.rs alongside cargo_check.txt. Done means the PAC generated from this SVD builds without the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.