Gcc 为什么编译器标志“-mcpu=cortex-m3”与stm32f10x一起出现错误?

Gcc 为什么编译器标志“-mcpu=cortex-m3”与stm32f10x一起出现错误?,gcc,makefile,arm,stm32,cortex-m,Gcc,Makefile,Arm,Stm32,Cortex M,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

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呢? 我的手臂没有我的gcc:

gcc版本9.2.1 20191025发布【ARM/ARM-9-branch修订版】 277599]Arm嵌入式处理器GNU工具9-2019-q4-major


Cortex-m3没有FPU选项

Cortex-m3没有FPU选项

这里没有足够的信息来确定答案-我们需要一个答案。但是,错误消息表明,为您的各种构建目标指定的目标平台的详细信息不一致。您还有这些标志-mfloat abi=hard-mfpu=fpv4-sp-d16,并且仅在Cortex-M4上可用,因此,删除这两个,它可能会工作的错误使用VFP寄存器参数看起来相对清晰。如果您不知道什么是VFP,以及是否存在FPU,为什么不调查一下?这里没有足够的信息来确定答案-我们需要一个答案。但是,错误消息表明,为您的各种构建目标指定的目标平台的详细信息不一致。您还有这些标志-mfloat abi=hard-mfpu=fpv4-sp-d16,并且仅在Cortex-M4上可用,因此,删除这两个,它可能会工作的错误使用VFP寄存器参数看起来相对清晰。如果您不知道FPU的存在与否,为什么不调查什么是VFP?