为什么编译器标志“-mcpu=cortex-m3”在 stm32f10x 上出错?
Why the compiler flags “-mcpu=cortex-m3” goes wrong with stm32f10x?
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 devices use the Cortex-M3 core, with a maximum CPU speed of
72 MHz.
那为什么是“-mcpu=cortex-m4”而不是“-mcpu=cortex-m3”?
我的手臂-none-eabi-gcc:
gcc version 9.2.1 20191025 (release) [ARM/arm-9-branch revision
277599] (GNU Tools for Arm Embedded Processors 9-2019-q4-major)
Cortex-m3 没有 FPU 选项
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 devices use the Cortex-M3 core, with a maximum CPU speed of 72 MHz.
那为什么是“-mcpu=cortex-m4”而不是“-mcpu=cortex-m3”? 我的手臂-none-eabi-gcc:
gcc version 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599] (GNU Tools for Arm Embedded Processors 9-2019-q4-major)
Cortex-m3 没有 FPU 选项