手臂交叉编译:skylake不是该目标的公认处理器

时间:2019-09-21 08:24:12

标签: rust arm

我正在关注嵌入式系统的生锈手册(本章https://rust-embedded.github.io/book/start/qemu.html

当我“大量建造”书中引用的项目示例(https://github.com/rust-embedded/cortex-m-quickstart)时,终端上出现很多“ skylake不是该目标的公认处理器(忽略处理器)”。 / p>

如书中所述,运行“货物尺寸--bin应用-发布--A”不会产生与我上面链接的章节相同的结果。相反,我得到了:

  

app:

     

节大小添加器

     

.debug_str 11062 0x0

     

.debug_loc 171 0x0

     

.debug_abbrev 773 0x0

     

.debug_info 10121 0x0

     

.debug_ranges 40 0x0

     

.debug_macinfo 1 0x0

     

.debug_pubnames 1482 0x0

     

.debug_pubtypes 8247 0x0

     

.ARM。属性57 0x0

     

.debug_frame 100 0x0

     

.debug_line 1048 0x0

     

.comment 18 0x0

     

总计33120

没有提及向量表.text .rodata和.data。 .bss

并且结果文件无法加载到板上。所以我想它无法交叉编译。

编辑: 我没有在项目随附的.cargo / config中进行任何更改。 这是.cargo / config:

[target.thumbv7m-none-eabi]

# uncomment this to make `cargo run` execute programs on QEMU
# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# uncomment ONE of these three option to make `cargo run` start a GDB session
# which option to pick depends on your system
# runner = "arm-none-eabi-gdb -q -x openocd.gdb"
# runner = "gdb-multiarch -q -x openocd.gdb"
# runner = "gdb -q -x openocd.gdb"

rustflags = [
  # LLD (shipped with the Rust toolchain) is used as the default linker
  "-C", "link-arg=-Tlink.x",
  # if you run into problems with LLD switch to the GNU linker by commenting out
  # this line
  #"-C", "linker=arm-none-eabi-ld",
  # if you need to link to pre-compiled C libraries provided by a C toolchain
  # use GCC as the linker by commenting out both lines above and then
  # uncommenting the three lines below
  # "-C", "linker=arm-none-eabi-gcc",
  # "-C", "link-arg=-Wl,-Tlink.x",
  # "-C", "link-arg=-nostartfiles",
  ]

[build]
# Pick ONE of these compilation targets
# target = "thumbv6m-none-eabi"    # Cortex-M0 and Cortex-M0+
target = "thumbv7m-none-eabi"    # Cortex-M3
# target = "thumbv7em-none-eabi"   # Cortex-M4 and Cortex-M7 (no FPU)
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

1 个答案:

答案 0 :(得分:0)

您需要一个支持目标处理器的工具链,尤其是链接器。

rustup target add thumbv7m-none-eabi仅添加标准库-不安装链接器。获得链接器后,将.cargo/config file编辑为:

[target.thumbv7m-none-eabi]
linker = "arm-none-eabi-ld"

[build]
target = "thumbv7m-none-eabi"