Skip to content
Snippets Groups Projects
Commit 26c28d22 authored by da1l6's avatar da1l6
Browse files

Add eeprom generation with KEY= option to makefile. ruby interpreter (>= 1.9.x) required.

parent bc1592ac
No related branches found
No related tags found
No related merge requests found
...@@ -146,8 +146,11 @@ AVRDUDE_PORT = usb # programmer connected to USB port ...@@ -146,8 +146,11 @@ AVRDUDE_PORT = usb # programmer connected to USB port
#AVRDUDE_PORT = lpt1 # programmer connected to parallel port #AVRDUDE_PORT = lpt1 # programmer connected to parallel port
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_BITS) AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_BITS)
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
ifneq ($(KEY),)
EEPROM_GEN_CMD=./eeprom_gen.rb $(TARGET).eep $(KEY)
AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
endif
#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -b 115200 -c $(AVRDUDE_PROGRAMMER) #AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -b 115200 -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS = -B 1 -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) AVRDUDE_FLAGS = -B 1 -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
...@@ -227,7 +230,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) ...@@ -227,7 +230,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target. # Default target.
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex \
$(TARGET).lss $(TARGET).sym sizeafter finished end $(TARGET).lss $(TARGET).sym sizeafter finished end
...@@ -286,7 +289,7 @@ extcoff: $(TARGET).elf ...@@ -286,7 +289,7 @@ extcoff: $(TARGET).elf
# Program the device. # Program the device.
program: $(TARGET).hex $(TARGET).eep program: $(TARGET).hex eepromgen
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
...@@ -298,11 +301,11 @@ program: $(TARGET).hex $(TARGET).eep ...@@ -298,11 +301,11 @@ program: $(TARGET).hex $(TARGET).eep
@echo $(MSG_FLASH) $@ @echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf # %.eep: %.elf
@echo # @echo
@echo $(MSG_EEPROM) $@ # @echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ # -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ # --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file. # Create extended listing file from ELF output file.
%.lss: %.elf %.lss: %.elf
...@@ -317,6 +320,9 @@ program: $(TARGET).hex $(TARGET).eep ...@@ -317,6 +320,9 @@ program: $(TARGET).hex $(TARGET).eep
avr-nm -n $< > $@ avr-nm -n $< > $@
eepromgen:
@echo
$(EEPROM_GEN_CMD)
# Link: create ELF output file from object files. # Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf .SECONDARY : $(TARGET).elf
...@@ -394,5 +400,5 @@ clean_list : ...@@ -394,5 +400,5 @@ clean_list :
# Listing of phony targets. # Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ .PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \
clean clean_list program clean clean_list program eepromgen
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment