diff options
| author | Joel Challis <git@zvecr.com> | 2020-05-20 16:28:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-20 16:28:39 +0100 |
| commit | b0c780ed32712d2eb38c69a2b9465a00b861381e (patch) | |
| tree | 500c8c4f797e8a38a49fee8bbafaaf8efd4481c6 | |
| parent | 3ad2be52a7098c269d741f8d59a424afdbd7302d (diff) | |
| download | qmk_firmware-b0c780ed32712d2eb38c69a2b9465a00b861381e.tar.gz qmk_firmware-b0c780ed32712d2eb38c69a2b9465a00b861381e.zip | |
Fix ChibiOS FPU build logic (#9132)
| -rw-r--r-- | tmk_core/chibios.mk | 28 | ||||
| -rw-r--r-- | tmk_core/rules.mk | 2 |
2 files changed, 13 insertions, 17 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index d0f1032ac..09aaddeef 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk | |||
| @@ -220,6 +220,18 @@ COMPILEFLAGS += -fno-common | |||
| 220 | COMPILEFLAGS += -fshort-wchar | 220 | COMPILEFLAGS += -fshort-wchar |
| 221 | COMPILEFLAGS += $(THUMBFLAGS) | 221 | COMPILEFLAGS += $(THUMBFLAGS) |
| 222 | 222 | ||
| 223 | # FPU options default (Cortex-M4 and Cortex-M7 single precision). | ||
| 224 | USE_FPU_OPT ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant | ||
| 225 | |||
| 226 | # FPU-related options | ||
| 227 | USE_FPU ?= no | ||
| 228 | ifneq ($(USE_FPU),no) | ||
| 229 | COMPILEFLAGS += $(USE_FPU_OPT) | ||
| 230 | OPT_DEFS += -DCORTEX_USE_FPU=TRUE | ||
| 231 | else | ||
| 232 | OPT_DEFS += -DCORTEX_USE_FPU=FALSE | ||
| 233 | endif | ||
| 234 | |||
| 223 | CFLAGS += $(COMPILEFLAGS) | 235 | CFLAGS += $(COMPILEFLAGS) |
| 224 | 236 | ||
| 225 | ASFLAGS += $(THUMBFLAGS) | 237 | ASFLAGS += $(THUMBFLAGS) |
| @@ -241,22 +253,6 @@ OPT_DEFS += -DPORT_IGNORE_GCC_VERSION_CHECK=1 | |||
| 241 | 253 | ||
| 242 | MCUFLAGS = -mcpu=$(MCU) | 254 | MCUFLAGS = -mcpu=$(MCU) |
| 243 | 255 | ||
| 244 | # FPU options default (Cortex-M4 and Cortex-M7 single precision). | ||
| 245 | ifeq ($(USE_FPU_OPT),) | ||
| 246 | USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant | ||
| 247 | endif | ||
| 248 | |||
| 249 | # FPU-related options | ||
| 250 | ifeq ($(USE_FPU),) | ||
| 251 | USE_FPU = no | ||
| 252 | endif | ||
| 253 | ifneq ($(USE_FPU),no) | ||
| 254 | OPT += $(USE_FPU_OPT) | ||
| 255 | OPT_DEFS += -DCORTEX_USE_FPU=TRUE | ||
| 256 | else | ||
| 257 | OPT_DEFS += -DCORTEX_USE_FPU=FALSE | ||
| 258 | endif | ||
| 259 | |||
| 260 | DEBUG = gdb | 256 | DEBUG = gdb |
| 261 | 257 | ||
| 262 | DFU_ARGS ?= | 258 | DFU_ARGS ?= |
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index f45fd3792..9bb341ecb 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk | |||
| @@ -46,7 +46,7 @@ FORMAT = ihex | |||
| 46 | # Optimization level, can be [0, 1, 2, 3, s]. | 46 | # Optimization level, can be [0, 1, 2, 3, s]. |
| 47 | # 0 = turn off optimization. s = optimize for size. | 47 | # 0 = turn off optimization. s = optimize for size. |
| 48 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) | 48 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
| 49 | OPT = s | 49 | OPT ?= s |
| 50 | 50 | ||
| 51 | # Compiler flag to set the C Standard level. | 51 | # Compiler flag to set the C Standard level. |
| 52 | # c89 = "ANSI" C | 52 | # c89 = "ANSI" C |
