Created
February 18, 2019 02:48
-
-
Save MatthaeusHarris/3e721249dbc9ee1b3fa280e4346b05cd to your computer and use it in GitHub Desktop.
Non-working makefile (compiles, but code does not run on microcontroller)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRG = binaryclock | |
MCU_TARGET = atmega328p | |
PROGRAMMER = usbtiny | |
PFLAGS = #-P /dev/ttyUSB0 | |
OPTIMIZE = -Os | |
DEFS = -DF_CPU=1000000UL | |
LIBS = | |
HEADERS = | |
CC = avr-gcc | |
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) | |
override LDFLAGS = -W1,-Map,$(PRG).map | |
OBJCOPY = avr-objcopy | |
OBJDUMP = avr-objdump | |
FLASH = avrdude | |
all: $(PRG).hex | |
$(PRG).hex: $(PRG).elf | |
$(OBJCOPY) -O ihex -R .eeprom $(PRG).elf $(PRG).hex | |
$(PRG).elf: $(PRG).o twimaster.o | |
$(CC) $(PRG).o twimaster.o -o $(PRG).elf | |
$(PRG).o: $(PRG).c $(HEADERS) | |
$(CC) $(CFLAGS) -c $(PRG).c -o $(PRG).o | |
twimaster.o: twimaster.c | |
$(CC) $(CFLAGS) -c twimaster.c -o twimaster.o | |
flash: | |
$(FLASH) -c $(PROGRAMMER) $(PFLAGS) -p $(MCU_TARGET) -U flash:w:$(PRG).hex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment