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

cannot find type CRRCR in module rcc #32

Closed
hellow554 opened this issue Feb 1, 2019 · 25 comments
Closed

cannot find type CRRCR in module rcc #32

hellow554 opened this issue Feb 1, 2019 · 25 comments

Comments

@hellow554
Copy link
Contributor

src/main.rs

use stm32l4::stm32l4x6;

fn main() {
}

Cargo.toml

[dependencies.stm32l4xx-hal]
git = "https://github.com/stm32-rs/stm32l4xx-hal.git"
#version = "0.3.5"
features = ["rt", "stm32l4x6"]
error[E0412]: cannot find type `CRRCR` in module `rcc`
   --> C:\Users\Marcel\.cargo\git\checkouts\stm32l4xx-hal-8d56012c7770dc85\a72e4c5\src\rcc.rs:123:45
    |
123 |     pub(crate) fn crrcr(&mut self) -> &rcc::CRRCR {
    |                                             ^^^^^ not found in `rcc`
help: possible candidate is found in another module, you can import it into scope
    |
3   | use crate::rcc::CRRCR;
    |

error[E0609]: no field `crrcr` on type `stm32l4::stm32l4x6::rcc::RegisterBlock`
   --> C:\Users\Marcel\.cargo\git\checkouts\stm32l4xx-hal-8d56012c7770dc85\a72e4c5\src\rcc.rs:125:33
    |
125 |         unsafe { &(*RCC::ptr()).crrcr }
    |                                 ^^^^^ unknown field
    |
    = note: available fields are: `cr`, `icscr`, `cfgr`, `pllcfgr`, `pllsai1cfgr` ... and 25 others

error[E0609]: no field `crrcr` on type `&stm32l4::stm32l4x6::rcc::RegisterBlock`
   --> C:\Users\Marcel\.cargo\git\checkouts\stm32l4xx-hal-8d56012c7770dc85\a72e4c5\src\rcc.rs:524:17
    |
524 |             rcc.crrcr.modify(|_, w| w.hsi48on().set_bit());
    |                 ^^^^^

error[E0609]: no field `crrcr` on type `&stm32l4::stm32l4x6::rcc::RegisterBlock`
   --> C:\Users\Marcel\.cargo\git\checkouts\stm32l4xx-hal-8d56012c7770dc85\a72e4c5\src\rcc.rs:526:23
    |
526 |             while rcc.crrcr.read().hsi48rdy().bit_is_clear() {}
    |                       ^^^^^

error: aborting due to 4 previous errors
@MabezDev
Copy link
Member

MabezDev commented Feb 1, 2019

This is a bug in master introduced #30, I plan on fixing this and pushing a new release this weekend.

@MabezDev MabezDev mentioned this issue Feb 1, 2019
@mathk
Copy link
Contributor

mathk commented Feb 3, 2019

You need stm32-rs/stm32-rs#141 to be merged in other to make it work.

@vertexclique
Copy link

Any update on this?

@hellow554
Copy link
Contributor Author

It has been merged, but AFAICT no new version hasn't been pushed. @MabezDev what's the status?

@vertexclique
Copy link

I can push the revamped svd conversions for stm32l4** family, when I have time. Made it work by cloning hal crate(this one) and mcu crate.

@MabezDev
Copy link
Member

Although the patch has been merged, we are still waiting for @adamgreig to cut a new release of stm32-rs.

@MathiasKoch
Copy link
Collaborator

I am also seeing this issue. What is the status on getting it resolved? Any workarounds until then?

@hellow554
Copy link
Contributor Author

hellow554 commented Apr 9, 2019

@smilykoch you could specify this git repository as dependency instead or use the patch section in cargo https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section

@hellow554
Copy link
Contributor Author

ping @adamgreig !

@MathiasKoch
Copy link
Collaborator

@hellow554 Thanks for the reply. I tried specifying this git repo as

[dependencies.stm32l4xx-hal]
# version = "0.3.6"
git = "https://github.com/stm32-rs/stm32l4xx-hal.git"
features = ["stm32l4x5", "rt"]

But i am still getting the same issues..

Compiling stm32l4xx-hal v0.3.6 (https://github.com/stm32-rs/stm32l4xx-hal.git#82fd75b4)
error[E0412]: cannot find type `CRRCR` in module `rcc`
   --> /home/mathias/.cargo/git/checkouts/stm32l4xx-hal-8d56012c7770dc85/82fd75b/src/rcc.rs:118:45
    |
118 |     pub(crate) fn crrcr(&mut self) -> &rcc::CRRCR {
    |                                             ^^^^^ not found in `rcc`
help: possible candidate is found in another module, you can import it into scope
    |
3   | use crate::rcc::CRRCR;
    |

error[E0609]: no field `crrcr` on type `stm32l4::stm32l4x5::rcc::RegisterBlock`
   --> /home/mathias/.cargo/git/checkouts/stm32l4xx-hal-8d56012c7770dc85/82fd75b/src/rcc.rs:120:33
    |
120 |         unsafe { &(*RCC::ptr()).crrcr }
    |                                 ^^^^^ unknown field
    |
    = note: available fields are: `cr`, `icscr`, `cfgr`, `pllcfgr`, `pllsai1cfgr` ... and 25 others

error[E0609]: no field `crrcr` on type `&stm32l4::stm32l4x5::rcc::RegisterBlock`
   --> /home/mathias/.cargo/git/checkouts/stm32l4xx-hal-8d56012c7770dc85/82fd75b/src/rcc.rs:507:21
    |
507 |                 rcc.crrcr.modify(|_, w| w.hsi48on().set_bit());
    |                     ^^^^^

error[E0609]: no field `crrcr` on type `&stm32l4::stm32l4x5::rcc::RegisterBlock`
   --> /home/mathias/.cargo/git/checkouts/stm32l4xx-hal-8d56012c7770dc85/82fd75b/src/rcc.rs:509:27
    |
509 |                 while rcc.crrcr.read().hsi48rdy().bit_is_clear() {}
    |                           ^^^^^

error: aborting due to 4 previous errors

@vertexclique
Copy link

@smilykoch you need to invoke svd2rust with make. Previously generated ones will reside in the project dir.

@MathiasKoch
Copy link
Collaborator

How do i do that? I am still fairly new in the embedded rust world ;)

@MathiasKoch
Copy link
Collaborator

@vertexclique Could you maybe teach me what you mean when you say "invoke svd2rust with make"?

@MathiasKoch
Copy link
Collaborator

Anyone who will be kind enough to share with me, how to resolve this issue until a new release of stm32-rs is published? I have been able to get a hold of the STM32L4x5.svd file, and ran it through svd2rust, to obtain the three files it generates. But i cannot figure out how they fit together with this repo, and how to replace the dependency with my generated ones?

@MabezDev
Copy link
Member

Sorry guys, I really didn't think it would take this long to get a new release of stm32-rs.

Created a branch that uses a custom stm32l4 from stm32-rs master (with the fixes in).

Could you try the following in your Cargo.toml's

stm32l4xx-hal = { version = "0.3.6", git = "https://github.com/stm32-rs/stm32l4xx-hal", rev = "ffb160931d30d01d2d86371b75c2bd2ad4d0763a"}

@MathiasKoch
Copy link
Collaborator

Hi.

Great! It seems to work! Thank you very much!

@MabezDev
Copy link
Member

Glad to hear it. Hopefully we will get a proper release soon.

@adamgreig
Copy link
Member

See stm32-rs/stm32-rs#192 for upcoming release including this

@twilco
Copy link

twilco commented Apr 27, 2019

Looks like stm32-rs v0.7.0 has been released containing this fix 🎉

@MabezDev, any idea when you were next planning on cutting a release of this crate?

@MabezDev
Copy link
Member

MabezDev commented May 8, 2019

0.4.0 has been release which includes the changes to fix this issue.

@MabezDev MabezDev closed this as completed May 8, 2019
@twilco
Copy link

twilco commented May 18, 2019

Hmm, I'm still seeing the issue after upgrading to 0.4.0. The previously mentioned 0.3.6 fix also resulted in the exact same compilation issues for me.

Error:

$ cargo build
   Compiling stm32l4xx-hal v0.4.0
error[E0412]: cannot find type `CRRCR` in module `rcc`
   --> /Users/twilcock/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32l4xx-hal-0.4.0/src/rcc.rs:118:45
    |
118 |     pub(crate) fn crrcr(&mut self) -> &rcc::CRRCR {
    |                                             ^^^^^ not found in `rcc`
help: possible candidate is found in another module, you can import it into scope
    |
3   | use crate::rcc::CRRCR;
    |

error[E0609]: no field `crrcr` on type `stm32l4::stm32l4x3::rcc::RegisterBlock`
   --> /Users/twilcock/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32l4xx-hal-0.4.0/src/rcc.rs:120:33
    |
120 |         unsafe { &(*RCC::ptr()).crrcr }
    |                                 ^^^^^ unknown field
    |
    = note: available fields are: `cr`, `icscr`, `cfgr`, `pllcfgr`, `pllsai1cfgr` ... and 24 others

error[E0609]: no field `crrcr` on type `&stm32l4::stm32l4x3::rcc::RegisterBlock`
   --> /Users/twilcock/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32l4xx-hal-0.4.0/src/rcc.rs:507:21
    |
507 |                 rcc.crrcr.modify(|_, w| w.hsi48on().set_bit());
    |                     ^^^^^

error[E0609]: no field `crrcr` on type `&stm32l4::stm32l4x3::rcc::RegisterBlock`
   --> /Users/twilcock/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32l4xx-hal-0.4.0/src/rcc.rs:509:27
    |
509 |                 while rcc.crrcr.read().hsi48rdy().bit_is_clear() {}
    |                           ^^^^^

error[E0599]: no method named `spi3en` found for type `&mut stm32l4::stm32l4x3::rcc::apb1enr1::W` in the current scope
   --> /Users/twilcock/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32l4xx-hal-0.4.0/src/spi.rs:184:26
    |
184 |     SPI3: (spi3, APB1R1, spi3en, spi3rst, pclk1),
    |                          ^^^^^^ help: did you mean: `sp3en`

error: aborting due to 5 previous errors

Some errors occurred: E0412, E0599, E0609.
For more information about an error, try `rustc --explain E0412`.
error: Could not compile `stm32l4xx-hal`.

Cargo.toml:

[dependencies]
cortex-m = "0.6"
panic-halt = "0.2"
cortex-m-rt = "0.6"

[dependencies.stm32l4xx-hal]
features = ["rt", "stm32l4x3"]
version = "0.4"

lib.rs:

#![no_std]

#[allow(unused_extern_crates)] // NOTE(allow) bug rust-lang/rust#53964
extern crate panic_halt; // panic handler
extern crate stm32l4xx_hal as hal;

use hal::prelude::*;

pub use cortex_m_rt::entry;
pub use hal::{
   delay::Delay, prelude
};

pub fn init() -> Delay {
    let cp = cortex_m::Peripherals::take().unwrap();
    let dp = hal::stm32::Peripherals::take().unwrap();

    let mut flash = dp.FLASH.constrain();
    let mut rcc = dp.RCC.constrain();

    let clocks = rcc.cfgr.freeze(&mut flash.acr);

    Delay::new(cp.SYST, clocks)
}

@MabezDev
Copy link
Member

@mathk It looks like stm32-rs/stm32-rs#141 did not include the crrcr patch for the x3 chips, was this intentional (i.e it's not actually on the x3 chips) or is this something we need to patch?

@mathk
Copy link
Contributor

mathk commented May 27, 2019

I guess we need to patch it. Looks like there is x43 and x33 chip and both reference RM0394 which document HSI48. I think at time of writing the patch I was only looking and the ST website documentation.

@MabezDev
Copy link
Member

Ah okay. I've opened a PR on stm32-rs that should add support for the l4x3 chips.

@MabezDev MabezDev reopened this May 27, 2019
@hellow554
Copy link
Contributor Author

Merged, can this be closed again?

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

7 participants