1 SERIAL
= `echo /dev/tty.USA19QI*`
2 UISP
= uisp
-dprog
=avr910
-dserial
=$(SERIAL
) -dpart
=auto
5 # The two lines above are for "uisp" and the AVR910 serial programmer connected
6 # to a Keyspan USB to serial converter to a Mac running Mac OS X.
7 # Choose your favorite programmer and interface.
9 COMPILE
= avr-gcc
-Wall
-O2
-Iusbdrv
-I.
-mmcu
=$(TARGET
) # -DDEBUG_LEVEL=2
11 OBJECTS
= usbdrv
/usbdrv.o usbdrv
/usbdrvasm.o usbdrv
/oddebug.o isp.o clock.o main.o
18 $(COMPILE
) -c
$< -o
$@
22 $(COMPILE
) -x assembler-with-cpp
-c
$< -o
$@
23 # "-x assembler-with-cpp" should not be necessary since this is the default
24 # file type for the .S (with capital S) extension. However, upper case
25 # characters are not always preserved on Windows. To ensure WinAVR
26 # compatibility define the file type manually.
29 $(COMPILE
) -S
$< -o
$@
32 rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin
*.o main.s usbdrv
/*.o
36 $(COMPILE
) -o main.bin
$(OBJECTS
) -Wl
,-Map
,main.map
39 rm -f main.hex main.eep.hex
40 avr-objcopy
-j .text
-j .data
-O ihex main.bin main.hex
41 # ./checksize main.bin
42 # do the checksize script as our last action to allow successful compilation
43 # on Windows with WinAVR where the Unix commands will fail.
46 avr-objdump
-d main.bin
52 avrdude
-c butterfly
-p
$(TARGET
) -U flash
:w
:main.hex
55 avrdude
-c avr910
-p m8
-u
-U hfuse
:w
:0xc9:m
-U lfuse
:w
:0x9f:m
58 # 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
59 # ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
60 # | | | | | +-------- BOOTSZ1
61 # | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
62 # | | | +-------------- CKOPT (full output swing)
63 # | | +---------------- SPIEN (allow serial programming)
64 # | +------------------ WDTON (WDT not always on)
65 # +-------------------- RSTDISBL (reset pin is enabled)
67 # 0x9f = 1 0 0 1 1 1 1 1
69 # | | | +------- CKSEL 3..0 (external >8M crystal)
70 # | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
71 # | +------------------ BODEN (BrownOut Detector enabled)
72 # +-------------------- BODLEVEL (2.7V)
77 $(UISP
) --upload
--verify if
=main.hex