简体   繁体   中英

Why the compiler flags “-mcpu=cortex-m3” goes wrong with stm32f10x?

core of stm32f10x should be cortex-m3,with the flag"-mcpu=cortex-m3" ↓(this is section of 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

the error:

/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

but after replacing "-mcpu=cortex-m3" with "-mcpu=cortex-m4",the error disappears and the program runs normally.

this introduction of "st.com"

STM32F103 devices use the Cortex-M3 core, with a maximum CPU speed of 72 MHz.

so why is it "-mcpu=cortex-m4" instead of "-mcpu=cortex-m3"? my arm-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 doesn't have FPU option

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM