RTFM 0.4 beta hiccups with stm32f1


I was trying out RTFM pre release version with stm32f1 crate. I need to use stm32f103. First compiled the example code from RTFM which compiles fine. Made some changes for my device (in a new project):


use panic_semihosting;
use cortex_m_semihosting::{debug};

use rtfm::app;

use stm32f1::stm32f103::Interrupt;
// use lm3s6965::Interrupt;

#[app(device = stm32f1::stm32f103)]
// #[app(device = lm3s6965)]
const APP: () = {
    fn init() {

    fn idle() -> ! {

        loop {}

    fn UART5() {

And I get an error message:

error[E0658]: The attribute `interrupt` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
  --> src/main.rs:14:1
14 | #[app(device = stm32f1::stm32f103)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: add #![feature(custom_attribute)] to the crate attributes to enable

Could someone please identify the problem is? I dont quite follow the error message, as there are no custom attributes needed for the other device.


Did you use the device crate (stm32f1) from crates.io, or a custom version?

RTFM 0.4 requires a device crate that has been generated with svd2rust 0.14.0, otherwise it won’t work. Most device crates haven’t been updated yet, because svd2rust 0.14.0 hasn’t been released yet.

If you want to beta-test:

  • Compile svd2rust @ master
  • Re-generate the device crate for your device with that svd2rust version
  • Use that generated crate as a dependency for your RTFM project

(Hope that’s correct. Ping @japaric.)


what @dbrgn said is correct!

svd2rust 0.14.0 should be released this week but the ecosystem may take a few more weeks to migrate to the new version.


@dbrgn @japaric Thanks for the update! I was indeed using the version from crates.io

I just installed svd2rust from git, and locally compiled stm32f1 crate. Now my Cargo.toml for stm32f1 looks like:

path = "/path/to/stm32-rs/stm32f1"
features = ["stm32f103","rt"]

However, I now have lots of linker errors:

  = note: rust-lld: error: undefined symbol: WWDG
          >>> referenced by 4d2a4uhme2s6a19
          >>>               stm32f1-ad236839ccc588b2.4d2a4uhme2s6a19.rcgu.o:(__INTERRUPTS) in archive /home/aj/learning/rust/embedded/rtfm_test/target/thumbv7m-none-eabi/debug/deps/libstm32f1-ad236839ccc588b2.rlib
          rust-lld: error: undefined symbol: PVD
          >>> referenced by 4d2a4uhme2s6a19
          >>>               stm32f1-ad236839ccc588b2.4d2a4uhme2s6a19.rcgu.o:(__INTERRUPTS) in archive /home/aj/learning/rust/embedded/rtfm_test/target/thumbv7m-none-eabi/debug/deps/libstm32f1-ad236839ccc588b2.rlib

I’ve snipped the rest.

I followed the instructions in the stm32-rs readme https://github.com/adamgreig/stm32-rs Generating Device Crates / Building Locally section. The optional step make form failed with quite a lot of errors like:

error[E0583]: file not found for module `isr`
  --> /run/media/aj/Buffer/git-clones/stm32-rs/stm32f0/src/stm32f0x8/adc.rs:34:9
34 | pub mod isr;
   |         ^^^
   = help: name the file either isr.rs or isr/mod.rs inside the directory "/run/media/aj/Buffer/git-clones/stm32-rs/stm32f0/src/stm32f0x8"

Error writing files: parse error
error[E0583]: file not found for module `acr`
  --> /run/media/aj/Buffer/git-clones/stm32-rs/stm32f0/src/stm32f0x8/flash.rs:27:9
27 | pub mod acr;
   |         ^^^
   = help: name the file either acr.rs or acr/mod.rs inside the directory "/run/media/aj/Buffer/git-clones/stm32-rs/stm32f0/src/stm32f0x8"

Rest snipped.

Did I do something incorrectly ?