hacked at makefile to run tests

This commit is contained in:
Jake Goodwin 2023-02-18 23:06:22 -08:00
parent 57a476193c
commit 07603eeda4
1 changed files with 5 additions and 6 deletions

View File

@ -8,7 +8,6 @@
#MCU = atmega2560 #MCU = atmega2560
#MCU = attiny85 #MCU = attiny85
MCU = atmega328p MCU = atmega328p
#F_CPU = 1000000UL
F_CPU = 14745600UL F_CPU = 14745600UL
BAUD = 9600UL BAUD = 9600UL
## Also try BAUD = 19200 or 38400 if you're feeling lucky. ## Also try BAUD = 19200 or 38400 if you're feeling lucky.
@ -57,7 +56,7 @@ AVRDUDE = avrdude
## The name of your project (without the .c) ## The name of your project (without the .c)
# TARGET = blinkLED # TARGET = blinkLED
## Or name it automatically after the enclosing directory ## Or name it automatically after the enclosing directory
TARGET = $(DEBUG_DIR)/$(lastword $(subst /, ,$(CURDIR))) TARGET = $(lastword $(subst /, ,$(CURDIR)))
# Object files: will find all .c/.h files in current directory # Object files: will find all .c/.h files in current directory
# and in LIBDIR. If you have any other (sub-)directories with code, # and in LIBDIR. If you have any other (sub-)directories with code,
@ -85,7 +84,7 @@ TARGET_ARCH = -mmcu=$(MCU)
## Explicit pattern rules: ## Explicit pattern rules:
## To make .o files from .c files ## To make .o files from .c files
%.o: %.c $(HEADERS) Makefile %.o: %.c $(HEADERS) Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $(DEBUG_DIR)/$@ $<; $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<;
$(TARGET).elf: $(OBJECTS) $(TARGET).elf: $(OBJECTS)
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $(DEBUG_DIR)/$@ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $(DEBUG_DIR)/$@
@ -94,10 +93,10 @@ $(TARGET).elf: $(OBJECTS)
$(OBJCOPY) -j .text -j .data -O ihex $(DEBUG_DIR)/$< $(DEBUG_DIR)/$@ $(OBJCOPY) -j .text -j .data -O ihex $(DEBUG_DIR)/$< $(DEBUG_DIR)/$@
%.eeprom: %.elf %.eeprom: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $(DEBUG_DIR)$< $(DEBUG_DIR)/$@ $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $(DEBUG_DIR)/$< $(DEBUG_DIR)/$@
%.lst: %.elf %.lst: %.elf
$(OBJDUMP) -S $(DEBUG_DIR)$< > $(DEBUG_DIR)/$@ $(OBJDUMP) -S $(DEBUG_DIR)/$< > $(DEBUG_DIR)/$@
## These targets don't have files named after them ## These targets don't have files named after them
.PHONY: all disassemble disasm eeprom size clean squeaky_clean flash fuses .PHONY: all disassemble disasm eeprom size clean squeaky_clean flash fuses
@ -136,7 +135,7 @@ squeaky_clean:
########## Flashing code to AVR using avrdude ########## ########## Flashing code to AVR using avrdude ##########
##########------------------------------------------------------########## ##########------------------------------------------------------##########
flash: $(TARGET).hex flash: $(DEBUG_DIR)/$(TARGET).hex
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$< $(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<
## An alias ## An alias