3331 |
kaklik |
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.mega8,v 1.1 2006/12/03 21:28:59 harbaum Exp $ |
|
|
9 |
|
|
|
10 |
SERIAL = `echo /dev/tty.[Uu][Ss]*` |
|
|
11 |
UISP = uisp -dprog=stk200 |
|
|
12 |
# UISP = uisp -dprog=avr910 -dserial=$(SERIAL) -dpart=auto |
|
|
13 |
# The two lines above are for "uisp" and the AVR910 serial programmer connected |
|
|
14 |
# to a Keyspan USB to serial converter to a Mac running Mac OS X. |
|
|
15 |
# Choose your favorite programmer and interface. |
|
|
16 |
|
|
|
17 |
DEFINES += -DDEBUG |
|
|
18 |
DEFINES += -DDEBUG_LEVEL=1 |
3333 |
kaklik |
19 |
DEFINES += -DF_CPU=12000000 |
3331 |
kaklik |
20 |
COMPILE = avr-gcc -Wall -O2 -Iusbdrv -I. -mmcu=atmega8 $(DEFINES) |
|
|
21 |
|
|
|
22 |
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
# symbolic targets: |
|
|
26 |
all: firmware.hex |
|
|
27 |
|
|
|
28 |
.c.o: |
|
|
29 |
$(COMPILE) -c $< -o $@ |
|
|
30 |
|
|
|
31 |
.S.o: |
|
|
32 |
$(COMPILE) -x assembler-with-cpp -c $< -o $@ |
|
|
33 |
# "-x assembler-with-cpp" should not be necessary since this is the default |
|
|
34 |
# file type for the .S (with capital S) extension. However, upper case |
|
|
35 |
# characters are not always preserved on Windows. To ensure WinAVR |
|
|
36 |
# compatibility define the file type manually. |
|
|
37 |
|
|
|
38 |
.c.s: |
|
|
39 |
$(COMPILE) -S $< -o $@ |
|
|
40 |
|
|
|
41 |
# Fuse high byte: |
|
|
42 |
# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) |
|
|
43 |
# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 |
|
|
44 |
# | | | | | +-------- BOOTSZ1 |
|
|
45 |
# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) |
|
|
46 |
# | | | +-------------- CKOPT (full output swing) |
|
|
47 |
# | | +---------------- SPIEN (allow serial programming) |
|
|
48 |
# | +------------------ WDTON (WDT not always on) |
|
|
49 |
# +-------------------- RSTDISBL (reset pin is enabled) |
|
|
50 |
# Fuse low byte: |
|
|
51 |
# 0x9f = 1 0 0 1 1 1 1 1 |
|
|
52 |
# ^ ^ \ / \--+--/ |
|
|
53 |
# | | | +------- CKSEL 3..0 (external >8M crystal) |
|
|
54 |
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled) |
|
|
55 |
# | +------------------ BODEN (BrownOut Detector enabled) |
|
|
56 |
# +-------------------- BODLEVEL (2.7V) |
|
|
57 |
fuse: |
|
|
58 |
$(UISP) --wr_fuse_h=0xc9 --wr_fuse_l=0x9f |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
clean: |
|
|
62 |
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 |
|
|
63 |
|
|
|
64 |
# file targets: |
|
|
65 |
firmware.bin: $(OBJECTS) |
|
|
66 |
$(COMPILE) -o firmware.bin $(OBJECTS) |
|
|
67 |
|
|
|
68 |
firmware.hex: firmware.bin |
|
|
69 |
rm -f firmware.hex firmware.eep.hex |
|
|
70 |
avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex |
|
|
71 |
./checksize firmware.bin 8192 960 |
|
|
72 |
# do the checksize script as our last action to allow successful compilation |
|
|
73 |
# on Windows with WinAVR where the Unix commands will fail. |
|
|
74 |
|
|
|
75 |
program: firmware.hex |
3333 |
kaklik |
76 |
avrdude -P /dev/ttyUSB0 -c stk500v2 -B 50 -p atmega8 -U lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U flash:w:firmware.hex |
3331 |
kaklik |
77 |
|
|
|
78 |
program-nodep: |
3333 |
kaklik |
79 |
avrdude -P /dev/ttyUSB0 -c stk500v2 -B 50 -p atmega8 -U lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U flash:w:firmware.hex |
3331 |
kaklik |
80 |
|
|
|
81 |
disasm: firmware.bin |
|
|
82 |
avr-objdump -d firmware.bin |
|
|
83 |
|
|
|
84 |
cpp: |
|
|
85 |
$(COMPILE) -E main.c |