diff --git a/Makefile b/Makefile index 87c3668..ba37e66 100644 --- a/Makefile +++ b/Makefile @@ -45,11 +45,11 @@ OBJ = $(SRC:.c=.o) # listing files. LST = $(SRC:.c=.lst) -all: compile $(TARGET).lst flash +all: compile flash $(info EEPROM has to be programmed separately) debug: CFLAGS += -DDEBUG -debug: all +debug: map lst all # reset board by setting DTR # the capacitor on DTR with create a pulse on RESET @@ -60,11 +60,11 @@ reset: # flash the device using the internal bootloader flash: $(TARGET).hex reset - $(FLASHER) -U flash:w:$(TARGET).hex:i + $(FLASHER) -U flash:w:$<:i # write EEPROM on the device eeprom: $(TARGET)_eeprom.hex reset - $(FLASHER) -U eeprom:w:$(TARGET)_eeprom.hex:i + $(FLASHER) -U eeprom:w:$<:i # write bootloader and fuses bootloader: @@ -76,13 +76,22 @@ bootloader: compile: $(TARGET).elf $(SIZE) --format=avr --mcu=$(DEVICE) $(TARGET).elf +# C + ASM file +lst: $(TARGET).lst + +# contains global and static variables +map: $(TARGET).map + # compile source files %.o: %.c %.h $(CC) $(CFLAGS) -c -o $@ $< # link compiled files %.elf: $(OBJ) - $(CC) $(LDFLAGS) -o $@ $(OBJ) + $(CC) $(LDFLAGS) -o $@ $^ + +$(TARGET).map: $(OBJ) + $(CC) $(LDFLAGS) -Wl,-Map=$@,--cref -o /dev/null $^ # create extended listing for additional information %.lst: %.elf