-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2852 from kaspar030/refactor_board_makefiles
make: boards: refactor board makefiles
- Loading branch information
Showing
56 changed files
with
350 additions
and
4,346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# we build all cortex boards with the GNU toolchain | ||
export PREFIX = arm-none-eabi- | ||
include $(RIOTBOARD)/Makefile.include.gnu | ||
|
||
# use cortex name of CPU folder, but enable board Makefile to override | ||
export MCPU ?= $(CORTEX) | ||
|
||
# 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 | ||
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) | ||
export LINKFLAGS += $(CFLAGS_DEBUG) $(CFLAGS_CPU) $(CFLAGS_STYLE) -static -lgcc -nostartfiles -T$(LINKERSCRIPT) | ||
|
||
export OFLAGS ?= -O ihex | ||
export FFLAGS ?= flash | ||
export DEBUGGER_FLAGS ?= debug | ||
export DEBUGSERVER_FLAGS ?= debug-server | ||
export RESET_FLAGS ?= reset | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export CC = $(PREFIX)gcc | ||
export CXX = $(PREFIX)g++ | ||
export AR = $(PREFIX)ar | ||
export AS = $(PREFIX)as | ||
export LINK = $(PREFIX)gcc | ||
export SIZE = $(PREFIX)size | ||
export OBJCOPY = $(PREFIX)objcopy | ||
export DBG = $(PREFIX)gdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# set default port depending on operating system | ||
OS := $(shell uname) | ||
ifeq ($(OS),Linux) | ||
PORT ?= $(PORT_LINUX) | ||
else ifeq ($(OS),Darwin) | ||
PORT ?= $(PORT_DARWIN) | ||
endif | ||
|
||
ifeq ($(PORT),) | ||
$(info Warning: no PORT set!) | ||
endif | ||
|
||
export BAUD ?= 115200 | ||
export TERMFLAGS += -p "$(PORT)" -b "$(BAUD)" | ||
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm | ||
|
||
export PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,15 @@ | ||
# define the cpu used by the arduino due board | ||
export CPU = sam3x8e | ||
|
||
# define tools used for building the project | ||
export PREFIX = arm-none-eabi- | ||
export CC = $(PREFIX)gcc | ||
export CXX = $(PREFIX)g++ | ||
export AR = $(PREFIX)ar | ||
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 = $(RIOTBOARD)/$(BOARD)/dist/flash.sh | ||
export OFLAGS = -O binary | ||
|
||
#define the flash-tool and default port depending on the host operating system | ||
OS := $(shell uname) | ||
ifeq ($(OS),Linux) | ||
PORT ?= /dev/ttyACM0 | ||
else ifeq ($(OS),Darwin) | ||
PORT ?= $(shell ls -1 /dev/tty.usbmodem* | 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 the default port depending on the host OS | ||
PORT_LINUX ?= /dev/ttyACM0 | ||
PORT_DARWIN ?= $(shell ls -1 /dev/tty.usbmodem* | head -n 1) | ||
|
||
# define build specific options | ||
export CPU_USAGE = -mcpu=cortex-m3 | ||
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mno-thumb-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 -mno-thumb-interwork -nostartfiles | ||
# linkerscript specified in cpu/Makefile.include | ||
export LINKFLAGS += -T$(LINKERSCRIPT) | ||
export OFLAGS += -O binary | ||
export TERMFLAGS += -p "$(PORT)" | ||
# setup serial terminal | ||
include $(RIOTBOARD)/Makefile.include.serial | ||
|
||
# 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 | ||
# include cortex defaults | ||
include $(RIOTBOARD)/Makefile.include.cortex_common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.