-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (51 loc) · 2.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Name: Makefile
# Project: Remote Sensor
# Author: Christian Starkjohann
# Creation Date: 2005-03-20
# Tabsize: 4
# Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
# License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt)
# This Revision: $Id$
SERIAL = `echo /dev/tty.KeySerial*`
UISP = uisp -dprog=avr910 -dserial=$(SERIAL) -dpart=auto
AVRDUDE = avrdude -c usbasp -P usb -p atmega8
PROJECT=usbasp-buttons
# The two lines above are for "uisp" and the AVR910 serial programmer connected
# to a Keyspan USB to serial converter to a Mac running Mac OS X.
# Choose your favorite programmer and interface.
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8 -DF_CPU=12000000L #-DDEBUG_LEVEL=2
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o usbasp.o
# symbolic targets:
all: $(PROJECT).hex
.c.o:
$(COMPILE) -c $< -o $@
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.
.c.s:
$(COMPILE) -S $< -o $@
flash: all
$(AVRDUDE) -U flash:w:$(PROJECT).hex:i
# $(UISP) --erase --upload --verify if=$(PROJECT).hex
clean:
rm -f $(PROJECT).* *.o usbdrv/*.o usbdrv/oddebug.s usbdrv/usbdrv.s
# file targets:
$(PROJECT).elf: $(OBJECTS)
$(COMPILE) -o $(PROJECT).elf $(OBJECTS)
$(PROJECT).hex: $(PROJECT).elf
rm -f $(PROJECT).hex $(PROJECT).eep.hex
avr-objcopy -j .text -j .data -O ihex $(PROJECT).elf $(PROJECT).hex
./checksize $(PROJECT).elf 6100 960
# do the checksize script as our last action to allow successful compilation
# on Windows with WinAVR where the Unix commands will fail.
size: $(PROJECT).elf
./checksize $(PROJECT).elf 6100 960
patch-loader:
@echo 'patch -p 1 -d USBaspLoader/ < USBaspLoader.patch'
@echo 'patch -p 1 -d micronucleus/ < micronucleus.patch'
disasm: $(PROJECT).elf
avr-objdump -d $(PROJECT).elf > $(PROJECT).asm
.PHONY: all flash clean disasm size patch-loader