MCU = attiny85 F_CPU = 16000000 RM = rm -rf EXTRAINCDIR = include CSTANDARD = gnu99 GCC = avr-gcc SIZE = avr-size OBJCOPY = avr-objcopy OBJDUMP = avr-objdump AVRDUDE = avrdude SRC = src/spi.c SRC += src/cc2500.c SRC += src/frsky_arduino_rx_complete.c OBJ = $(SRC:.c=.o) CARGS = -mmcu=$(MCU) CARGS += -I$(EXTRAINCDIR) CARGS += -Os CARGS += -funsigned-char CARGS += -funsigned-bitfields CARGS += -fpack-struct CARGS += -fshort-enums CARGS += -Wall -pedantic -Wstrict-prototypes -Wshadow CARGS += -Wpointer-arith -Wcast-qual -Wextra CARGS += -Wno-write-strings -Wno-unused-parameter CARGS += -std=$(CSTANDARD) CARGS += -DF_CPU=$(F_CPU) #CARGS += -lm -lprintf_flt CARGS += -ffunction-sections LINKER = -Wl,--relax #LINKER = -Wl,--relax,-u,vfprintf,-lm,-lprintf_flt,-u,vfscanf,-lscanf_flt #LINKER += -Wl,--defsym=__heap_start=0x802200,--defsym=__heap_end=0x80ffff #LINKER += -Wl,-gc-sections PROGRAMMER = avrisp2 ISPPORT = usb TARGET = rx all: $(TARGET).hex %.o: %.c $(GCC) -c $< -o $@ $(CARGS) $(TARGET).elf: $(OBJ) $(GCC) $(CARGS) $(OBJ) --output $@ $(LINKER) -Wl,-Map -Wl,$(@:.elf=.map) $(SIZE) --mcu=$(MCU) -C $@ $(TARGET).hex: $(TARGET).elf $(OBJCOPY) -O ihex $< $@ $(OBJDUMP) -h -S $< > $(@:.hex=.lss) program: $(TARGET).hex $(AVRDUDE) -p $(MCU) -c $(PROGRAMMER) -P $(ISPPORT) -e -U $(TARGET).hex clean: $(RM) $(OBJ) $(RM) *.o $(RM) *.elf $(RM) *.hex $(RM) *.lss $(RM) *.map