- Vote on answer
- posted
10 years ago
AVR EEPROM
- Vote on answer
- posted
10 years ago
"make release".
FUSES = { (LFUSE_DEFAULT #if !UseCkDiv8 | uint8_t (~FUSE_CKDIV8) #endif ), (HFUSE_DEFAULT ) };
MCU = attiny13 DUDE_MCU = -pt13 DUDE_PROG = -cusbtiny #DUDE_PROG = -cstk500 -Pcom23
TARGET = main
FUSE_MEMORY_SIZE = 2
ifdef FUSE_MEMORY_SIZE
CMD_FUSE = -U fuse:w:lfuse.hex:a CMD_LFUSE = -U lfuse:w:lfuse.hex:a CMD_HFUSE = -U hfuse:w:hfuse.hex:a CMD_EFUSE = -U efuse:w:efuse.hex:a
ifeq "$(FUSE_MEMORY_SIZE)" "1"
CMD_FUSES = -u $(CMD_FUSE) FUSE_FILES = lfuse.hex
endif
ifeq "$(FUSE_MEMORY_SIZE)" "2"
CMD_FUSES = -u $(CMD_LFUSE) $(CMD_HFUSE) FUSE_FILES = lfuse.hex hfuse.hex
endif
ifeq "$(FUSE_MEMORY_SIZE)" "3"
CMD_FUSES = -u $(CMD_LFUSE) $(CMD_HFUSE) $(CMD_EFUSE) FUSE_FILES = lfuse.hex hfuse.hex efuse.hex
endif
endif
lfuse.hex: fuses.hex srec_cat fuses.hex -Intel -crop 0x820000 0x820001 -offset -0x820000 -O lfuse.hex -Intel
hfuse.hex: fuses.hex srec_cat fuses.hex -Intel -crop 0x820001 0x820002 -offset -0x820001 -O hfuse.hex -Intel
efuse.hex: fuses.hex srec_cat fuses.hex -Intel -crop 0x820002 0x820003 -offset -0x820002 -O efuse.hex -Intel
DEF_GCC_FLAGS = -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct
-fshort-enums -Wall -mmcu=$(MCU) -std=gnu++0x
.cpp.o: avr-gcc $(DEF_GCC_FLAGS) -c -Wa,-adhlns=main.lst $< -o $@
$(TARGET).elf: main.o avr-gcc $(DEF_GCC_FLAGS) -Wa,-adhlns=main.o main.o --output $(TARGET).elf
-Wl,-Map=$(TARGET).map,--cref
$(TARGET).hex: $(TARGET).elf avr-objcopy -j .fuse -O ihex $(TARGET).elf fuses.hex avr-objcopy -R .fuse -O ihex $(TARGET).elf avr-objcopy -O ihex -R .eeprom $(TARGET).elf $(TARGET).hex
all: $(TARGET).hex $(FUSE_FILES)
program: all avrdude $(DUDE_PROG) $(DUDE_MCU) -U flash:w:$(TARGET).hex:a $(CMD_FUSES)
clean: rm -f $(TARGET).{hex,o,elf,lst,map} {fuses,lfuse,hfuse}.hex
- Vote on answer
- posted
10 years ago
EM> .cpp.o: EM> avr-gcc $(DEF_GCC_FLAGS) -c -Wa,-adhlns=main.lst $< -o $@
EM> $(TARGET).elf: main.o
[...]icq:240059686, lj-user:nicka_startcev
- Vote on answer
- posted
10 years ago