2013-03-23 18:38:12 +01:00
|
|
|
ifeq ($(strip $(RIOTCPU)),)
|
|
|
|
export RIOTCPU =$(RIOTBASE)/cpu
|
|
|
|
endif
|
|
|
|
|
2013-03-31 22:14:06 +02:00
|
|
|
ifeq ($(strip $(MCU)),)
|
|
|
|
MCU = $(CPU)
|
|
|
|
endif
|
2013-03-23 18:38:12 +01:00
|
|
|
|
2013-03-10 16:51:40 +01:00
|
|
|
# if you want to publish the board into the sources as an uppercase #define
|
|
|
|
BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z')
|
|
|
|
CFLAGS += -DBOARD=$(BB)
|
|
|
|
export CFLAGS
|
|
|
|
|
|
|
|
# mandatory include!
|
|
|
|
include $(RIOTBOARD)/$(BOARD)/Makefile.include
|
2013-03-13 16:49:23 +01:00
|
|
|
include $(RIOTBASE)/Makefile.modules
|
2013-03-10 16:51:40 +01:00
|
|
|
|
|
|
|
# your binaries to link
|
|
|
|
BASELIBS += $(RIOTBOARD)/$(BOARD)/bin/$(BOARD)_base.a
|
|
|
|
BASELIBS += $(PROJBINDIR)/project.a
|
|
|
|
|
|
|
|
PROJBINDIR =$(CURDIR)/bin
|
|
|
|
|
|
|
|
## make script for your project. Build RIOT-base here!
|
|
|
|
all: $(PROJBINDIR)/$(PROJECT).a
|
2013-03-30 21:44:16 +01:00
|
|
|
@echo "Building project $(PROJECT) for $(BOARD) w/ MCU $(MCU)."
|
2013-03-10 16:51:40 +01:00
|
|
|
$(MAKE) -C $(RIOTBOARD)
|
|
|
|
$(MAKE) -C $(RIOTBASE)
|
2013-03-23 18:38:12 +01:00
|
|
|
@$(LINK) $(UNDEF) -o $(PROJBINDIR)/$(PROJECT).elf -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(PROJBINDIR)/$(PROJECT).map $(LINKFLAGS)
|
|
|
|
@$(SIZE) $(PROJBINDIR)/$(PROJECT).elf
|
|
|
|
@$(OBJCOPY) -O ihex $(PROJBINDIR)/$(PROJECT).elf $(PROJBINDIR)/$(PROJECT).hex
|
2013-03-10 16:51:40 +01:00
|
|
|
|
|
|
|
## your make rules
|
|
|
|
## Only basic example - modify it for larger projects!!
|
|
|
|
$(PROJBINDIR)/$(PROJECT).a: $(PROJBINDIR)/$(PROJECT).o
|
|
|
|
$(AR) -rc $(PROJBINDIR)/project.a $(PROJBINDIR)/$(PROJECT).o
|
|
|
|
|
|
|
|
$(PROJBINDIR)/$(PROJECT).o: main.c
|
|
|
|
$(CC) $(CFLAGS) $(BOARDINCLUDE) $(INCLUDES) -c main.c -o $(PROJBINDIR)/$(PROJECT).o
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(MAKE) -C $(RIOTBOARD) clean
|
|
|
|
$(MAKE) -C $(RIOTBASE) clean
|
|
|
|
rm -f $(PROJBINDIR)/*
|
|
|
|
|
|
|
|
flash: all
|
2013-03-13 16:49:23 +01:00
|
|
|
$(FLASHER) $(PORT) $(PROJBINDIR)/$(PROJECT).hex
|
2013-03-10 16:51:40 +01:00
|
|
|
|
|
|
|
term:
|
|
|
|
$(TERM) $(PORT)
|
|
|
|
|
|
|
|
doc:
|
|
|
|
make -BC $(RIOTBASE) doc
|