1 #*
2 #*
3 #* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
4 #*
5 #*
6 #* Redistribution and use in source and binary forms, with or without
7 #* modification, are permitted provided that the following conditions
8 #* are met:
9 #*
10 #* Redistributions of source code must retain the above copyright
11 #* notice, this list of conditions and the following disclaimer.
12 #*
13 #* Redistributions in binary form must reproduce the above copyright
14 #* notice, this list of conditions and the following disclaimer in the
15 #* documentation and/or other materials provided with the
16 #* distribution.
17 #*
18 #* Neither the name of Texas Instruments Incorporated nor the names of
19 #* its contributors may be used to endorse or promote products derived
20 #* from this software without specific prior written permission.
21 #*
22 #* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 #* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 #* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 #* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 #* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 #* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 #* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 #* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 #* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 #* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 #* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #*
36 #*******************************************************************************************
37 #* FILE PURPOSE: Top level make for the IBL
38 #*******************************************************************************************
39 #* FILE NAME: Makefile
40 #*
41 #* DESCRIPTION: Builds the Intermediate Boot Loader (IBL)
42 #*
43 #* Usage: make c6455 | c6472 | c6474 | c6457 | c661x
44 #* [DEBUG=yes] /* Compiles for debug */
45 #* [ETH=no] /* Disables ethernet support */
46 #* [BIS=no] /* Disables BIS interpreter */
47 #* [COFF=no] /* Disables COFF interpreter */
48 #* [BLOB=no] /* Disables BLOB interpreter */
49 #* [ELF=no] /* Disables ELF interpreter */
50 #* [NAND=no] /* Disables NAND support through EMIF/SPI/GPIO */
51 #* [NAND_SPI=no] /* Disables NAND support through SPI */
52 #* [NAND_EMIF=no] /* Disables NAND support through EMIF */
53 #* [NAND_GPIO=no] /* Disables NAND support through GPIO */
54 #* [NOR=no] /* Disables NOR through EMIF/SPI */
55 #* [NOR_SPI=no] /* Disables NOR support through SPI */
56 #* [NOR_EMIF=no] /* Disables NOR support through EMIF */
57 #* [SPI=no] /* Disables SPI */
58 #* [I2C=no] /* Disables I2C */
59 #* [EMIF=no] /* Disables EMIF */
60 #* [SPI_MODE=<0,1,2,3>] /* Selects the SPI operating mode */
61 #* [SPI_ADDR_WIDTH=<16,24>] /* Selects the SPI address width */
62 #* [SPI_NPIN=<4,5>] /* Selects the number of pins on the interface */
63 #* [SPI_CSEL=<1,2>] /* Sets the SPI CSEL value in 5 pin mode */
64 #* [SPI_C2TDEL=x] /* Sets the SPI C to T delay value */
65 #* [SPI_CLKDIV=x] /* Sets the SPI module clock divider */
66 #* [SPI_USE_ROM=yes] /* Uses SPI interface parameters from boot ROM, if available */
67 #* [ENDIAN= both | big | little] /* Selects the endian of the build */
68 #* [I2C_BUS_ADDR= 0x50 | 0x51] /* The initial I2C bus address */
69 #* [COMPACT_I2C=yes] /* Mimimizes the size of the I2C */
70 #*
71 #*
72 #* or to make a board specific configuraiton
73 #*
74 #* make evm_c6455 | evm_c6472 | evm_c6474 | evm_c6457 | evm_c661x
75 #*
76 #* or to test the builds by making all the devices and testing excludes
77 #*
78 #* make test_build
79 #*******************************************************************************************
81 IBLS_C6X= c6455 c6472 c6474 c6457 c661x
82 EVMS_C6X= evm_c6455 evm_c6472 evm_c6474
85 # Excluding functions from the build reduces the I2C eeprom memory used and
86 # speeds the initial boot time. Note that boot table cannot be excluded
87 # because it is required for the two stage I2C load process
89 CEXCLUDES=
91 ifeq ($(ETH),no)
92 CEXCLUDES+= ETH
93 endif
95 ifeq ($(BIS),no)
96 CEXCLUDES+= BIS
97 endif
99 ifeq ($(COFF),no)
100 CEXCLUDES+= COFF
101 endif
103 ifeq ($(BLOB),no)
104 CEXCLUDES+= BLOB
105 endif
107 ifeq ($(ELF),no)
108 CEXCLUDES+= ELF
109 endif
111 ifeq ($(NAND),no)
112 CEXCLUDES+= NAND_SPI
113 CEXCLUDES+= NAND_EMIF
114 CEXCLUDES+= NAND_GPIO
116 else
118 ifeq ($(NAND_SPI),no)
119 CEXCLUDES+= NAND_SPI
120 endif
122 ifeq ($(NAND_EMIF),no)
123 CEXCLUDES+= NAND_EMIF
124 endif
126 ifeq ($(NAND_GPIO),no)
127 CEXCLUDES+= NAND_GPIO
128 endif
130 endif
133 ifeq ($(NOR),no)
134 CEXCLUDES+= NOR_SPI
135 CEXCLUDES+= NOR_EMIF
137 else
139 ifeq ($(NOR_SPI),no)
140 CEXCLUDES+= NOR_SPI
141 endif
143 ifeq ($(NOR_EMIF),no)
144 CEXCLUDES+= NOR_EMIF
145 endif
147 endif
150 ifeq ($(I2C),no)
151 CEXCLUDES+= I2C
152 endif
155 ifeq ($(SPI),no)
157 ifeq (,$(findstring NAND_SPI, $(CEXCLUDES)))
158 CEXCLUDES+= NAND_SPI
159 endif
161 ifeq (,$(findstring NOR_SPI, $(CEXCLUDES)))
162 CEXCLUDES+= NOR_SPI
163 endif
165 endif
168 ifeq ($(EMIF),no)
170 ifeq (,$(findstring NAND_EMIF, $(CEXCLUDES)))
171 CEXCLUDES+= NAND_EMIF
172 endif
174 ifeq (,$(findstring NOR_EMIF, $(CEXCLUDES)))
175 CEXCLUDES+= NOR_EMIF
176 endif
178 endif
185 # The endian of the build. The default target builds a single ROM image with both endians present
186 ifeq ($(ENDIAN),big)
187 ENDIAN_MODE=big
188 else
189 ifeq ($(ENDIAN),little)
190 ENDIAN_MODE=little
191 else
192 ENDIAN_MODE=both
193 endif
194 endif
196 # The i2c ROM bus address. The code will advance accross I2C bus address boundaries (the code must
197 # be blocked so that a single block doesn't cross a boundary, however).
198 ifndef I2C_BUS_ADDR
199 I2C_BUS_ADDR=0x50
200 endif
202 # The SPI configuration parameters
203 ifndef SPI_MODE
204 SPI_MODE=3
205 endif
207 ifndef SPI_ADDR_WIDTH
208 SPI_ADDR_WIDTH=24
209 endif
211 ifndef SPI_NPIN
212 SPI_NPIN=5
213 endif
215 ifndef SPI_CSEL
216 SPI_CSEL=2
217 endif
219 ifndef SPI_C2TDEL
220 SPI_C2TDEL=4
221 endif
223 ifndef SPI_CLKDIV
224 SPI_CLKDIV=8
225 endif
227 ifneq ($(SPI_USE_ROM),0)
228 SPI_ROM=1
229 else
230 SPI_ROM=0
231 endif
233 SPI_DEFS= SPI_MODE=$(SPI_MODE)
234 SPI_DEFS+= SPI_ADDR_WIDTH=$(SPI_ADDR_WIDTH)
235 SPI_DEFS+= SPI_NPIN=$(SPI_NPIN)
236 SPI_DEFS+= SPI_CSEL=$(SPI_CSEL)
237 SPI_DEFS+= SPI_C2TDEL=$(SPI_C2TDEL)
238 SPI_DEFS+= SPI_CLKDIV=$(SPI_CLKDIV)
239 SPI_DEFS+= SPI_ROM=$(SPI_ROM)
242 .PHONY: all $(IBLS_C6X) evm_c6455 evm_c6472 evm_c6474 evm_c6457 evm_c6618
243 .PHONY: test_c661x test_c6455 test_c6472 test_c6474 test_c6457 clean
246 all:
247 @echo must specify a target [ $(IBLS_C6X) $(EVMS_C6X) ]
250 # The debug flag changes compiler options
251 ifndef DEBUG
252 DEBUG=no
253 endif
254 export DEBUG
257 $(IBLS_C6X):
258 make -f makestg1 ARCH=c64x TARGET=$@ I2C_BUS_ADDR=$(I2C_BUS_ADDR) COMPACT_I2C=$(COMPACT_I2C) ENDIAN_MODE=$(ENDIAN_MODE) CEXCLUDES='$(CEXCLUDES)' SPI_DEFS='$(SPI_DEFS)' $@
261 # Configurations for individual evms
262 # The c455 EVM has a 128k eeprom (64k at 0x50, 64k at 0x51), so both endians are built with full functionality
263 evm_c6455:
264 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES= c6455
266 # The c6472 EVM has a 128k eeprom (64k at 0x50, 64k at 0x51), so both endians are built with full functionality
267 evm_c6472:
268 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES= c6472
270 # The 6474 EVM has a 32k eeprom. A stripped down version is build with only one endian.
271 evm_c6474:
272 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=little CEXCLUDES='ELF NAND_GPIO BIS' I2C_SIZE_BYTES=0x8000 c6474
273 cp ibl_c6474/i2crom.dat ibl_c6474/i2crom_0x50.dat
274 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x51 COMPACT_I2C=yes ENDIAN_MODE=big CEXCLUDES='ELF NAND_GPIO BIS' I2C_SIZE_BYTES=0x8000 c6474
275 cp ibl_c6474/i2crom.dat ibl_c6474/i2crom_0x51.dat
277 # The 6457 EVM
278 evm_c6457:
279 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=little CEXCLUDES='ELF NAND_GPIO BIS' I2C_SIZE_BYTES=0x8000 c6457
280 cp ibl_c6457/i2crom.dat ibl_c6457/i2crom_0x50.dat
281 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x51 COMPACT_I2C=yes ENDIAN_MODE=big CEXCLUDES='ELF NAND_GPIO BIS' I2C_SIZE_BYTES=0x8000 c6457
282 cp ibl_c6457/i2crom.dat ibl_c6457/i2crom_0x51.dat
284 # The 6618 EVM
285 evm_c6618:
286 make -f makestg1 ARCH=c64x TARGET=c661x I2C_BUS_ADDR=0x50 ENDIAN_MODE=little CEXCLUDES= DEBUG=YES SPI_DEFS='$(SPI_DEFS)' c661x
288 test_c661x:
289 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES='NOR_SPI' SPI_DEFS='SPI_ROM=1 SPI_MODE=3 SPI_ADDR_WIDTH=24 SPI_NPIN=5 SPI_CSEL=2 SPI_C2TDEL=8 SPI_CLKDIV=0x20' I2C_BUS_ADDR=0x50 COMPACT_I2C=no c661x
290 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES='NAND_SPI' SPI_DEFS='SPI_ROM=1 SPI_MODE=3 SPI_ADDR_WIDTH=24 SPI_NPIN=5 SPI_CSEL=2 SPI_C2TDEL=8 SPI_CLKDIV=0x20' I2C_BUS_ADDR=0x50 COMPACT_I2C=no c661x
291 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES='NOR_EMIF' SPI_DEFS='SPI_ROM=1 SPI_MODE=3 SPI_ADDR_WIDTH=24 SPI_NPIN=5 SPI_CSEL=2 SPI_C2TDEL=8 SPI_CLKDIV=0x20' I2C_BUS_ADDR=0x50 COMPACT_I2C=no c661x
292 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES='NAND_EMIF' SPI_DEFS='SPI_ROM=1 SPI_MODE=3 SPI_ADDR_WIDTH=24 SPI_NPIN=5 SPI_CSEL=2 SPI_C2TDEL=8 SPI_CLKDIV=0x20' I2C_BUS_ADDR=0x50 COMPACT_I2C=no c661x
293 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES='NAND_EMIF NOR_EMIF' SPI_DEFS='SPI_ROM=1 SPI_MODE=3 SPI_ADDR_WIDTH=24 SPI_NPIN=5 SPI_CSEL=2 SPI_C2TDEL=8 SPI_CLKDIV=0x20' I2C_BUS_ADDR=0x50 COMPACT_I2C=no c661x
294 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES='SPI NOR_SPI NAND_SPI' I2C_BUS_ADDR=0x50 COMPACT_I2C=no c661x
295 make -f makestg1 ARCH=c64x TARGET=c661x ENDIAN_MODE=both CEXCLUDES=I2C SPI_DEFS='SPI_ROM=1 SPI_MODE=3 SPI_ADDR_WIDTH=24 SPI_NPIN=5 SPI_CSEL=2 SPI_C2TDEL=8 SPI_CLKDIV=0x20' c661x
297 # Test - builds all the targets, with single component exclusion
299 test_c6455:
300 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES= c6455
301 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=ETH c6455
302 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=NAND_GPIO c6455
303 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=BIS c6455
304 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=COFF c6455
305 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=ELF c6455
306 make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=BLOB c6455
308 test_c6457:
309 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES= c6457
310 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=ETH c6457
311 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=NAND_GPIO c6457
312 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=BIS c6457
313 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=COFF c6457
314 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=ELF c6457
315 make -f makestg1 ARCH=c64x TARGET=c6457 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=BLOB c6457
317 test_c6472:
318 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES= c6472
319 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=ETH c6472
320 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=NAND_GPIO c6472
321 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=BIS c6472
322 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=COFF c6472
323 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=ELF c6472
324 make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both CEXCLUDES=BLOB c6472
326 test_c6474:
327 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES= c6474
328 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=ETH c6474
329 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=NAND_GPIO c6474
330 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=BIS c6474
331 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=COFF c6474
332 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=ELF c6474
333 make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=yes ENDIAN_MODE=both CEXCLUDES=BLOB c6474
336 test_build: test_c6455 test_c6457 test_c6472 test_c6474 test_c661x
339 # will need to add a line for each additional ARCH type added
340 clean:
341 make -f makestg2 clean ARCH=c64x TARGET=c6472
342 make -f makestg2 cleant ARCH=c64x TARGET=c6472
343 make -f makestg2 cleant ARCH=c64x TARGET=c6474
344 make -f makestg2 cleant ARCH=c64x TARGET=c6455
345 make -f makestg2 cleant ARCH=c64x TARGET=c6457
346 make -C ../util/bconvert clean
347 make -C ../util/btoccs clean
348 make -C ../util/i2cConfig clean ARCH=c64x TARGET=c6455
349 make -C ../util/i2cConfig clean ARCH=c64x TARGET=c6472
350 make -C ../util/i2cConfig clean ARCH=c64x TARGET=c6474
351 make -C ../util/i2cConfig clean ARCH=c64x TARGET=c6457
352 make -C ../util/nandwriter clean ARCH=c64x TARGET=c6455
353 make -C ../util/nandwriter clean ARCH=c64x TARGET=c6472
354 make -C ../util/nandwriter clean ARCH=c64x TARGET=c6474
355 make -C ../util/nandwriter clean ARCH=c64x TARGET=c6457
356 make -C ../util/romparse clean
357 make -C ../test/test1 clean
358 make -C ../test/test2 clean