rust-embedded / cortex-m-quickstart

Template to develop bare metal applications for Cortex-M microcontrollers
791 stars 164 forks source link

__RESET_VECTOR has an invalid section specifier #35

Closed et1975 closed 6 years ago

et1975 commented 6 years ago

What am I missing?

cargo build --examples
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling cc v1.0.17                                                         
   Compiling vcell v0.1.0
   Compiling aligned v0.2.0
   Compiling bare-metal v0.2.0
   Compiling r0 v0.2.2
   Compiling cortex-m-quickstart v0.3.2 (file:///~/sources/cortex-m-qs)
   Compiling volatile-register v0.2.0
   Compiling cortex-m v0.5.2
   Compiling cortex-m-semihosting v0.3.0
   Compiling cortex-m-rt v0.5.1
LLVM ERROR: Global variable '__RESET_VECTOR' has an invalid section specifier '.vector_table.reset_vector': mach-o section specifier requires a segment whose length is between 1 and 16 characters.
error: Could not compile `cortex-m-rt`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Updating the nightly doesn't help:

rustup toolchain install nightly
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2018-06-20, rust version 1.28.0-nightly (f28c7aef7 2018-06-19)
info: downloading component 'rustc'
 57.2 MiB /  57.2 MiB (100 %)   8.9 MiB/s ETA:   0 s                
info: downloading component 'rust-std'
 46.9 MiB /  46.9 MiB (100 %)  11.1 MiB/s ETA:   0 s                
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std' for 'thumbv7em-none-eabihf'
info: downloading component 'rust-std' for 'thumbv7m-none-eabi'
info: downloading component 'rls-preview'
info: downloading component 'rust-analysis'
info: downloading component 'rust-src'
info: removing component 'rustc'
info: removing component 'rust-std'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: removing component 'rust-std' for 'thumbv7em-none-eabihf'
info: removing component 'rust-std' for 'thumbv7m-none-eabi'
info: removing component 'rls-preview'
info: removing component 'rust-analysis'
info: removing component 'rust-src'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-std' for 'thumbv7em-none-eabihf'
info: installing component 'rust-std' for 'thumbv7m-none-eabi'
info: installing component 'rls-preview'
info: installing component 'rust-analysis'
info: installing component 'rust-src'

  nightly-x86_64-apple-darwin updated - rustc 1.28.0-nightly (f28c7aef7 2018-06-19)
japaric commented 6 years ago

You are (likely) compiling for the host (macOS); you should be cross compiling for one of the THUMB targets e.g. cargo build --target thumbv7m-none-eabi, or you can set a default target in .cargo/config.

et1975 commented 6 years ago

Yes, forgot to make sure .cargo/config has a build target. Thank you!