diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2018-01-21 10:55:40 +0200 | 
|---|---|---|
| committer | skullydazed <skullydazed@users.noreply.github.com> | 2018-01-21 01:10:16 -0800 | 
| commit | 510a8d33394780a0713b26a0c516ecab1b140bc2 (patch) | |
| tree | a10d23ea3924f6a3623e4335bfdbba983baf4865 | |
| parent | 2018df1a61136f5db5032fc7f0ecb6dff05c6351 (diff) | |
| download | firmware-510a8d33394780a0713b26a0c516ecab1b140bc2.tar.gz firmware-510a8d33394780a0713b26a0c516ecab1b140bc2.tar.bz2 firmware-510a8d33394780a0713b26a0c516ecab1b140bc2.zip | |
Fix compiler settings for MCUs with floating point
| -rw-r--r-- | tmk_core/chibios.mk | 34 | 
1 files changed, 25 insertions, 9 deletions
| diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 4fa9fac2e..cb0482d75 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -26,7 +26,7 @@ endif  # Imported source files and paths  CHIBIOS = $(TOP_DIR)/lib/chibios  CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib -# Startup files. Try a few different locations, for compability with old versions and  +# Startup files. Try a few different locations, for compability with old versions and  # for things hardware in the contrib repository  STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk  ifeq ("$(wildcard $(STARTUP_MK))","") @@ -46,7 +46,7 @@ endif  include $(PLATFORM_MK) -BOARD_MK :=  +BOARD_MK :=  ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","")      BOARD_PATH = $(KEYBOARD_PATH_5) @@ -115,14 +115,14 @@ CHIBISRC = $(STARTUPSRC) \         $(STREAMSSRC) \  	   $(STARTUPASM) \  	   $(PORTASM) \ -	   $(OSALASM)          +	   $(OSALASM)  CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) -	    +  EXTRAINCDIRS += $(CHIBIOS)/os/license \           $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \           $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ -         $(STREAMSINC) $(CHIBIOS)/os/various  +         $(STREAMSINC) $(CHIBIOS)/os/various  #  # Project, sources and paths @@ -139,17 +139,17 @@ SIZE = arm-none-eabi-size  AR = arm-none-eabi-ar  NM = arm-none-eabi-nm  HEX = $(OBJCOPY) -O $(FORMAT) -EEP =  +EEP =  BIN = $(OBJCOPY) -O binary -THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB  +THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB -COMPILEFLAGS += -fomit-frame-pointer  +COMPILEFLAGS += -fomit-frame-pointer  COMPILEFLAGS += -falign-functions=16  COMPILEFLAGS += -ffunction-sections  COMPILEFLAGS += -fdata-sections  COMPILEFLAGS += -fno-common -COMPILEFLAGS += $(THUMBFLAGS)  +COMPILEFLAGS += $(THUMBFLAGS)  CFLAGS += $(COMPILEFLAGS) @@ -168,6 +168,22 @@ OPT_DEFS += -DPROTOCOL_CHIBIOS  MCUFLAGS = -mcpu=$(MCU) +# FPU options default (Cortex-M4 and Cortex-M7 single precision). +ifeq ($(USE_FPU_OPT),) +  USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant +endif + +# FPU-related options +ifeq ($(USE_FPU),) +  USE_FPU = no +endif +ifneq ($(USE_FPU),no) +  OPT    += $(USE_FPU_OPT) +  OPT_DEFS  += -DCORTEX_USE_FPU=TRUE +else +  OPT_DEFS  += -DCORTEX_USE_FPU=FALSE +endif +  DEBUG = gdb  DFU_ARGS ?= | 
