2008-12-03 05:40:16 +00:00
|
|
|
# ethersex project specific defaults, each can be overridden in config.mk
|
|
|
|
F_CPU = 20000000UL
|
|
|
|
MCU = atmega644
|
|
|
|
|
|
|
|
CC=avr-gcc
|
|
|
|
AR=avr-ar
|
|
|
|
OBJCOPY = avr-objcopy
|
|
|
|
OBJDUMP = avr-objdump
|
|
|
|
AS = avr-as
|
|
|
|
CP = cp
|
|
|
|
RM = rm -f
|
|
|
|
AVRDUDE = avrdude
|
|
|
|
AVRDUDE_BAUDRATE = 115200
|
|
|
|
SIZE = avr-size
|
|
|
|
STRIP = avr-strip
|
|
|
|
|
|
|
|
HOSTCC := gcc
|
|
|
|
export HOSTCC
|
|
|
|
|
|
|
|
# flags for the compiler
|
|
|
|
CFLAGS ?= -Wall -W -Wno-unused-parameter -Wno-sign-compare
|
2009-12-27 02:11:58 +00:00
|
|
|
CFLAGS += -g -Os -std=gnu99 -fgnu89-inline -DNDEBUG
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
# flags for the linker
|
2010-08-24 23:01:59 +00:00
|
|
|
LDFLAGS += -T ./avr5.x -Wl,-Map,image.map -mmcu=$(MCU)
|
2008-12-03 05:40:16 +00:00
|
|
|
|
|
|
|
|
2008-12-03 13:22:20 +00:00
|
|
|
#############################################################################
|
|
|
|
#Settings for Simulator build
|
|
|
|
|
2008-12-28 21:49:28 +00:00
|
|
|
OSTYPE = $(shell echo $$OSTYPE)
|
2009-07-18 16:55:02 +00:00
|
|
|
MACHINE = $(shell uname -m)
|
2008-12-28 21:49:28 +00:00
|
|
|
#$(info $(OSTYPE))
|
|
|
|
|
|
|
|
ifeq ($(OSTYPE),cygwin)
|
2009-12-27 02:11:58 +00:00
|
|
|
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O0 -D_WIN32 -mno-cygwin
|
2008-12-28 21:49:28 +00:00
|
|
|
LDFLAGS_SIM = -Wl -mno-cygwin -T simulator/i386pe.x
|
2009-01-02 02:18:20 +00:00
|
|
|
LIBS_SIM = -lglut32 -lglu32 -lopengl32
|
2008-12-28 21:49:28 +00:00
|
|
|
else
|
2009-10-31 15:12:19 +00:00
|
|
|
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O0
|
2009-07-18 16:55:02 +00:00
|
|
|
ifeq ($(MACHINE),x86_64)
|
|
|
|
LDFLAGS_SIM = -Wl -T simulator/elf_x86_64.x
|
|
|
|
else
|
|
|
|
LDFLAGS_SIM = -Wl -T simulator/elf_i386.x
|
|
|
|
endif
|
2009-01-02 02:18:20 +00:00
|
|
|
LIBS_SIM = -lglut -lpthread -lGL -lGLU
|
2008-12-28 21:49:28 +00:00
|
|
|
endif
|
2008-12-03 13:22:20 +00:00
|
|
|
|
2008-12-03 05:40:16 +00:00
|
|
|
##############################################################################
|
|
|
|
# the default target
|
|
|
|
$(TARGET):
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# include user's config.mk file
|
|
|
|
|
|
|
|
$(TOPDIR)/config.mk:
|
|
|
|
@echo "# Put your own config here!" > $@
|
|
|
|
@echo "#F_CPU = $(F_CPU)" >> $@
|
|
|
|
@echo "#MCU = $(MCU)" >> $@
|
|
|
|
@echo "created default config.mk, tune your settings there!"
|
|
|
|
-include $(TOPDIR)/config.mk
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# configure load address for bootloader, if enabled
|
|
|
|
#
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
|
|
ifneq ($(MAKECMDGOALS),mrproper)
|
|
|
|
ifneq ($(MAKECMDGOALS),menuconfig)
|
|
|
|
|
|
|
|
include $(TOPDIR)/.config
|
|
|
|
|
|
|
|
CPPFLAGS += -DF_CPU=$(FREQ)UL -mmcu=$(MCU)
|
|
|
|
|
|
|
|
endif # MAKECMDGOALS!=menuconfig
|
|
|
|
endif # MAKECMDGOALS!=mrproper
|
|
|
|
endif # MAKECMDGOALS!=clean
|
|
|
|
|
|
|
|
ifeq ($(BOOTLOADER_SUPPORT),y)
|
|
|
|
LDFLAGS += -Wl,--section-start=.text=0xE000
|
|
|
|
CFLAGS += -mcall-prologues
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
%.s: %.c
|
|
|
|
$(CC) -o $@ -O0 $(CPPFLAGS) -S $<
|
|
|
|
|
|
|
|
%.E: %.c
|
|
|
|
$(CC) -o $@ -O0 $(CPPFLAGS) -C -E -dD $<
|
|
|
|
|