2014-08-05 00:51:23 +02:00
|
|
|
# define the cpu used by the yunjia-nrf51822 board
|
|
|
|
export CPU = nrf51822
|
|
|
|
export CPU_MODEL = nrf51822qfaa
|
|
|
|
|
|
|
|
#define the default port depending on the host OS
|
|
|
|
OS := $(shell uname)
|
|
|
|
ifeq ($(OS),Linux)
|
|
|
|
PORT ?= /dev/ttyUSB0
|
|
|
|
else ifeq ($(OS),Darwin)
|
|
|
|
PORT ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
|
|
|
|
else
|
|
|
|
$(info CAUTION: No flash tool for your host system found!)
|
|
|
|
# TODO: add support for windows as host platform
|
|
|
|
endif
|
|
|
|
export PORT
|
|
|
|
|
|
|
|
# define tools used for building the project
|
|
|
|
export PREFIX = arm-none-eabi-
|
|
|
|
export CC = $(PREFIX)gcc
|
2014-11-18 18:02:09 +01:00
|
|
|
export CXX = $(PREFIX)g++
|
2014-08-05 00:51:23 +02:00
|
|
|
export AR = $(PREFIX)ar
|
|
|
|
export AS = $(PREFIX)as
|
|
|
|
export LINK = $(PREFIX)gcc
|
|
|
|
export SIZE = $(PREFIX)size
|
|
|
|
export OBJCOPY = $(PREFIX)objcopy
|
2015-02-08 14:48:35 +01:00
|
|
|
export DBG = $(PREFIX)gdb
|
2014-08-05 00:51:23 +02:00
|
|
|
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
|
2015-02-08 14:48:35 +01:00
|
|
|
export FLASHER = $(RIOTBASE)/dist/tools/openocd/openocd.sh
|
|
|
|
export DEBUGGER = $(RIOTBASE)/dist/tools/openocd/openocd.sh
|
|
|
|
export DEBUGSERVER = $(RIOTBASE)/dist/tools/openocd/openocd.sh
|
|
|
|
export RESET = $(RIOTBASE)/dist/tools/openocd/openocd.sh
|
2014-08-05 00:51:23 +02:00
|
|
|
|
|
|
|
# define build specific options
|
|
|
|
CPU_USAGE = -mcpu=cortex-m0
|
|
|
|
FPU_USAGE =
|
2015-01-22 13:36:23 +01:00
|
|
|
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mno-thumb-interwork -nostartfiles
|
2014-08-05 00:51:23 +02:00
|
|
|
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin
|
|
|
|
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian
|
2015-01-22 13:36:23 +01:00
|
|
|
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mno-thumb-interwork -nostartfiles
|
2014-08-05 00:51:23 +02:00
|
|
|
# $(LINKERSCRIPT) is specified in cpu/Makefile.include
|
|
|
|
export LINKFLAGS += -T$(LINKERSCRIPT)
|
2015-02-08 14:48:35 +01:00
|
|
|
export OFLAGS = -O ihex
|
2014-08-05 00:51:23 +02:00
|
|
|
export TERMFLAGS += -p "$(PORT)"
|
2015-02-08 14:48:35 +01:00
|
|
|
export FFLAGS = flash
|
|
|
|
export DEBUGGER_FLAGS = debug
|
|
|
|
export DEBUGSERVER_FLAGS = debug-server
|
|
|
|
export RESET_FLAGS = reset
|
2014-08-05 00:51:23 +02:00
|
|
|
|
2014-11-18 18:02:09 +01:00
|
|
|
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
|
|
|
|
export CXXUWFLAGS +=
|
|
|
|
export CXXEXFLAGS +=
|
|
|
|
|
2014-08-05 00:51:23 +02:00
|
|
|
# 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
|