mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
45 lines
1.7 KiB
Makefile
45 lines
1.7 KiB
Makefile
|
# define the cpu used by the arduino uno and duemilanove boards
|
|||
|
export CPU = atmega328p
|
|||
|
|
|||
|
# define port used to flash the board
|
|||
|
OS = $(shell uname)
|
|||
|
ifeq ($(OS),Linux)
|
|||
|
PORT = $(LINUX_PORT)
|
|||
|
else ifeq ($(OS),Darwin)
|
|||
|
PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|||
|
else
|
|||
|
$(info CAUTION: No flash tool for your host system found!)
|
|||
|
# TODO: fix for building under windows
|
|||
|
endif
|
|||
|
|
|||
|
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
|
|||
|
export TERMFLAGS = -b 9600 -p $(PORT)
|
|||
|
export FLASHER = avrdude
|
|||
|
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 arduino which is the internal flasher via USB. Can be
|
|||
|
# overridden for debugging (which requires changes that require to use an ISP)
|
|||
|
export PROGRAMMER ?= arduino
|
|||
|
|
|||
|
ifeq ($(PROGRAMMER), arduino)
|
|||
|
export PROGRAMMER_FLAGS = -P $(PORT) -b $(PROGRAMMER_SPEED)
|
|||
|
endif
|
|||
|
|
|||
|
# define build specific options
|
|||
|
export CFLAGS_CPU = -mmcu=atmega328p $(CFLAGS_FPU)
|
|||
|
export CFLAGS_LINK = -ffunction-sections -fdata-sections -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) -static -lgcc -e reset_handler
|
|||
|
export OFLAGS += -j .text -j .data -O ihex
|
|||
|
export FFLAGS += -p atmega328p -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -D -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex
|