baoshi / CubeMX2Makefile

STM32CubeMX project to Makefile converter
152 stars 52 forks source link

"uses VFP register arguments" error occurs #26

Closed master-q closed 7 years ago

master-q commented 7 years ago

I get codes as following using STM32CubeMX and your CubeMX2Makefile for STM32F746G-DISCO board:

https://github.com/master-q/try_to_use_stm32cubemx

However above codes is not able to be compiled, because the build stops with following errors:

$ make
--snip--
arm-none-eabi-gcc -x assembler-with-cpp -c -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F746xx -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F746xx -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -IMiddlewares/Third_Party/FreeRTOS/Source/include -IDrivers/CMSIS/Include -IDrivers/CMSIS/Device/ST/STM32F7xx/Include -IDrivers/STM32F7xx_HAL_Driver/Inc -IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy -IInc -O0 -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -std=c99 -MD -MP -MF .dep/startup_stm32f746xx.o.d startup/startup_stm32f746xx.s -o build/startup_stm32f746xx.o
arm-none-eabi-gcc build/stm32f7xx_hal_timebase_TIM.o build/freertos.o build/stm32f7xx_it.o build/main.o build/system_stm32f7xx.o build/stm32f7xx_hal_msp.o build/timers.o build/croutine.o build/queue.o build/tasks.o build/event_groups.o build/list.o build/port.o build/heap_4.o build/cmsis_os.o build/stm32f7xx_hal_i2c_ex.o build/stm32f7xx_hal_dma_ex.o build/stm32f7xx_hal_tim_ex.o build/stm32f7xx_hal_cortex.o build/stm32f7xx_hal_tim.o build/stm32f7xx_hal_pwr_ex.o build/stm32f7xx_hal.o build/stm32f7xx_hal_rcc_ex.o build/stm32f7xx_hal_gpio.o build/stm32f7xx_hal_i2c.o build/stm32f7xx_hal_rcc.o build/stm32f7xx_hal_dma.o build/stm32f7xx_hal_flash.o build/stm32f7xx_hal_pwr.o build/stm32f7xx_hal_flash_ex.o build/startup_stm32f746xx.o -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32F746NGHx_FLASH.ld  -lc -lm -lnosys -Wl,-Map=build/stm32f7.map,--cref -Wl,--gc-sections -o build/stm32f7.elf
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: error: build/stm32f7xx_hal_timebase_TIM.o uses VFP register arguments, build/stm32f7.elf does not
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file build/stm32f7xx_hal_timebase_TIM.o
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: error: build/freertos.o uses VFP register arguments, build/stm32f7.elf does not
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file build/freertos.o
--snip--
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: error: build/stm32f7xx_hal_flash_ex.o uses VFP register arguments, build/stm32f7.elf does not
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file build/stm32f7xx_hal_flash_ex.o
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-fini.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-impure.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-init.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memcpy.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memset.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__call_atexit.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
collect2: error: ld returned 1 exit status
Makefile:127: recipe for target 'build/stm32f7.elf' failed
make: *** [build/stm32f7.elf] Error 1

What's wrong? I'm using:

master-q commented 7 years ago

Sorry. I'm confusing. The build has no problem with following patch:

--- a/Makefile
+++ b/Makefile
@@ -86,8 +86,8 @@ C_INCLUDES += -IDrivers/STM32F7xx_HAL_Driver/Inc
 C_INCLUDES += -IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy
 C_INCLUDES += -IInc
 # compile gcc flags
-ASFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=hard $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
-CFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=hard $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
+ASFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
+CFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
 ifeq ($(DEBUG), 1)
 CFLAGS += -g -gdwarf-2
 endif
@@ -102,7 +102,7 @@ LDSCRIPT = STM32F746NGHx_FLASH.ld
 # libraries
 LIBS = -lc -lm -lnosys
 LIBDIR =
-LDFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
+LDFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections

 # default action: build all
 all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin

This project can't use hard float?

master-q commented 7 years ago

Sorry. I make sense. It's an error at GCC toolchain. This issue is not reproduced on following environment: