apple1serial/firmware/Makefile
Piotr Jaczewski f614cffe86 First commit
2020-05-22 09:55:24 +02:00

54 lines
1.0 KiB
Makefile

# Name: apple1serial
# Author: flovenol@gmail.com
DEVICE = atmega328p
CLOCK = 16000000
PROGRAMMER = -c stk500v2 -P /dev/tty.usbmodemavrdope1
OBJECTS = main.o
# For computing fuse byte values for other devices and options see
# the fuse bit calculator at http://www.engbedded.com/fusecalc/
FUSES = -U hfuse:w:0xde:m -U lfuse:w:0xff:m -U efuse:w:0xfd:m
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)
all: main.hex
.c.o:
$(COMPILE) -c $< -o $@
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
.c.s:
$(COMPILE) -S $< -o $@
flash: all
$(AVRDUDE) -U flash:w:main.hex:i
fuse:
$(AVRDUDE) $(FUSES)
install: flash fuse
load: all
bootloadHID main.hex
clean:
rm -f main.hex main.elf $(OBJECTS)
main.elf: $(OBJECTS)
$(COMPILE) -o main.elf $(OBJECTS)
main.hex: main.elf
rm -f main.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size --format=avr --mcu=$(DEVICE) main.elf
disasm: main.elf
avr-objdump -d main.elf
cpp:
$(COMPILE) -E main.c