mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
030820ce65
cpu: centralized linkerscripts for Cortex-M based CPUs
30 lines
1.4 KiB
Makefile
30 lines
1.4 KiB
Makefile
# Target triple for the build. Use arm-none-eabi if you are unsure.
|
|
export TARGET_TRIPLE ?= arm-none-eabi
|
|
|
|
# Toolchain prefix, defaults to target triple followed by a dash, you will most likely not need to touch this.
|
|
export PREFIX ?= $(if $(TARGET_TRIPLE),$(TARGET_TRIPLE)-)
|
|
|
|
# we build all cortex boards with the GNU toolchain
|
|
include $(RIOTBOARD)/Makefile.include.gnu
|
|
|
|
# define build specific options
|
|
export CFLAGS_CPU = -mcpu=$(MCPU) -mlittle-endian -mthumb -mno-thumb-interwork $(CFLAGS_FPU)
|
|
export CFLAGS_STYLE = -std=gnu99 -Wall -Wstrict-prototypes -Werror=implicit-function-declaration
|
|
export CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin
|
|
export CFLAGS_DBG ?= -ggdb -g3
|
|
export CFLAGS_OPT ?= -Os
|
|
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_STYLE) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
|
|
|
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DEBUG)
|
|
export LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts -L$(RIOTCPU)/cortexm_common/ldscripts
|
|
export LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL).ld -Wl,--fatal-warnings
|
|
export LINKFLAGS += $(CFLAGS_DEBUG) $(CFLAGS_CPU) $(CFLAGS_STYLE) -static -lgcc -nostartfiles
|
|
|
|
# use the nano-specs of the NewLib when available
|
|
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
|
export LINKFLAGS += -specs=nano.specs -lc -lnosys
|
|
endif
|
|
|
|
# export board specific includes to the global includes-listing
|
|
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
|