lupyuen / stm32-blue-pill-rust

Rust for STM32 Blue Pill with Visual Studio Code
Apache License 2.0
107 stars 12 forks source link

Having trouble compiling with the nightly #1

Open daniel-dsouza opened 6 years ago

daniel-dsouza commented 6 years ago

Hi there,

I am trying to follow your tutorial, however I cannot build using the current nightly.

   Compiling stm32-blue-pill-rust v0.3.2 (/home/daniel/Documents/stm32-blue-pill-rust)
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "-L" "/home/daniel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/deps/stm32_blue_pill_rust-ceecd47cc1e603d6.stm32_blue_pill_rust.62qs9zfw-cgu.0.rcgu.o" "-o" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/deps/stm32_blue_pill_rust-ceecd47cc1e603d6" "--gc-sections" "-L" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/deps" "-L" "/home/daniel/Documents/stm32-blue-pill-rust/target/release/deps" "-L" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/build/cortex-m-469028071b05c1d2/out" "-L" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/build/cortex-m-rt-251c1012784a0b39/out" "-L" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/build/cortex-m-semihosting-368b838bdfe59b68/out" "-L" "/home/daniel/Documents/stm32-blue-pill-rust/target/thumbv7m-none-eabi/release/build/stm32f103xx-hal-3f1d32b90e85fa6f/out" "-L" "/home/daniel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib" "--start-group" "-Bstatic" "/tmp/rustcVnOO6J/libcortex_m_semihosting-7f25fe3528a0388a.rlib" "/tmp/rustcVnOO6J/libcortex_m_rt-62e8324616d9e2b3.rlib" "/tmp/rustcVnOO6J/libcortex_m-4c2b7b6ec6701059.rlib" "--end-group" "/home/daniel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-58f8e0c368d29ff6.rlib" "-nostartfiles" "-Wl,-Tlink.x" "-Bdynamic"
  = note: rust-lld: error: unknown argument: -nostartfiles
          rust-lld: error: unknown argument: -Wl,-Tlink.x

error: aborting due to previous error

error: Could not compile `stm32-blue-pill-rust`.

To learn more, run the command again with --verbose.

I do not think this is a problem with your workspace, but rather something with rust-lld. Any thoughts?

daniel-dsouza commented 6 years ago

switching to the gnu linker yields this error.

  = note: arm-none-eabi-ld:
          BUG(cortex-m-rt): the reset vector is missing
          arm-none-eabi-ld:
          BUG(cortex-m-rt): the exception vectors are missing
gbip commented 6 years ago

You can modify .cargo/config to remove those arguments. I don't know what the equivalent are for rust-lld though :disappointed:

Please not that the resulting binary is way too big (1,3M).

gbip commented 6 years ago

I created a pull request (#2) for this bug. Fell free to use my fork until this is merged.