added target avrdude to flash compiled firmware to mcu
parent
45101bdbc7
commit
7c9b1a4dd6
38
Makefile
38
Makefile
|
@ -11,16 +11,16 @@ include $(BASE)/Makefile
|
||||||
|
|
||||||
ifeq (,$(MAKEBASE))
|
ifeq (,$(MAKEBASE))
|
||||||
export MAKEBASE=$(realpath $(firstword $(MAKEFILE_LIST)))
|
export MAKEBASE=$(realpath $(firstword $(MAKEFILE_LIST)))
|
||||||
else
|
endif
|
||||||
ifneq (,$(wildcard $(BASE)/.depends.make))
|
|
||||||
include $(wildcard $(BASE)/.depends.make)
|
|
||||||
|
|
||||||
include $(realpath $(foreach CDEP,$(COMPDEPENDS),$(CDEP)/global.make))
|
ifneq (,$(wildcard $(BASE)/.depends.make))
|
||||||
|
include $(wildcard $(BASE)/.depends.make)
|
||||||
CDEPENDS=$(call reverse,$(COMPDEPENDS))
|
|
||||||
DEPINC=$(CDEPENDS:%=-I%/include)
|
include $(realpath $(foreach CDEP,$(call reverse,$(COMPDEPENDS)),$(CDEP)/global.make))
|
||||||
|
|
||||||
|
CDEPENDS=$(call reverse,$(COMPDEPENDS))
|
||||||
|
DEPINC=$(CDEPENDS:%=-I%/include)
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (,$(FINALNAME))
|
ifeq (,$(FINALNAME))
|
||||||
|
@ -39,6 +39,7 @@ LD=$(COMPILER_PREFIX)gcc
|
||||||
AR=$(COMPILER_PREFIX)ar
|
AR=$(COMPILER_PREFIX)ar
|
||||||
SIZE=$(COMPILER_PREFIX)size
|
SIZE=$(COMPILER_PREFIX)size
|
||||||
OBJCOPY=$(COMPILER_PREFIX)objcopy
|
OBJCOPY=$(COMPILER_PREFIX)objcopy
|
||||||
|
AVRDUDE=sudo avrdude
|
||||||
|
|
||||||
ifeq ($(BASE),$(CURDIR))
|
ifeq ($(BASE),$(CURDIR))
|
||||||
DEPLIBS:=$(foreach DEPLIB,$(CDEPENDS),$(BASE)/.build/libdep-$(subst /,_,$(DEPLIB).a))
|
DEPLIBS:=$(foreach DEPLIB,$(CDEPENDS),$(BASE)/.build/libdep-$(subst /,_,$(DEPLIB).a))
|
||||||
|
@ -65,6 +66,20 @@ LDFLAGS+=$(foreach DEP,$(CDEPENDS),$(BASE)/.build/libdep-$(subst /,_,$(DEP)).a)
|
||||||
LDFLAGS+=$(foreach DEP,$(CDEPENDS),$(BASE)/.build/libdep-$(subst /,_,$(DEP)).a)
|
LDFLAGS+=$(foreach DEP,$(CDEPENDS),$(BASE)/.build/libdep-$(subst /,_,$(DEP)).a)
|
||||||
|
|
||||||
|
|
||||||
|
ifneq ($(AVR_FUSE_EXTENDED),)
|
||||||
|
AVRDUDE_OPERATIONS+=-U efuse:w:$(AVR_FUSE_EXTENDED):m
|
||||||
|
endif
|
||||||
|
ifneq ($(AVR_FUSE_HIGH),)
|
||||||
|
AVRDUDE_OPERATIONS+=-U hfuse:w:$(AVR_FUSE_HIGH):m
|
||||||
|
endif
|
||||||
|
ifneq ($(AVR_FUSE_LOW),)
|
||||||
|
AVRDUDE_OPERATIONS+=-U lfuse:w:$(AVR_FUSE_LOW):m
|
||||||
|
endif
|
||||||
|
ifeq (,$(AVR_PROG))
|
||||||
|
AVR_PROG=avrisp2
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
.SILENT:
|
.SILENT:
|
||||||
.PHONY: clean build null dependslibs libdep.a
|
.PHONY: clean build null dependslibs libdep.a
|
||||||
|
|
||||||
|
@ -128,7 +143,7 @@ $(BASE)/.build/libdep-$(subst /,_,$(CURDIR)).a.d/%.o: $(CURDIR)/src/%.S
|
||||||
|
|
||||||
$(BASE)/.build/libdep-$(subst /,_,$(CURDIR)).a.d/%.o: $(CURDIR)/src/%.cc
|
$(BASE)/.build/libdep-$(subst /,_,$(CURDIR)).a.d/%.o: $(CURDIR)/src/%.cc
|
||||||
echo "[ COMPILE C++ ] $<"
|
echo "[ COMPILE C++ ] $<"
|
||||||
$(GCC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
|
$(GCC) -c -o $@ $< -MMD -MF "$(dir $@)/.$(notdir $@).dep" $(CFLAGS) $(CPPFLAGS)
|
||||||
|
|
||||||
$(BASE)/.build/libdep-$(subst /,_,$(CURDIR)).a.d/%.o: $(CURDIR)/src/%.txt
|
$(BASE)/.build/libdep-$(subst /,_,$(CURDIR)).a.d/%.o: $(CURDIR)/src/%.txt
|
||||||
echo "[ IGNORE ] $<"
|
echo "[ IGNORE ] $<"
|
||||||
|
@ -155,7 +170,7 @@ $(BASE)/.build/%.o: $(CURDIR)/src/%.S
|
||||||
|
|
||||||
$(BASE)/.build/%.o: $(CURDIR)/src/%.cc
|
$(BASE)/.build/%.o: $(CURDIR)/src/%.cc
|
||||||
echo "[ COMPILE C++ ] $<"
|
echo "[ COMPILE C++ ] $<"
|
||||||
$(GCC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
|
$(GCC) -c -o $@ $< -MMD -MF "$(dir $@)/.$(notdir $@).dep" $(CFLAGS) $(CPPFLAGS)
|
||||||
|
|
||||||
$(BASE)/.build/%.o: $(CURDIR)/src/%.txt
|
$(BASE)/.build/%.o: $(CURDIR)/src/%.txt
|
||||||
echo "[ IGNORE ] $<"
|
echo "[ IGNORE ] $<"
|
||||||
|
@ -164,7 +179,8 @@ $(BASE)/.build/%.o: $(CURDIR)/src/%.txt
|
||||||
|
|
||||||
$(BASE)/.build/.%.dep:
|
$(BASE)/.build/.%.dep:
|
||||||
|
|
||||||
|
avrdude: $(BASE)/bin/$(FINALNAME).hex
|
||||||
|
$(AVRDUDE) -c $(AVR_PROG) -p $(AVR_MCU) -P usb: -B 8 $(AVRDUDE_OPERATIONS) -U flash:w:$(BASE)/bin/$(FINALNAME).hex
|
||||||
|
|
||||||
include $(wildcard $(MODULEDEPS))
|
include $(wildcard $(MODULEDEPS))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue