79 |
pfowler |
1 |
# Name: Makefile
|
|
|
2 |
# Project: EasyLogger
|
|
|
3 |
# Author: Christian Starkjohann
|
|
|
4 |
# Creation Date: 2007-06-23
|
|
|
5 |
# Tabsize: 4
|
|
|
6 |
# Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
|
|
|
7 |
# License: GPLv2.
|
|
|
8 |
# This Revision: $Id$
|
|
|
9 |
|
89 |
pfowler |
10 |
DEVICE=atmega168
|
86 |
pfowler |
11 |
F_CPU=20000000
|
|
|
12 |
HID_SIZE=44
|
|
|
13 |
|
79 |
pfowler |
14 |
AVRDUDE = avrdude -c avrispmkii -P usb -p $(DEVICE)
|
|
|
15 |
# The two lines above are for "avrdude" and the STK500 programmer connected
|
|
|
16 |
# to an USB to serial converter to a Mac running Mac OS X.
|
|
|
17 |
# Choose your favorite programmer and interface.
|
|
|
18 |
|
86 |
pfowler |
19 |
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) -DHID_SIZE=$(HID_SIZE) -DDEBUG_LEVEL=0
|
79 |
pfowler |
20 |
# NEVER compile the final product with debugging! Any debug output will
|
|
|
21 |
# distort timing so that the specs can't be met.
|
|
|
22 |
|
81 |
pfowler |
23 |
#OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
|
|
|
24 |
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o
|
79 |
pfowler |
25 |
|
|
|
26 |
# symbolic targets:
|
|
|
27 |
all: main.hex
|
|
|
28 |
|
|
|
29 |
.c.o:
|
|
|
30 |
$(COMPILE) -c $< -o $@
|
|
|
31 |
|
|
|
32 |
.S.o:
|
|
|
33 |
$(COMPILE) -x assembler-with-cpp -c $< -o $@
|
|
|
34 |
# "-x assembler-with-cpp" should not be necessary since this is the default
|
|
|
35 |
# file type for the .S (with capital S) extension. However, upper case
|
|
|
36 |
# characters are not always preserved on Windows. To ensure WinAVR
|
|
|
37 |
# compatibility define the file type manually.
|
|
|
38 |
|
|
|
39 |
.c.s:
|
|
|
40 |
$(COMPILE) -S $< -o $@
|
|
|
41 |
|
|
|
42 |
flash: all
|
|
|
43 |
$(AVRDUDE) -U flash:w:main.hex:i
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
fuse:
|
86 |
pfowler |
47 |
$(AVRDUDE) -U hfuse:w:0xdf:m -U lfuse:w:0xff:m
|
79 |
pfowler |
48 |
|
81 |
pfowler |
49 |
fusedef:
|
86 |
pfowler |
50 |
$(AVRDUDE) -U hfuse:w:0xdf:m -U lfuse:w:0x62:m
|
81 |
pfowler |
51 |
|
79 |
pfowler |
52 |
readcal:
|
|
|
53 |
$(AVRDUDE) -U calibration:r:/dev/stdout:i | head -1
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
clean:
|
89 |
pfowler |
57 |
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s usbtest
|
79 |
pfowler |
58 |
|
|
|
59 |
# file targets:
|
|
|
60 |
main.bin: $(OBJECTS)
|
|
|
61 |
$(COMPILE) -o main.bin $(OBJECTS)
|
|
|
62 |
|
|
|
63 |
main.hex: main.bin
|
|
|
64 |
rm -f main.hex main.eep.hex
|
|
|
65 |
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
|
|
|
66 |
./checksize main.bin 4096 256
|
|
|
67 |
# do the checksize script as our last action to allow successful compilation
|
|
|
68 |
# on Windows with WinAVR where the Unix commands will fail.
|
|
|
69 |
|
|
|
70 |
disasm: main.bin
|
|
|
71 |
avr-objdump -d main.bin
|
|
|
72 |
|
|
|
73 |
cpp:
|
|
|
74 |
$(COMPILE) -E main.c
|
89 |
pfowler |
75 |
|
|
|
76 |
# Command-line client
|
|
|
77 |
CMDLINE = usbtest
|
|
|
78 |
|
|
|
79 |
# One-liner to compile the command-line client from usbtest.c
|
|
|
80 |
$(CMDLINE): usbtest.c
|
|
|
81 |
gcc -I ./libusb/include -L ./libusb/lib/gcc -O -Wall usbtest.c -o usbtest -lusb
|