【发布时间】:2020-03-24 17:22:07
【问题描述】:
stm32f10x的核心应该是cortex-m3,带有标志“-mcpu=cortex-m3”↓(这是makefile的部分):
CFLAGS += -T$(STD_PERIPH_LIBS)/Project/STM32F10x_StdPeriph_Template/TrueSTUDIO/STM3210B-EVAL/stm32_flash.ld
CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m3 -mthumb-interwork
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
错误:
/root/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: error: /tmp/ccwnNCUm.o uses VFP register arguments, t1.elf does not
/root/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /tmp/ccwnNCUm.o
/root/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: error: /tmp/ccaQhPT1.o uses VFP register arguments, t1.elf does not
/root/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /tmp/ccaQhPT1.o
collect2: error: ld returned 1 exit status
Makefile:39: recipe for target 't1.elf' failed
make: *** [t1.elf] Error 1
但是将“-mcpu=cortex-m3”替换为“-mcpu=cortex-m4”后,错误消失,程序正常运行。
本篇介绍“st.com”
STM32F103 器件使用 Cortex-M3 内核,最高 CPU 速度为 72 兆赫。
那么为什么是“-mcpu=cortex-m4”而不是“-mcpu=cortex-m3”? 我的 arm-none-eabi-gcc:
gcc 版本 9.2.1 20191025(发布)[ARM/arm-9-branch 修订版 277599](用于 Arm 嵌入式处理器的 GNU 工具 9-2019-q4-major)
【问题讨论】:
-
这里没有足够的信息来给出明确的答案——我们需要minimal reproducible example。但是,错误消息表明,为您的各种构建目标指定的目标平台的详细信息不一致。
-
你也有这些标志
-mfloat-abi=hard -mfpu=fpv4-sp-d16,这仅在 Cortex-M4 上可用,所以删除这两个,它可能会工作 -
错误
uses VFP register arguments对我来说看起来比较清楚。您为什么不调查什么是 VFP(如果您不知道)以及是否存在 FPU?
标签: gcc makefile arm stm32 cortex-m