OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_14/usb_fpga_2_14/trunk

Subversion Repositories usb_fpga_2_14

[/] [usb_fpga_2_14/] [trunk/] [Makefile.mk] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
# This Makefile defines the standard rules for building ZTEX SDK projects.
2
#
3
# The following variables are used:
4
#
5
# ZTEXPREFIX
6
#   Defines the location of the EZ-USB SDK
7
#   Must be defined!
8
#   Example: ZTEXPREFIX=../../..
9
#
10
# JARTARGET
11
#   The name of the jar archive
12
#   Example: JARTARGET=UCEcho.jar
13
#
14
# JARENTRYPOINT
15
#   The default entry point of the jar archive.
16
#   Example: JARENTRYPOINT=UCEcho
17
#
18
# CLASSTARGETS
19
#   Java Classes that have to be build
20
#   Example: CLASSTARGETS=UCEcho.class
21
#
22
# CLASSEXTRADEPS
23
#   Extra dependencies for Java Classes
24
#   Example: CLASSEXTRADEPS:=$(wildcard $(ZTEXPREFIX)/java/ztex/*.java)
25
#
26
# IHXTARGETS
27
#   FX2 ihx files (firmware ROM files) that have to be build
28
#   Example: IHXTARGETS=ucecho.ihx
29
#
30
# IHXEXTRADEPS
31
#   Extra Dependencies for ihx files
32
#   Example: IHXEXTRADEPS:=$(wildcard $(ZTEXPREFIX)/fx2/*.h)
33
#
34
# IMGTARGETS
35
#   FX3 img files (firmware ROM files) that have to be build
36
#   Example: IMGTARGETS=ucecho.img
37
#
38
# IMGEXTRA_C_SOURCES
39
#   extra C sources
40
#
41
# IMGEXTRA_A_SOURCES
42
#   extra Assembler sources
43
#
44
# EXTRAJARFILES
45
#   Extra files that should be included into the jar archive
46
#   Example: EXTRAJARFILES=ucecho.ihx fpga/ucecho.bin
47
#
48
# EXTRAJARFLAGS
49
#   Extra flags for the jar command
50
#   Example: EXTRAJARFLAGS=-C com
51
#
52
# EXTRACLEANFILES
53
#   Extra files that should be cleaned by target "clean"
54
#
55
# EXTRADISTCLEANFILES
56
#   Extra files that should be cleaned by target "distclean"
57
 
58
 
59
.PHONY: all ihx jar clean distclean default avr avrclean avrdistclean
60
.SUFFIXES: .img .ihx .class .jar .java .c .o .S .elf
61
 
62
FX3FWROOT=$(FX3_INSTALL_PATH)/firmware
63
FX3PFWROOT=$(FX3_INSTALL_PATH)/firmware/u3p_firmware
64
FX3UTILROOT=$(FX3_INSTALL_PATH)/util
65
 
66
JAVAC=$(JAVAC_PATH)javac -Xlint:deprecation
67
JAR=$(JAVAC_PATH)jar
68
SDCC=$(ZTEXPREFIX)/bin/bmpsdcc.sh
69
ARMCC=$(ARMGCC_INSTALL_PATH)/bin/arm-none-eabi-gcc
70
ARMAS=$(ARMGCC_INSTALL_PATH)/bin/arm-none-eabi-gcc
71
ARMLD=$(ARMGCC_INSTALL_PATH)/bin/arm-none-eabi-ld
72
ARMAR=$(ARMGCC_INSTALL_PATH)/bin/arm-none-eabi-ar
73
ELF2IMG=$(FX3UTILROOT)/elf2img/elf2img
74
 
75
CLASSPATH:=.:$(ZTEXPREFIX)/usb4java:$(ZTEXPREFIX)/java:$(CLASSPATH)
76
INCLUDES=-I $(ZTEXPREFIX)/fx2/
77
 
78
# ARMASMFLAGS
79
ARMASMFLAGS= -Wall -c -mcpu=arm926ej-s -mthumb-interwork
80
 
81
#LDFLAGS
82
ARMLDLIBS=$(FX3PFWROOT)/lib/$(CYCONFOPT)/cyu3sport.a \
83
          $(FX3PFWROOT)/lib/$(CYCONFOPT)/cyu3lpp.a \
84
          $(FX3PFWROOT)/lib/$(CYCONFOPT)/cyfxapi.a \
85
          $(FX3PFWROOT)/lib/$(CYCONFOPT)/cyu3threadx.a \
86
          $(ARMGCC_INSTALL_PATH)/arm-none-eabi/lib/libm.a \
