Makefile.include
1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# define the cpu used by the waspmote pro board
export CPU = atmega1281
# define tools used for building the project
export PREFIX = avr-
export CC = $(PREFIX)gcc
export CXX = $(PREFIX)c++
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 TERMFLAGS = -b 9600 -p $(PORT)
#define the flash-tool and default port depending on the host operating system
OS = $(shell uname)
ifeq ($(OS),Linux)
PORT ?= /dev/ttyACM0
FLASHER = avrdude
else ifeq ($(OS),Darwin)
PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
FLASHER = avrdude
else
$(info CAUTION: No flash tool for your host system found!)
# TODO: fix for building under windows
endif
export FLASHER
export PORT
export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
export DEBUGSERVER_PORT = 4242
export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
# PROGRAMMER defaults to stk500v1 which is the internal flasher via USB. Can be
# overridden for debugging (which requires changes that require to use an ISP)
export PROGRAMMER ?= stk500v1
ifeq ($(PROGRAMMER), stk500v1)
export PROGRAMMER_FLAGS = -P $(PORT) -b 115200
endif
# define build specific options
export CFLAGS_CPU = -mmcu=atmega1281 $(CFLAGS_FPU)
export CFLAGS_LINK = -fno-builtin -fshort-enums
export CFLAGS_DBG = -ggdb -g3
export CFLAGS_OPT ?= -Os
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG)
export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -e reset_handler
export OFLAGS += -j .text -j .data -O ihex
export FFLAGS += -p m1281 -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex