diff options
author | Christian Starkjohann <cs+github@obdev.at> | 2008-04-29 17:41:25 +0000 |
---|---|---|
committer | Christian Starkjohann <cs+github@obdev.at> | 2008-04-29 17:41:25 +0000 |
commit | 47ff1843807c727ccf8e0aa1ee344036374217fc (patch) | |
tree | ec447b447515ec00f8f3b904a6243dcdcb8d41d1 /tests/Makefile | |
parent | 3f3c069e49b52566df6b82c075a1275805285b3b (diff) | |
download | v-usb-47ff1843807c727ccf8e0aa1ee344036374217fc.tar.gz v-usb-47ff1843807c727ccf8e0aa1ee344036374217fc.tar.bz2 v-usb-47ff1843807c727ccf8e0aa1ee344036374217fc.zip |
- added directory with test code
Diffstat (limited to 'tests/Makefile')
-rw-r--r-- | tests/Makefile | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..443909e --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,107 @@ +# Name: Makefile +# Project: custom-class example +# Author: Christian Starkjohann +# Creation Date: 2008-04-07 +# Tabsize: 4 +# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH +# License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt) +# This Revision: $Id$ + +DEVICE = attiny2313 +F_CPU = 16000000 # in Hz +DEFINES = + +CFLAGS = $(DEFINES) -Iusbdrv -I. -DDEBUG_LEVEL=0 +OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o + +COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) + +SIZES_TMP = /tmp/sizetmp.txt + +# symbolic targets: +help: + @echo "This Makefile has no default rule. Use one of the following:" + @echo "make clean ..... to delete objects and hex file" + @echo "make sizes ..... compute code and RAM sizes for various options" + @echo "make test ...... test with all features whether everything compiles" + +sizes sizes.txt: + rm -f $(SIZES_TMP) sizes.txt + $(MAKE) null.elf + avr-size null.elf | tail -1 | awk '{print "null", $$1+$$2, $$3}' >$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf + avr-size main.elf | tail -1 | awk '{print "Minimum_with_16_MHz", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf F_CPU=12000000 + avr-size main.elf | tail -1 | awk '{print "Minimum_with_12_MHz", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf F_CPU=15000000 + avr-size main.elf | tail -1 | awk '{print "Minimum_with_15_MHz", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf F_CPU=16500000 + avr-size main.elf | tail -1 | awk '{print "Minimum_with_16_5_MHz", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf DEFINES=-DUSB_CFG_IMPLEMENT_FN_WRITE=1 + avr-size main.elf | tail -1 | awk '{print "With_usbFunctionWrite", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf DEFINES=-DUSB_CFG_IMPLEMENT_FN_READ=1 + avr-size main.elf | tail -1 | awk '{print "With_usbFunctionRead", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_FN_READ=1 -DUSB_CFG_IMPLEMENT_FN_WRITE=1" + avr-size main.elf | tail -1 | awk '{print "With_usbFunctionRead_and_Write", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_FN_WRITEOUT=1" + avr-size main.elf | tail -1 | awk '{print "With_usbFunctionWriteOut", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_HAVE_INTRIN_ENDPOINT=1" + avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_HALT=1 -DUSB_CFG_HAVE_INTRIN_ENDPOINT=1" + avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1_and_Halt", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_HAVE_INTRIN_ENDPOINT3=1" + avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1_and_3", $$1+$$2, $$3}' >>$(SIZES_TMP) + $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSE_DYNAMIC_DESCRIPTOR=1" + avr-size main.elf | tail -1 | awk '{print "With_Dynamic_Descriptor", $$1+$$2, $$3}' >>$(SIZES_TMP) + cat $(SIZES_TMP) | awk 'BEGIN{printf("%39s %5s %5s %5s %5s\n"), "Variation", "Flash", "RAM", "+F", "+RAM"}\ + /^null/{nullRom=$$2; nullRam=$$3; next} \ + {rom=$$2-nullRom; ram=$$3-nullRam; if(!refRom){refRom=rom; refRam=ram} \ + printf("%39s %5d %5d %+5d %+5d\n", $$1, rom, ram, rom-refRom, ram-refRam)}' | tee sizes.txt + rm $(SIZES_TMP) + +test: + for freq in 12000000 15000000 16000000 16500000; do \ + for opt in USB_COUNT_SOF USB_CFG_HAVE_INTRIN_ENDPOINT USB_CFG_HAVE_INTRIN_ENDPOINT3 USB_CFG_HAVE_MEASURE_FRAME_LENGTH; do \ + $(MAKE) clean; $(MAKE) main.elf F_CPU=$$freq "DEFINES=-D$$opt=1"; \ + $(MAKE) clean; $(MAKE) main.elf F_CPU=$$freq "DEFINES=-D$$opt=1 -DDUSB_CFG_IMPLEMENT_FN_WRITEOUT=1"; \ + done \ + done + +# $(MAKE) clean; $(MAKE) main_i.elf "DEFINES=-DUSBPUBLIC=static -DUSE_INCLUDE=1" +# avr-size main_i.elf | tail -1 | awk '{print "static", $$1+$$2, $$3}' >>$(SIZES_TMP) + +# rule for deleting dependent files (those which can be built by Make): +clean: + rm -f *.hex *.lst *.map *.elf *.o + rm -rf usbdrv + +# Generic rule for compiling C files: +.c.o: + $(COMPILE) -c $< -o $@ + +# Generic rule for assembling Assembler source files: +.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. + +# Generic rule for compiling C to assembler, used for debugging only. +.c.s: + $(COMPILE) -S $< -o $@ + +# file targets: + +# Since we don't want to ship the driver multipe times, we copy it into this project: +usbdrv: + cp -r ../usbdrv . + +main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it + $(COMPILE) -o main.elf $(OBJECTS) + +main_i.elf: usbdrv main.o usbdrv/usbdrvasm.o # usbdrv dependency only needed because we copy it + $(COMPILE) -o main_i.elf main.o usbdrv/usbdrvasm.o + +null.elf: null.o + $(COMPILE) -o null.elf null.o |