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 /tmk_core/chibios.mk | |
parent | 2018df1a61136f5db5032fc7f0ecb6dff05c6351 (diff) | |
download | qmk_firmware-510a8d33394780a0713b26a0c516ecab1b140bc2.tar.gz qmk_firmware-510a8d33394780a0713b26a0c516ecab1b140bc2.zip |
Fix compiler settings for MCUs with floating point
Diffstat (limited to 'tmk_core/chibios.mk')
-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 | |||
26 | # Imported source files and paths | 26 | # Imported source files and paths |
27 | CHIBIOS = $(TOP_DIR)/lib/chibios | 27 | CHIBIOS = $(TOP_DIR)/lib/chibios |
28 | CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib | 28 | CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib |
29 | # Startup files. Try a few different locations, for compability with old versions and | 29 | # Startup files. Try a few different locations, for compability with old versions and |
30 | # for things hardware in the contrib repository | 30 | # for things hardware in the contrib repository |
31 | STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk | 31 | STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk |
32 | ifeq ("$(wildcard $(STARTUP_MK))","") | 32 | ifeq ("$(wildcard $(STARTUP_MK))","") |
@@ -46,7 +46,7 @@ endif | |||
46 | include $(PLATFORM_MK) | 46 | include $(PLATFORM_MK) |
47 | 47 | ||
48 | 48 | ||
49 | BOARD_MK := | 49 | BOARD_MK := |
50 | 50 | ||
51 | ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","") | 51 | ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","") |
52 | BOARD_PATH = $(KEYBOARD_PATH_5) | 52 | BOARD_PATH = $(KEYBOARD_PATH_5) |
@@ -115,14 +115,14 @@ CHIBISRC = $(STARTUPSRC) \ | |||
115 | $(STREAMSSRC) \ | 115 | $(STREAMSSRC) \ |
116 | $(STARTUPASM) \ | 116 | $(STARTUPASM) \ |
117 | $(PORTASM) \ | 117 | $(PORTASM) \ |
118 | $(OSALASM) | 118 | $(OSALASM) |
119 | 119 | ||
120 | CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) | 120 | CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) |
121 | 121 | ||
122 | EXTRAINCDIRS += $(CHIBIOS)/os/license \ | 122 | EXTRAINCDIRS += $(CHIBIOS)/os/license \ |
123 | $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ | 123 | $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ |
124 | $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ | 124 | $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ |
125 | $(STREAMSINC) $(CHIBIOS)/os/various | 125 | $(STREAMSINC) $(CHIBIOS)/os/various |
126 | 126 | ||
127 | # | 127 | # |
128 | # Project, sources and paths | 128 | # Project, sources and paths |
@@ -139,17 +139,17 @@ SIZE = arm-none-eabi-size | |||
139 | AR = arm-none-eabi-ar | 139 | AR = arm-none-eabi-ar |
140 | NM = arm-none-eabi-nm | 140 | NM = arm-none-eabi-nm |
141 | HEX = $(OBJCOPY) -O $(FORMAT) | 141 | HEX = $(OBJCOPY) -O $(FORMAT) |
142 | EEP = | 142 | EEP = |
143 | BIN = $(OBJCOPY) -O binary | 143 | BIN = $(OBJCOPY) -O binary |
144 | 144 | ||
145 | THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB | 145 | THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB |
146 | 146 | ||
147 | COMPILEFLAGS += -fomit-frame-pointer | 147 | COMPILEFLAGS += -fomit-frame-pointer |
148 | COMPILEFLAGS += -falign-functions=16 | 148 | COMPILEFLAGS += -falign-functions=16 |
149 | COMPILEFLAGS += -ffunction-sections | 149 | COMPILEFLAGS += -ffunction-sections |
150 | COMPILEFLAGS += -fdata-sections | 150 | COMPILEFLAGS += -fdata-sections |
151 | COMPILEFLAGS += -fno-common | 151 | COMPILEFLAGS += -fno-common |
152 | COMPILEFLAGS += $(THUMBFLAGS) | 152 | COMPILEFLAGS += $(THUMBFLAGS) |
153 | 153 | ||
154 | CFLAGS += $(COMPILEFLAGS) | 154 | CFLAGS += $(COMPILEFLAGS) |
155 | 155 | ||
@@ -168,6 +168,22 @@ OPT_DEFS += -DPROTOCOL_CHIBIOS | |||
168 | 168 | ||
169 | MCUFLAGS = -mcpu=$(MCU) | 169 | MCUFLAGS = -mcpu=$(MCU) |
170 | 170 | ||
171 | # FPU options default (Cortex-M4 and Cortex-M7 single precision). | ||
172 | ifeq ($(USE_FPU_OPT),) | ||
173 | USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant | ||
174 | endif | ||
175 | |||
176 | # FPU-related options | ||
177 | ifeq ($(USE_FPU),) | ||
178 | USE_FPU = no | ||
179 | endif | ||
180 | ifneq ($(USE_FPU),no) | ||
181 | OPT += $(USE_FPU_OPT) | ||
182 | OPT_DEFS += -DCORTEX_USE_FPU=TRUE | ||
183 | else | ||
184 | OPT_DEFS += -DCORTEX_USE_FPU=FALSE | ||
185 | endif | ||
186 | |||
171 | DEBUG = gdb | 187 | DEBUG = gdb |
172 | 188 | ||
173 | DFU_ARGS ?= | 189 | DFU_ARGS ?= |