stm32-rs / stm32g0xx-hal

Peripheral access API for STM32G0 series microcontrollers
Apache License 2.0
73 stars 51 forks source link

unable to build examples (exit status: 101) #101

Closed jemo07 closed 2 years ago

jemo07 commented 2 years ago

Hello, did a fresh git clone install on a new Ubuntu install. when I try to run, I get ( error: failed to run custom build command forstm32g0 v0.13.0)

So I tried several things, but I finally settled on issue with this git as I tried others and the build works. You can see here, I did a new git clone, then a cargo test and it fails the same way a build fails.

I was running the build as follows: jemo@jemo-MBP:~/development/git/stm32g0xx-hal$ cargo build --release --example blinky Here is the output of what I mentioned above:

jemo@jemo-MBP:~/development/git$ git clone https://github.com/stm32-rs/stm32g0xx-hal.git
Cloning into 'stm32g0xx-hal'...
remote: Enumerating objects: 1769, done.
remote: Counting objects: 100% (575/575), done.
remote: Compressing objects: 100% (256/256), done.
remote: Total 1769 (delta 363), reused 484 (delta 315), pack-reused 1194
Receiving objects: 100% (1769/1769), 398.33 KiB | 3.04 MiB/s, done.
Resolving deltas: 100% (1223/1223), done.
jemo@jemo-MBP:~/development/git$ cd stm32g0xx-hal/
jemo@jemo-MBP:~/development/git/stm32g0xx-hal$ cargo test
    Updating crates.io index
   Compiling nb v1.0.0
   Compiling cortex-m v0.7.4
   Compiling semver-parser v0.7.0
   Compiling void v1.0.2
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling version_check v0.9.4
   Compiling syn v1.0.90
   Compiling vcell v0.1.3
   Compiling autocfg v1.1.0
   Compiling bitfield v0.13.2
   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling cortex-m-rt v0.6.15
   Compiling critical-section v0.2.6
   Compiling bare-metal v1.0.0
   Compiling bytemuck v1.9.1
   Compiling atomic-polyfill v0.1.7
   Compiling syn v0.15.44
   Compiling hashbrown v0.11.2
   Compiling cfg-if v1.0.0
   Compiling byteorder v1.4.3
   Compiling num-derive v0.2.5
   Compiling r0 v0.2.2
   Compiling heapless v0.7.10
   Compiling cortex-m-semihosting v0.3.7
   Compiling stm32g0 v0.13.0
   Compiling stable_deref_trait v1.2.0
   Compiling rtic-core v1.0.0
   Compiling rtic-monotonic v1.0.0
   Compiling embedded-graphics v0.5.2
   Compiling panic-halt v0.2.0
   Compiling nb v0.1.3
   Compiling semver v0.9.0
   Compiling volatile-register v0.2.1
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling cortex-m-rtic v1.0.0
   Compiling rgb v0.8.32
   Compiling indexmap v1.8.1
   Compiling num-traits v0.2.14
   Compiling hash32 v0.2.1
   Compiling embedded-hal v0.2.7
   Compiling rustc_version v0.2.3
error: failed to run custom build command for `stm32g0 v0.13.0`

Caused by:
  process didn't exit successfully: `/home/jemo/development/git/stm32g0xx-hal/target/debug/build/stm32g0-0175a714f014c3f4/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-search=/home/jemo/development/git/stm32g0xx-hal/target/thumbv6m-none-eabi/debug/build/stm32g0-9342c4cb479b36c9/out

  --- stderr
  thread 'main' panicked at 'No device features selected', /home/jemo/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32g0-0.13.0/build.rs:20:18
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
jemo@jemo-MBP:~/development/git/stm32g0xx-hal$ 
andresv commented 2 years ago

Look this: https://github.com/stm32-rs/stm32g0xx-hal#building-an-example. You have to specify for which particular G0 you wanna build it.

cargo build --release --example blinky --features stm32g071

Those are available options: https://github.com/stm32-rs/stm32g0xx-hal/blob/main/Cargo.toml#L53-L58