diff --git a/boards/mbed_lpc1768/Makefile.include b/boards/mbed_lpc1768/Makefile.include index 8c092b07b7..7f08a0068a 100644 --- a/boards/mbed_lpc1768/Makefile.include +++ b/boards/mbed_lpc1768/Makefile.include @@ -1,7 +1,19 @@ -## the cpu to build for +# define the cpu used by the mbed_lpx1768 board export CPU = lpc1768 -# toolchain config +#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 export CXX = $(PREFIX)g++ @@ -10,8 +22,12 @@ export AS = $(PREFIX)as export LINK = $(PREFIX)gcc export SIZE = $(PREFIX)size export OBJCOPY = $(PREFIX)objcopy +export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm +export FLASHER = +export DEBUGGER = +export DEBUGSERVER = -# define build options +# define build specific options CPU_USAGE = -mcpu=cortex-m3 FPU_USAGE = export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mthumb-interwork -nostartfiles @@ -19,21 +35,20 @@ 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$(RIOTCPU)/$(CPU)/LPC1768.ld - -#LINKFLAGS += -mcpu=cortex-m3 -mthumb -Wl,--gc-sections,--cref -lc -lgcc -lnosys -nostartfiles - -ifeq ($(strip $(PORT)),) - export PORT = /dev/ttyUSB0 -endif -export FFLAGS = $(HEXFILE) - -export DEBUGGER_FLAGS = $(ELFFILE) - -export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include/ -I$(RIOTCPU)/$(CPU)/include export OFLAGS = -O binary - -export UNDEF += $(BINDIR)cpu/startup.o +export FFLAGS = +export DEBUGGER_FLAGS = +export TERMFLAGS += -p "$(PORT)" # unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++ export CXXUWFLAGS += export CXXEXFLAGS += + +# use newLib nano-specs if available +ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null