2008-07-09 22:47:12 +02:00
|
|
|
# Name: Makefile
|
|
|
|
# Project: HIDKeys
|
|
|
|
# Author: Christian Starkjohann
|
|
|
|
# Creation Date: 2006-02-02
|
|
|
|
# Tabsize: 4
|
|
|
|
# Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
|
|
|
|
# License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt)
|
2008-11-03 09:00:45 +01:00
|
|
|
# This Revision: $Id$
|
2008-07-09 22:47:12 +02:00
|
|
|
|
|
|
|
AVRDUDE = avrdude -p atmega32 -c usbasp
|
|
|
|
|
2008-10-25 23:21:51 +02:00
|
|
|
# Options:
|
|
|
|
HWOBJECTS = modelibmmodelm.o
|
2008-11-12 22:45:43 +01:00
|
|
|
#HWOBJECTS = modelmayhem.o
|
2008-10-25 23:21:51 +02:00
|
|
|
#HWOBJECTS = modelsuntype5.o
|
2008-07-09 22:47:12 +02:00
|
|
|
|
2008-10-25 23:21:51 +02:00
|
|
|
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega32 -DF_CPU=12000000L $(DEFINES)
|
|
|
|
|
|
|
|
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o $(HWOBJECTS)
|
2008-07-09 22:47:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
# symbolic targets:
|
|
|
|
all: main.hex
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$(COMPILE) -std=c99 -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 $@
|
|
|
|
|
|
|
|
program: all
|
|
|
|
$(AVRDUDE) -U flash:w:main.hex
|
|
|
|
|
|
|
|
fuses:
|
|
|
|
# - enable crystal
|
|
|
|
# - disable JTAG, so we can fully use PORTC
|
2008-10-26 01:33:11 +02:00
|
|
|
$(AVRDUDE) -U lfuse:w:0xCF:m -U hfuse:w:0xD8:m
|
2008-07-09 22:47:12 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
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
|
|
|
|
|
|
|
|
# file targets:
|
|
|
|
main.bin: $(OBJECTS)
|
|
|
|
$(COMPILE) -o main.bin $(OBJECTS)
|
|
|
|
|
|
|
|
main.hex: main.bin
|
|
|
|
rm -f main.hex main.eep.hex
|
|
|
|
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
|
|
|
|
./checksize main.bin
|
|
|
|
# do the checksize script as our last action to allow successful compilation
|
|
|
|
# on Windows with WinAVR where the Unix commands will fail.
|
|
|
|
|
|
|
|
disasm: main.bin
|
|
|
|
avr-objdump -d main.bin
|
|
|
|
|
|
|
|
cpp:
|
|
|
|
$(COMPILE) -E main.c
|