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 MHz。
那么为什么它是“ -mcpu = cortex-m4”而不是“ -mcpu = cortex-m3”?我的手臂-无-eabi-gcc:
gcc版本9.2.1 20191025(发行版)[ARM / arm-9分支修订277599](用于Arm嵌入式处理器的GNU工具9-2019-q4-major)
Cortex-m3没有FPU选项