87
          $(ARMGCC_INSTALL_PATH)/arm-none-eabi/lib/libc.a \
88
          $(ARMGCC_INSTALL_PATH)/lib/gcc/arm-none-eabi/*/libgcc.a
89
ARMLDFLAGS=--entry CyU3PFirmwareEntry $(ARMLDLIBS) -T $(FX3FWROOT)/common/fx3_512k.ld -d --gc-sections --no-wchar-size-warning
90
 
91
# ARMCCFLAGS
92
ARMINCLUDES=-I. -I $(ZTEXPREFIX)/fx3/ -I$(FX3PFWROOT)/inc
93
ARMCCFLAGS= -g -DTX_ENABLE_EVENT_TRACE -DDEBUG -DCYU3P_FX3=1 -D__CYU3P_TX__=1 -Wall -std=gnu99 -mcpu=arm926ej-s -mthumb-interwork $(ARMINCLUDES)
94
ifeq ($(CYCONFOPT), fx3_release)
95
    ARMCCFLAGS+= -Os
96
else
97
    ARMCCFLAGS+= -O3
98
endif
99
 
100
ifeq ($(CYCONFOPT),)
101
    CYCONFOPT=fx3_release
102
endif
103
 
104
IMGEXTRA_C_OBJECTS=$(EXTRA_C_SOURCES:%.c=./%.o)
105
IMGEXTRA_A_OBJECTS=$(EXTRA_A_SOURCES:%.S=./%.o)
106
 
107
ifeq ($(JARENTRYPOINT),)
108
#   JARENTRYPARAMS=cf
109
   JARENTRYPARAMS=cef $(basename $(JARTARGET))
110
else
111
    JARENTRYPARAMS=cef $(JARENTRYPOINT)
112
endif
113
 
114
 
115
all : ihx img jar
116
ihx : $(IHXTARGETS)
117
img : $(IMGTARGETS)
118
jar : $(JARTARGET)
119
 
120
include $(ZTEXPREFIX)/Makefile.conf
121
 
122
%.ihx: %.c $(IHXEXTRADEPS)
123
        $(SDCC) $< "$(INCLUDES)"
124
 
125
%.class: %.java $(CLASSEXTRADEPS)
126
        $(JAVAC) -cp "$(CLASSPATH)" $<
127
 
128
$(JARTARGET) : $(CLASSTARGETS) $(EXTRAJARFILES)
129
        $(JAR) $(JARENTRYPARAMS) $(JARTARGET) *.class $(EXTRAJARFILES) $(EXTRAJARFLAGS) -C $(ZTEXPREFIX)/usb4java . $(shell cd $(ZTEXPREFIX)/java; ls ztex/*.class | while read a; do echo "-C $(ZTEXPREFIX)/java '$$a'"; done)
130
 
131
%.o: %.c
132
        $(ARMCC) $(ARMCCFLAGS) -c -o $@ $<
133
 
134
%.o: %.S
135
        $(ARMAS) $(ARMASMFLAGS) -o $@ $<
136
 
137
cyfxtx.o: $(FX3FWROOT)/common/cyfxtx.c
138
        $(ARMCC) $(ARMCCFLAGS) -c -o "$@" "$<"
139
 
140
cyfx_gcc_startup.o: $(FX3FWROOT)/common/cyfx_gcc_startup.S
141
         $(ARMAS) $(ARMASMFLAGS) -o "$@" "$<"
142
 
143
%.elf: cyfx_gcc_startup.o cyfxtx.o %.o $(IMGEXTRA_A_OBJECTS) $(IMGEXTRA_C_OBJECTS)
144
        $(ARMLD) $+ $(ARMLDFLAGS) -Map $(basename $@).map -o $@
145
 
146
%.img: %.elf
147
        $(ELF2IMG) -o $@ -i $<
148
 
149
 
150
clean:
151
        rm -f *~ *.bak *.old
152
        rm -f *.class
153
        rm -f *.rel *.rst *.lnk *.lst *.map *.asm *.sym *.mem *.tmp.c *.lk
154
        rm -f *.o *.elf *.map *.tmp.c
155
        rm -f $(EXTRACLEANFILES)
156
 
157
distclean: clean
158
        rm -f $(JARTARGET)
159
        rm -f *.ihx
160
        rm -f *.img
161
        rm -f $(EXTRADISTCLEANFILES)
162
 
163
avr:
164
        if [ -d avr ]; then make -C avr all; fi
165
 
166
avrclean:
167
        if [ -d avr ]; then make -C avr clean; fi
168
 
169
avrdistclean:
170
        if [ -d avr ]; then make -C avr distclean; fi

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.