aboutsummaryrefslogtreecommitdiff
path: root/lib/vusb/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vusb/tests/Makefile')
-rw-r--r--lib/vusb/tests/Makefile128
1 files changed, 128 insertions, 0 deletions
diff --git a/lib/vusb/tests/Makefile b/lib/vusb/tests/Makefile
new file mode 100644
index 000000000..43f8da12e
--- /dev/null
+++ b/lib/vusb/tests/Makefile
@@ -0,0 +1,128 @@
1# Name: Makefile
2# Project: custom-class example
3# Author: Christian Starkjohann
4# Creation Date: 2008-04-07
5# Tabsize: 4
6# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
7# License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8
9DEVICE = attiny2313
10F_CPU = 16000000 # in Hz
11DEFINES =
12
13CFLAGS = $(DEFINES) -Iusbdrv -I. -DDEBUG_LEVEL=0
14OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
15
16COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CRCFLAG) $(CFLAGS) -mmcu=$(DEVICE)
17
18SIZES_TMP = /tmp/sizetmp.txt
19
20# symbolic targets:
21help:
22 @echo "This Makefile has no default rule. Use one of the following:"
23 @echo "make clean ..... to delete objects and hex file"
24 @echo "make sizes ..... compute code and RAM sizes for various options"
25 @echo "make test ...... test with all features whether everything compiles"
26
27sizes sizes.txt:
28 rm -f $(SIZES_TMP) sizes.txt
29 $(MAKE) null.elf
30 avr-size null.elf | tail -1 | awk '{print "null", $$1+$$2, $$3+$$2}' >$(SIZES_TMP)
31 $(MAKE) clean; $(MAKE) main.elf
32 avr-size main.elf | tail -1 | awk '{print "Minimum_with_16_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
33 $(MAKE) clean; $(MAKE) main.elf F_CPU=12000000
34 avr-size main.elf | tail -1 | awk '{print "Minimum_with_12_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
35 $(MAKE) clean; $(MAKE) main.elf F_CPU=12800000
36 avr-size main.elf | tail -1 | awk '{print "Minimum_with_12_8_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
37 $(MAKE) clean; $(MAKE) main.elf F_CPU=15000000
38 avr-size main.elf | tail -1 | awk '{print "Minimum_with_15_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
39 $(MAKE) clean; $(MAKE) main.elf F_CPU=16500000
40 avr-size main.elf | tail -1 | awk '{print "Minimum_with_16_5_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
41 $(MAKE) clean; $(MAKE) main.elf F_CPU=18000000
42 avr-size main.elf | tail -1 | awk '{print "Minimum_with_18_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
43 $(MAKE) clean; $(MAKE) main.elf F_CPU=18000000 CRCFLAG="-DUSE_CRC=1"
44 avr-size main.elf | tail -1 | awk '{print "Minimum_with_18_MHz+CRC", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
45 $(MAKE) clean; $(MAKE) main.elf F_CPU=20000000
46 avr-size main.elf | tail -1 | awk '{print "Minimum_with_20_MHz", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
47 $(MAKE) clean; $(MAKE) main.elf DEFINES=-DUSB_CFG_IMPLEMENT_FN_WRITE=1
48 avr-size main.elf | tail -1 | awk '{print "With_usbFunctionWrite", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
49 $(MAKE) clean; $(MAKE) main.elf DEFINES=-DUSB_CFG_IMPLEMENT_FN_READ=1
50 avr-size main.elf | tail -1 | awk '{print "With_usbFunctionRead", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
51 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_FN_READ=1 -DUSB_CFG_IMPLEMENT_FN_WRITE=1"
52 avr-size main.elf | tail -1 | awk '{print "With_usbFunctionRead_and_Write", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
53 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_FN_WRITEOUT=1"
54 avr-size main.elf | tail -1 | awk '{print "With_usbFunctionWriteOut", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
55 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_HAVE_INTRIN_ENDPOINT=1"
56 avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
57 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_IMPLEMENT_HALT=1 -DUSB_CFG_HAVE_INTRIN_ENDPOINT=1"
58 avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1_and_Halt", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
59 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_HAVE_INTRIN_ENDPOINT3=1"
60 avr-size main.elf | tail -1 | awk '{print "With_Interrupt_In_Endpoint_1_and_3", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
61 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSE_DYNAMIC_DESCRIPTOR=1"
62 avr-size main.elf | tail -1 | awk '{print "With_Dynamic_Descriptor", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
63 $(MAKE) clean; $(MAKE) main.elf "DEFINES=-DUSB_CFG_LONG_TRANSFERS=1"
64 avr-size main.elf | tail -1 | awk '{print "With_Long_Transfers", $$1+$$2, $$3+$$2}' >>$(SIZES_TMP)
65 cat $(SIZES_TMP) | awk 'BEGIN{printf("%39s %5s %5s %5s %5s\n"), "Variation", "Flash", "RAM", "+F", "+RAM"}\
66 /^null/{nullRom=$$2; nullRam=$$3; next} \
67 {rom=$$2-nullRom; ram=$$3-nullRam; if(!refRom){refRom=rom; refRam=ram} \
68 printf("%39s %5d %5d %+5d %+5d\n", $$1, rom, ram, rom-refRom, ram-refRam)}' | tee sizes.txt
69 rm $(SIZES_TMP)
70
71test:
72 for freq in 12000000 12800000 15000000 16000000 16500000 18000000 20000000; do \
73 for opt in USB_COUNT_SOF USB_CFG_HAVE_INTRIN_ENDPOINT USB_CFG_HAVE_INTRIN_ENDPOINT3 USB_CFG_HAVE_MEASURE_FRAME_LENGTH USB_CFG_LONG_TRANSFERS; do \
74 $(MAKE) clean; $(MAKE) main.elf F_CPU=$$freq "DEFINES=-D$$opt=1" || exit 1; \
75 $(MAKE) clean; $(MAKE) main.elf F_CPU=$$freq "DEFINES=-D$$opt=1 -DDUSB_CFG_IMPLEMENT_FN_WRITEOUT=1" || exit 1; \
76 done \
77 done
78
79# The following rule is used to check the compiler
80devices: #exclude devices without RAM for stack and atmega603 for gcc 3
81 excludes="at90s1200 attiny11 attiny12 attiny15 attiny28"; \
82 for gccVersion in 3 4; do \
83 avr-gcc-select $$gccVersion; \
84 for device in `echo | avr-gcc -xc -mmcu=x - 2>&1 | egrep '^ *at[a-zA-Z0-9_-]+$$'`; do \
85 if echo "$$excludes" | grep "$$device" >/dev/null; then continue; fi; \
86 if [ "$$gccVersion" = 3 -a "$$device" = atmega603 ]; then continue; fi; \
87 $(MAKE) clean; $(MAKE) null.elf DEVICE=$$device || exit 1; \
88 done \
89 done
90 $(MAKE) clean
91 avr-gcc-select 3
92 @echo "+++ Device test succeeded!"
93
94# rule for deleting dependent files (those which can be built by Make):
95clean:
96 rm -f *.hex *.lst *.map *.elf *.o
97 rm -rf usbdrv
98
99# Generic rule for compiling C files:
100.c.o:
101 $(COMPILE) -c $< -o $@
102
103# Generic rule for assembling Assembler source files:
104.S.o:
105 $(COMPILE) -x assembler-with-cpp -c $< -o $@
106# "-x assembler-with-cpp" should not be necessary since this is the default
107# file type for the .S (with capital S) extension. However, upper case
108# characters are not always preserved on Windows. To ensure WinAVR
109# compatibility define the file type manually.
110
111# Generic rule for compiling C to assembler, used for debugging only.
112.c.s:
113 $(COMPILE) -S $< -o $@
114
115# file targets:
116
117# Since we don't want to ship the driver multipe times, we copy it into this project:
118usbdrv:
119 cp -r ../usbdrv .
120
121main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it
122 $(COMPILE) -o main.elf $(OBJECTS)
123
124main_i.elf: usbdrv main.o usbdrv/usbdrvasm.o # usbdrv dependency only needed because we copy it
125 $(COMPILE) -o main_i.elf main.o usbdrv/usbdrvasm.o
126
127null.elf: null.o
128 $(COMPILE) -o null.elf null.o