stm32-rs / stm32g0xx-hal

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

Build fails with --features stm32g081 #6

Closed andresv closed 4 years ago

andresv commented 4 years ago

cargo build --example blinky --features stm32g081

error: symbol `DEVICE_PERIPHERALS` is already defined
    --> /Users/andres/.cargo/registry/src/github.com-1ecc6299db9ec823/stm32g0-0.10.0/src/stm32g081/mod.rs:1160:1
     |
1160 | static mut DEVICE_PERIPHERALS: bool = false;
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `stm32g0`.

To learn more, run the command again with --verbose.
andresv commented 4 years ago

I compared stm32g07x and stm32g081 dirs from here https://github.com/stm32-rs/stm32-rs-nightlies and they were exactly the same.

I also used stm32-rs-nightlies to build examples, so stm32g0xx-hal/Cargo.toml was modified to:

#stm32g0 = "0.10.0"
stm32g0 = {git = "https://github.com/stm32-rs/stm32-rs-nightlies"}
andresv commented 4 years ago

Ahaa, default is not working as expected. When I replaced default = ["rt", "stm32g07x"] with default = ["rt", "stm32g081"]. I was able to build blink with cargo build --example blinky --features stm32g081.

[features]
#default = ["rt", "stm32g07x"]
default = ["rt", "stm32g081"]
rt = ["stm32g0/rt"]
stm32g07x = ["stm32g0/stm32g07x"]
stm32g030 = ["stm32g0/stm32g030"]
stm32g031 = ["stm32g0/stm32g031"]
stm32g041 = ["stm32g0/stm32g041"]
stm32g081 = ["stm32g0/stm32g081"]
andresv commented 4 years ago

This is now fixed in master and blinky can be built as: cargo build --example blinky --features stm32g081.