improved debug output

This commit is contained in:
King Kévin 2015-02-26 14:09:37 +01:00
parent a8177deb21
commit 76385bc076
1 changed files with 14 additions and 5 deletions

View File

@ -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