diff options
author | Nao Pross <naopross@thearcway.org> | 2018-10-30 12:07:58 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-10-30 12:34:37 +0100 |
commit | cda16639cbf19d6eb5c11f05f1045e54b3fdaba9 (patch) | |
tree | 25227b76ae6dd50d5eddc30e4806af2003e70f54 /sw-avr/rom-loader/makefile | |
parent | Update gitignore (diff) | |
download | z80uPC-cda16639cbf19d6eb5c11f05f1045e54b3fdaba9.tar.gz z80uPC-cda16639cbf19d6eb5c11f05f1045e54b3fdaba9.zip |
[avr] Add test program for IO and basic usart
Diffstat (limited to 'sw-avr/rom-loader/makefile')
-rw-r--r-- | sw-avr/rom-loader/makefile | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sw-avr/rom-loader/makefile b/sw-avr/rom-loader/makefile index e68174f..85222c8 100644 --- a/sw-avr/rom-loader/makefile +++ b/sw-avr/rom-loader/makefile @@ -1,17 +1,24 @@ -CC=avr-gcc -CARGS=-Wall -mmcu=atmega328p -D__AVR_ATmega328p__ -Os -I. +SOURCES := main.c usart.c +OBJECTS := $(patsubst %.c,%.o,$(SOURCES)) -SOURCES=main.c +CFLAGS := -Wall -mmcu=atmega328p -Os -I. \ + -D__AVR_ATmega328p__ -DF_CPU=1000000UL -DBAUD=9600 +LDFLAGS := .PHONY: all flash clean -all: rom-loader.bin +all: rom-loader.hex -flash: rom-loader.bin - avrdude -c usbasp -p atmega328p +flash: rom-loader.hex + avrdude -c usbasp -p atmega328p -U flash:w:$< clean: - rm rom-loader.bin + rm -f *.bin *.hex *.o -rom-loader.bin: $(SOURCES) - $(CC) $(CARGS) $< -o $@ +rom-loader.hex: rom-loader.bin + avr-objcopy -R .eeprom -O ihex $< $@ +rom-loader.bin: $(OBJECTS) + avr-gcc $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS) + +%.o: %.c + avr-gcc $(CFLAGS) $< -c -o $@ $(LDFLAGS) |