all : burn PART=attiny441 PROGPART=t441 #AVRP=~/cpptest/avr-toolchain/avr-toolchain/bin/avr- AVRP=avr- CFLAGS=-g -Wall -Os -mmcu=$(PART) -DF_CPU=14745600UL ASFLAGS:=$(CFLAGS) CC=avr-gcc burn : calibrate self-program burnfuses : sudo avrdude -c usbtiny -p $(PROGPART) -U lfuse:w:0x62:m -U hfuse:w:0xd5:m -U efuse:w:0xfe:m #Use internal 8MHz oscillator, default to /8, start-up time enabled. #SPI Programming enabled, Save EEPROM on chip erase + 2.7V brown-out detection. #Self-program enabled. readbin : sudo avrdude -c usbtiny -p $(PROGPART) -V -U flash:r:data.bin:r readbineep : sudo avrdude -c usbtiny -p $(PROGPART) -V -U eeprom:r:data.bin:r self-program : self-program.hex sudo avrdude -c usbtiny -p $(PROGPART) -V -U flash:w:self-program.hex self-program.hex : self-program.elf $(AVRP)objcopy -j .bootloader -j .caldata -j .text -j .data -O ihex $^ $@ $(AVRP)objdump -S $^ > self-program.lst self-program.elf : self-program.c ws2812b_single.c caldata.S $(AVRP)gcc -g $(CFLAGS) $(EXTREME_COMP) -mmcu=$(PART) -Wl,-Map,self-program.map -o $@ $^ -Wl,--section-start=.bootloader=0xd00 -Wl,--section-start=.caldata=0xfd0 -DISBOOTLOADER $(AVRP)size $@ calibrate : calibrate_base_burn calibrate_top sudo ./calibrate_top 3 calibrate_top : calibrate_top.c gcc -o $@ $^ -lusb -lm calibrate_base_burn : calibrate_base.hex burnfuses sudo avrdude -c usbtiny -p $(PROGPART) -V -U flash:w:calibrate_base.hex calibrate_base.hex : calibrate_base.c $(AVRP)gcc -I -g $(CFLAGS) -mmcu=$(PART) -Wl,-Map,calibrate_base.map -o calibrate_base.elf $^ -L/usr/lib/binutils/avr/2.18 $(AVRP)objcopy -j .text -j .data -O ihex calibrate_base.elf calibrate_base.hex clean : rm -f *~ high.txt low.txt *.o sendpack.S makesendpack self-program.hex self-program.elf