Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include prorab.mk
- this_cc := avr-gcc
- this_cxx := avr-g++
- this_name := binaryname
- #pick all .c and .cpp files from '.' directory, i.e. same dir where makefile resides
- this_srcs := $(call prorab-src-dir, .)
- this_mcu := atmega8a
- #compiler flags
- this_cxxflags += -Wall
- this_cxxflags += -Werror
- this_cxxflags += -g
- this_cxxflags += -mmcu=$(this_mcu)
- this_cxxflags += -std=c++11
- this_cxxflags += -O3
- #atmega frequency
- this_cpuFreq := 1000000
- #add F_CPU macro definition
- this_cxxflags += -DF_CPU=$(this_cpuFreq)
- # need to pass correct MCU to linker as well
- this_ldflags += -mmcu=$(this_mcu)
- #this string actually generates all build rules for the binary
- $(eval $(prorab-build-app))
- #here we define additional rules for genearing .hex file and flashing with avrdude
- define this_rules :=
- $(prorab_this_name).hex: $(prorab_this_name)
- @echo "Generating .hex file..."
- $(prorab_echo)avr-objcopy -j .text -j .data -O ihex $$^ $$@
- all: $(prorab_this_name).hex
- clean::
- $(prorab_echo)rm -f $(prorab_this_name).hex
- .PHONY: flash
- flash:: $(prorab_this_name).hex
- @echo "flashing..."
- $(prorab_echo)avrdude -c usbasp -p m8 -U flash:w:$(prorab_this_name).hex:i
- endef
- $(eval $(this_rules))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement