3514 |
miho |
1 |
# Name: Makefile |
|
|
2 |
# Project: USB I2C |
|
|
3 |
# Author: Christian Starkjohann, modified for I2C USB by Till Harbaum |
|
|
4 |
# Creation Date: 2005-03-20 |
|
|
5 |
# Tabsize: 4 |
|
|
6 |
# Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH |
|
|
7 |
# License: Proprietary, free under certain conditions. See Documentation. |
|
|
8 |
# This Revision: $Id: Makefile-avrusb.tiny45,v 1.3 2007/06/07 13:53:47 harbaum Exp $ |
|
|
9 |
|
|
|
10 |
# DEFINES += -DDEBUG |
|
|
11 |
# DEFINES += -DDEBUG_LEVEL=1 |
|
|
12 |
DEFINES += -DF_CPU=12000000 |
|
|
13 |
COMPILE = avr-gcc -Wall -O2 -Iusbdrv -I. -mmcu=attiny45 $(DEFINES) |
|
|
14 |
|
|
|
15 |
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o |
|
|
16 |
|
|
|
17 |
# symbolic targets: |
|
|
18 |
all: firmware.hex |
|
|
19 |
|
|
|
20 |
.c.o: |
|
|
21 |
$(COMPILE) -c $< -o $@ |
|
|
22 |
|
|
|
23 |
.S.o: |
|
|
24 |
$(COMPILE) -x assembler-with-cpp -c $< -o $@ |
|
|
25 |
# "-x assembler-with-cpp" should not be necessary since this is the default |
|
|
26 |
# file type for the .S (with capital S) extension. However, upper case |
|
|
27 |
# characters are not always preserved on Windows. To ensure WinAVR |
|
|
28 |
# compatibility define the file type manually. |
|
|
29 |
|
|
|
30 |
.c.s: |
|
|
31 |
$(COMPILE) -S $< -o $@ |
|
|
32 |
|
|
|
33 |
# Fuse high byte: |
|
|
34 |
# 0x5f = 0 1 0 1 1 1 1 1 <-- BODLEVEL0 (Brown out trigger level bit 0) |
|
|
35 |
# ^ ^ ^ ^ ^ ^ ^------ BODLEVEL1 (Brown out trigger level bit 1) |
|
|
36 |
# | | | | | +-------- BODLEVEL2 (Brown out trigger level bit 2) |
|
|
37 |
# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) |
|
|
38 |
# | | | +-------------- WDTON (WDT not always on) |
|
|
39 |
# | | +---------------- SPIEN (allow serial programming) |
|
|
40 |
# | +------------------ DWEN (ebug wire is enabled) |
|
|
41 |
# +-------------------- RSTDISBL (reset pin is disabled) |
|
|
42 |
# Fuse low byte: |
|
|
43 |
# 0xdf = 1 1 0 1 1 1 1 1 |
|
|
44 |
# ^ ^ \ / \--+--/ |
|
|
45 |
# | | | +------- CKSEL 3..0 (external >8M crystal) |
|
|
46 |
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) |
|
|
47 |
# | +------------------ CKOUT (clock output enable) |
|
|
48 |
# +-------------------- CKDIV8 (divide clock by eight disabled) |
|
|
49 |
|
|
|
50 |
clean: |
3516 |
miho |
51 |
# rm -f firmware.hex firmware.lst firmware.obj firmware.cof firmware.list firmware.map *.bin *.o */*.o *~ */*~ firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s |
|
|
52 |
rm -f firmware.hex firmware.lst firmware.obj firmware.cof firmware.list firmware.map firmware.eep.hex firmware.bin *.o usbdrv/*.o firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s |
3514 |
miho |
53 |
|
|
|
54 |
# file targets: |
|
|
55 |
firmware.bin: $(OBJECTS) |
|
|
56 |
$(COMPILE) -o firmware.bin $(OBJECTS) |
|
|
57 |
|
|
|
58 |
firmware.hex: firmware.bin |
|
|
59 |
rm -f firmware.hex firmware.eep.hex |
|
|
60 |
avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex |
|
|
61 |
./checksize firmware.bin 4096 196 |
|
|
62 |
# do the checksize script as our last action to allow successful compilation |
|
|
63 |
# on Windows with WinAVR where the Unix commands will fail. |
|
|
64 |
|
|
|
65 |
program: firmware.hex |
|
|
66 |
avrdude -P/dev/ttyS0 -c stk500hvsp -p attiny45 -U lfuse:w:0xdf:m -U flash:w:firmware.hex -U hfuse:w:0x5f:m |
|
|
67 |
|
|
|
68 |
program-usb: firmware.hex |
|
|
69 |
avrdude -P/dev/ttyUSB0 -c stk500hvsp -p attiny45 -U lfuse:w:0xdf:m -U flash:w:firmware.hex -U hfuse:w:0x5f:m |
|
|
70 |
|
|
|
71 |
disasm: firmware.bin |
|
|
72 |
avr-objdump -d firmware.bin |
|
|
73 |
|
|
|
74 |
cpp: |
|
|
75 |
$(COMPILE) -E main.c |