2016-11-07 14:35:17 +01:00
|
|
|
# Target triple for the build.
|
2020-09-08 22:28:41 +02:00
|
|
|
TARGET_ARCH_MIPS ?= mips-mti-elf
|
|
|
|
TARGET_ARCH ?= $(TARGET_ARCH_MIPS)
|
2016-11-07 14:35:17 +01:00
|
|
|
|
2020-01-10 15:08:12 +01:00
|
|
|
ABI = 32
|
2016-11-07 14:35:17 +01:00
|
|
|
|
2017-02-22 16:07:58 +01:00
|
|
|
# Default values for the linker script symbols listed below are
|
|
|
|
# defined in the linker script.
|
|
|
|
|
|
|
|
# These are linker script symbols that are prefixed with '__"
|
|
|
|
priv_symbols = MEMORY_BASE MEMORY_SIZE STACK
|
|
|
|
priv_symbols += ENABLE_XPA
|
|
|
|
priv_symbols += FLUSH_TO_ZERO
|
|
|
|
priv_symbols += FLASH_START APP_START FLASH_APP_START
|
|
|
|
priv_symbols += ISR_VEC_SPACE ISR_VECTOR_COUNT
|
|
|
|
|
|
|
|
# A bit of makefile magic:
|
|
|
|
# foreach symbol in overridable ld-symbols :
|
|
|
|
# If symbol has a value, produce a linker argument for that symbol.
|
2019-08-29 17:41:49 +02:00
|
|
|
MIPS_HAL_LDFLAGS = $(foreach a,$(priv_symbols),$(if $($a),-Wl$(comma)--defsym$(comma)__$(call lowercase,$(a))=$($a)))
|
2016-11-07 14:35:17 +01:00
|
|
|
|
2017-03-01 11:28:33 +01:00
|
|
|
ifeq ($(ROMABLE),1)
|
2020-01-10 15:08:12 +01:00
|
|
|
MIPS_HAL_LDFLAGS += -T bootcode.ld
|
2017-03-01 11:28:33 +01:00
|
|
|
endif
|
|
|
|
|
2016-11-07 14:35:17 +01:00
|
|
|
# define build specific options
|
2017-02-22 16:07:58 +01:00
|
|
|
# Remove -std=gnu99 once the MIPS toolchain headers are updated to include upstream
|
|
|
|
# newlib commit 81c17949f0419d1c4fee421c60987ea1149522ae
|
|
|
|
# https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commitdiff;h=81c17949f0419d1c4fee421c60987ea1149522ae
|
|
|
|
# Otherwise we get an error about a missing declaration of strnlen in some parts.
|
2018-07-11 14:57:09 +02:00
|
|
|
ifeq (, $(filter -std=%, $(CFLAGS)))
|
2019-08-27 16:06:41 +02:00
|
|
|
CFLAGS += -std=gnu99
|
2018-07-11 14:57:09 +02:00
|
|
|
endif
|
2019-08-27 16:06:41 +02:00
|
|
|
CFLAGS_CPU = -EL -mabi=$(ABI)
|
|
|
|
CFLAGS_LINK = -ffunction-sections -fno-builtin -fshort-enums -fdata-sections
|
2020-01-15 23:00:04 +01:00
|
|
|
CFLAGS_DBG ?= -g3
|
|
|
|
CFLAGS_OPT ?= -Os
|
2016-11-07 14:35:17 +01:00
|
|
|
|
2019-08-27 16:06:41 +02:00
|
|
|
CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_OPT) $(CFLAGS_DBG)
|
2019-10-12 12:59:23 +02:00
|
|
|
CFLAGS += -DCPU_MODEL_$(call uppercase_and_underscore,$(CPU_MODEL))
|
2016-11-07 14:35:17 +01:00
|
|
|
|
|
|
|
ifeq ($(USE_HARD_FLOAT),1)
|
2020-01-10 15:08:12 +01:00
|
|
|
CFLAGS += -mhard-float -DMIPS_HARD_FLOAT
|
2016-11-07 14:35:17 +01:00
|
|
|
else
|
2020-01-10 15:08:12 +01:00
|
|
|
#hard-float is the default so we must set soft-float
|
|
|
|
CFLAGS += -msoft-float
|
|
|
|
LINKFLAGS += -msoft-float
|
2016-11-07 14:35:17 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(USE_DSP),1)
|
2020-01-10 15:08:12 +01:00
|
|
|
CFLAGS += -mdsp -DMIPS_DSP
|
2016-11-07 14:35:17 +01:00
|
|
|
endif
|
|
|
|
|
2017-03-01 11:26:49 +01:00
|
|
|
ifeq ($(TOOLCHAIN),llvm)
|
2020-01-10 15:08:12 +01:00
|
|
|
# The MIPS toolchain headers in assembly mode are not compatible with Clang
|
|
|
|
CCAS = $(PREFIX)gcc
|
|
|
|
CCASUWFLAGS += -target $(TARGET_ARCH)
|
2017-03-01 11:26:49 +01:00
|
|
|
endif
|
|
|
|
|
2019-08-27 16:06:41 +02:00
|
|
|
ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_OPT) $(CFLAGS_DBG)
|
2016-11-07 14:35:17 +01:00
|
|
|
|
2020-01-02 09:48:19 +01:00
|
|
|
LINKFLAGS += $(MIPS_HAL_LDFLAGS)
|
|
|
|
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts
|
|
|
|
LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
|
|
|
LINKFLAGS += -Wl,--gc-sections
|
2019-08-28 19:43:17 +02:00
|
|
|
|
|
|
|
OPTIONAL_CFLAGS_BLACKLIST += -Wformat-overflow
|
|
|
|
OPTIONAL_CFLAGS_BLACKLIST += -Wformat-truncation
|
2019-08-28 18:40:38 +02:00
|
|
|
OPTIONAL_CFLAGS_BLACKLIST += -gz
|