mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
75 lines
2.7 KiB
Makefile
75 lines
2.7 KiB
Makefile
# define the cpu used by the phyWAVE-KW22 board
|
|
export CPU = kw2x
|
|
export CPU_MODEL = kw21d256
|
|
#export CPU_MODEL = kw21d512
|
|
#export CPU_MODEL = kw22d512
|
|
|
|
#define the default port depending on the host OS
|
|
OS := $(shell uname)
|
|
ifeq ($(OS),Linux)
|
|
PORT ?= /dev/ttyACM0
|
|
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!)
|
|
endif
|
|
export PORT
|
|
|
|
# define tools used for building the project
|
|
export PREFIX = arm-none-eabi-
|
|
export CC = $(PREFIX)gcc
|
|
export AR = $(PREFIX)ar
|
|
export AS = $(PREFIX)as
|
|
export LINK = $(PREFIX)gcc
|
|
export SIZE = $(PREFIX)size
|
|
export OBJCOPY = $(PREFIX)objcopy
|
|
export OPENOCD ?= openocd
|
|
export DBG ?= $(PREFIX)gdb
|
|
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
|
|
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
|
|
|
|
.PHONY: flash
|
|
flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin
|
|
|
|
# Reset the default goal.
|
|
.DEFAULT_GOAL :=
|
|
|
|
|
|
# define build specific options
|
|
export CPU_USAGE = -mcpu=cortex-m4
|
|
export FPU_USAGE =
|
|
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mthumb-interwork -nostartfiles
|
|
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin
|
|
|
|
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian
|
|
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mthumb-interwork -nostartfiles
|
|
export LINKFLAGS += -T$(LINKERSCRIPT)
|
|
|
|
export FFLAGS = flash-elf
|
|
export DEBUGGER_FLAGS = debug
|
|
export DEBUGSERVER_FLAGS = debug-server
|
|
export RESET_FLAGS = reset
|
|
export TERMFLAGS = -p $(PORT)
|
|
export TUI = 1
|
|
# We need special handling of the watchdog if we want to speed up the flash
|
|
# verification by using the MCU to compute the image checksum after flashing.
|
|
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
|
|
# return control to the debugger (OpenOCD)
|
|
export OPENOCD_PRE_VERIFY_CMDS += \
|
|
-c 'load_image $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin 0x20000000 bin' \
|
|
-c 'resume 0x20000000'
|
|
export OPENOCD_EXTRA_INIT
|
|
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/kinetis_common/dist/check-fcfield-elf.sh
|
|
|
|
# use newLib nano-specs if 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
|
|
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
|