summaryrefslogtreecommitdiffstats
path: root/cfe/cfe/arch/mips/board/bcm63xx_rom/src/rom_cfe.mk
blob: c45aea7fd8516e3518134bc038614002a9e25bee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#
# CFE's version number
#

include ${TOP}/main/cfe_version.mk

#
# Default values for certain parameters
#

CFG_MLONG64 ?= 0
CFG_LITTLE  ?= 0
CFG_RELOC ?= 0
CFG_UNCACHED ?= 0
CFG_NEWRELOC ?= 0
CFG_BOOTRAM ?= 0
CFG_VGACONSOLE ?= 0
CFG_PCI ?= 1
CFG_LDT_REV_017 ?= 0
CFG_ZLIB ?= 0
CFG_BIENDIAN ?= 0
CFG_DOWNLOAD ?= 0
CFG_RAMAPP ?= 0
CFG_USB ?= 0

#
# Paths to other parts of the firmware.  Everything's relative to ${TOP}
# so that you can actually do a build anywhere you want.
#

ARCH_TOP   = ${TOP}/arch/${ARCH}
ARCH_SRC   = ${ARCH_TOP}/common/src
ARCH_INC   = ${ARCH_TOP}/common/include
CPU_SRC    = ${ARCH_TOP}/cpu/${CPU}/src
CPU_INC    = ${ARCH_TOP}/cpu/${CPU}/include
#
# It's actually optional to have a 'board'
# directory.  If you don't specify BOARD,
# don't include the files.
#

ifneq ("$(strip ${BOARD})","")
BOARD_SRC  = ${ARCH_TOP}/board/${BOARD}/src
BOARD_INC  = ${ARCH_TOP}/board/${BOARD}/include
endif

#
# Preprocessor defines for CFE's version number
#

VDEF = -DCFE_VER_MAJ=${CFE_VER_MAJ} -DCFE_VER_MIN=${CFE_VER_MIN} -DCFE_VER_ECO=${CFE_VER_ECO}

#
# Construct the list of paths that will eventually become the include
# paths and VPATH
#

SRCDIRS = ${ARCH_SRC} ${CPU_SRC} ${BOARD_SRC} ${TOP}/main ${TOP}/vendor ${TOP}/include ${TOP}/net ${TOP}/dev ${TOP}/pci ${TOP}/ui ${TOP}/lib ${TOP}/common ${TOP}/verif ${TOP}/lzma

CFE_INC = ${TOP}/include ${TOP}/pci ${TOP}/net 

ifeq ($(strip ${CFG_VGACONSOLE}),1)
SRCDIRS += ${TOP}/x86emu ${TOP}/pccons
CFE_INC += ${TOP}/x86emu ${TOP}/pccons
endif

ifeq ($(strip ${CFG_VAPI}),1)
SRCDIRS += ${TOP}/verif
CFE_INC += ${TOP}/verif
endif

ifeq ($(strip ${CFG_ZLIB}),1)
SRCDIRS += ${TOP}/zlib
CFE_INC += ${TOP}/zlib
endif


INCDIRS = $(patsubst %,-I%,$(subst :, ,$(ARCH_INC) $(CPU_INC) $(BOARD_INC) $(CFE_INC)))

VPATH = $(SRCDIRS)

#
# Bi-endian support: If we're building the little-endian
# version, use a different linker script so we can locate the
# ROM at a higher address.  You'd think we could do this with
# normal linker command line switches, but there appears to be no
# command-line way to override the 'AT' qualifier in the linker script.
#

CFG_TEXTAT1MB=0
ifeq ($(strip ${CFG_BIENDIAN}),1)
  ifeq ($(strip ${CFG_LITTLE}),1)
    CFG_TEXTAT1MB=1
  endif
endif


#
# Configure tools and basic tools flags.  This include sets up
# macros for calling the C compiler, basic flags,
# and linker scripts.
#

include ${ARCH_SRC}/tools.mk

#
# Add some common flags that are used on any architecture.
#

CFLAGS += -I. $(INCDIRS)
CFLAGS += -D_CFE_ ${VDEF} -DCFG_BOARDNAME=\"${CFG_BOARDNAME}\"

#
# Gross - allow more options to be supplied from command line
#

ifdef CFG_OPTIONS
OPTFLAGS = $(patsubst %,-D%,$(subst :, ,$(CFG_OPTIONS)))
CFLAGS += ${OPTFLAGS}
endif

ifeq ($(strip $(BRCM_IKOS)),y)
CFLAGS += -DCONFIG_BRCM_IKOS
endif

#
# Add flash driver support.
#

ifeq ($(strip $(BLD_NAND)),1)
# BUILD NAND flash boot loader
ifeq ($(strip $(BRCM_CHIP)),6328)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=0
INC_NAND_FLASH_DRIVER=1
endif
ifeq ($(strip $(BRCM_CHIP)),6362)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=0
INC_NAND_FLASH_DRIVER=1
endif
ifeq ($(strip $(BRCM_CHIP)),6368)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=0
INC_NAND_FLASH_DRIVER=1
endif
ifeq ($(strip $(BRCM_CHIP)),6816)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=0
INC_NAND_FLASH_DRIVER=1
endif

else
# BUILD NOR flash boot loader
ifeq ($(strip $(BRCM_CHIP)),6328)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=1
INC_NAND_FLASH_DRIVER=0
endif
ifeq ($(strip $(BRCM_CHIP)),6362)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=1
INC_NAND_FLASH_DRIVER=0
endif
ifeq ($(strip $(BRCM_CHIP)),6368)
INC_CFI_FLASH_DRIVER=1
INC_SPI_FLASH_DRIVER=1
INC_NAND_FLASH_DRIVER=0
endif
ifeq ($(strip $(BRCM_CHIP)),6816)
INC_CFI_FLASH_DRIVER=1
INC_SPI_FLASH_DRIVER=1
INC_NAND_FLASH_DRIVER=0
endif
endif

ifeq ($(strip $(BLD_SPI_NAND)),1)
INC_CFI_FLASH_DRIVER=0
INC_SPI_FLASH_DRIVER=1
INC_NAND_FLASH_DRIVER=0
INC_SPI_PROG_NAND=1
else
INC_SPI_PROG_NAND=0
endif

CFLAGS += -DINC_CFI_FLASH_DRIVER=$(INC_CFI_FLASH_DRIVER)
CFLAGS += -DINC_SPI_FLASH_DRIVER=$(INC_SPI_FLASH_DRIVER)
CFLAGS += -DINC_NAND_FLASH_DRIVER=$(INC_NAND_FLASH_DRIVER)
CFLAGS += -DINC_SPI_PROG_NAND=$(INC_SPI_PROG_NAND)

#
# This is the makefile's main target.  Note that we actually
# do most of the work in 'ALL' not 'all', since we include
# other makefiles after this point.
#

all : build_date.c ALL

#
# Macros that expand to the list of arch-independent files
#

LZMAOBJS = LzmaDecode.o dcapi.o
DEVOBJS = lib_malloc.o
## dev_newflash.o dev_null.o dev_promice.o dev_ide_common.o dev_ns16550.o dev_ds17887clock.o dev_flash.o

##lib_hssubr.o lib_physio.o lib_printf.o lib_misc.o \   lib_arena.o  lib_queue.o 
##		  lib_qsort.o  lib_string.o lib_string2.o

NETOBJS = 
##	    net_tcp.o net_tcpbuf.o dev_tcpconsole.o  net_dhcp.o net_icmp.o net_ether.o net_tftp.o net_ip.o net_udp.o  net_dns.o net_arp.o net_api.o 

CFEOBJS = 
## cfe_iocb_dispatch.o cfe_devfuncs.o \ cfe_console.o cfe_timer.o cfe_attach.o cfe_background.o cfe_zlibfs.o 
##            cfe_mem.o  
##           cfe_error.o build_date.o \
##	  cfe_rawfs.o cfe_xreq.o cfe_filesys.o 
##	  cfe_fatfs.o cfe_httpfs.o  cfe_ldr_srec.o  cfe_autoboot.o cfe_boot.o cfe_ldr_elf.o cfe_ldr_raw.o  cfe_loader.o
##    cfe_main.o nvram_subr.o url.o cfe_savedata.o env_subr.o
UIOBJS  = 
##ui_command.o ui_cmddisp.o 
##	  ui_pcicmds.o \ui_tcpcmds.o ui_memcmds.o ui_loadcmds.o ui_flash.o ui_netcmds.o ui_envcmds.o ui_devcmds.o
##	  ui_examcmds.o ui_misccmds.o \
## ui_test_disk.o ui_test_ether.o ui_test_flash.o ui_test_uart.o

#
# Add more object files if we're supporting PCI
#

ifeq ($(strip ${CFG_PCI}),1)
PCIOBJS  = pciconf.o ldtinit.o pci_subr.o
PCIOBJS += pci_devs.o
DEVOBJS += dev_sp1011.o dev_ht7520.o
DEVOBJS += dev_ide_pci.o dev_ns16550_pci.o
DEVOBJS += dev_tulip.o dev_dp83815.o
CFLAGS  += -DCFG_PCI=1
ifeq ($(strip ${CFG_LDT_REV_017}),1)
CFLAGS  += -DCFG_LDT_REV_017=1
endif
ifeq ($(strip ${CFG_DOWNLOAD}),1)
DEVOBJS += dev_bcm1250.o download.data
CFLAGS += -DCFG_DOWNLOAD=1
endif
endif

#
# If doing bi-endian, add the compiler switch to change
# the way the vectors are generated.  These switches are
# only added to the big-endian portion of the ROM,
# which is located at the real boot vector.
#

ifeq ($(strip ${CFG_BIENDIAN}),1)
  ifeq ($(strip ${CFG_LITTLE}),0)
    CFLAGS += -DCFG_BIENDIAN=1
  endif
endif

#
# Include the makefiles for the architecture-common, cpu-specific,
# and board-specific directories.  Each of these will supply
# some files to "ALLOBJS".  The BOARD directory is optional
# as some ports are so simple they don't need boad-specific stuff.
#

include ${ARCH_SRC}/Makefile
include ${CPU_SRC}/Makefile

ifneq ("$(strip ${BOARD})","")
include ${BOARD_SRC}/Makefile
endif

#
# Add the common object files here.
#

ALLOBJS += $(LIBOBJS) $(DEVOBJS) $(CFEOBJS) $(VENOBJS) $(UIOBJS) $(NETOBJS)
#$(PCIOBJS)

#
# VAPI continues to be a special case.
#

ifeq ($(strip ${CFG_VAPI}),1)
include ${TOP}/verif/Makefile
endif

#
# USB support
#

ifeq ($(strip ${CFG_USB}),1)
SRCDIRS += ${TOP}/usb
CFE_INC += ${TOP}/usb
include ${TOP}/usb/Makefile
endif

#
# If we're doing the VGA console thing, pull in the x86 emulator
# and the pcconsole subsystem
#

ifeq ($(strip ${CFG_VGACONSOLE}),1)
include ${TOP}/x86emu/Makefile
include ${TOP}/pccons/Makefile
endif

#
# If we're including ZLIB, then add its makefile.
#

##ifeq ($(strip ${CFG_ZLIB}),1)
##include ${TOP}/zlib/Makefile
CFLAGS += -DCFG_ZLIB=1 -DMY_ZCALLOC -DNO_MEMCPY
##endif

.PHONY : all 
.PHONY : ALL
.PHONY : build_date.c

#
# Build the local tools that we use to construct other source files
#

mkpcidb : ${TOP}/hosttools/mkpcidb.c
	gcc -o mkpcidb ${TOP}/hosttools/mkpcidb.c

memconfig : ${TOP}/hosttools/memconfig.c
	gcc -o memconfig -D_MCSTANDALONE_ -D_MCSTANDALONE_NOISY_ -I${TOP}/arch/mips/cpu/sb1250/include ${TOP}/hosttools/memconfig.c ${TOP}/arch/${ARCH}/cpu/${CPU}/src/sb1250_draminit.c

pcidevs_data2.h : mkpcidb ${TOP}/pci/pcidevs_data.h
	./mkpcidb > pcidevs_data2.h

mkflashimage : ${TOP}/hosttools/mkflashimage.c
	gcc -o mkflashimage -I${TOP}/include ${TOP}/hosttools/mkflashimage.c

pci_subr.o : ${TOP}/pci/pci_subr.c pcidevs_data2.h

##build_date.c :
##	echo "const char *builddate = \"`date`\";" > build_date.c
##	echo "const char *builduser = \"`whoami`@`hostname`\";" >> build_date.c

#
# Make a define for the board name
#

CFLAGS += -D_$(patsubst "%",%,${CFG_BOARDNAME})_

LIBCFE = libcfe.a

%.o : %.c
	$(GCC) $(CFLAGS) -o $@ $<

%.o : %.S
	$(GCC) $(CFLAGS) -o $@ $<

#
# This rule constructs "libcfe.a" which contains most of the object
# files.
#

$(LIBCFE) : $(ALLOBJS)
	rm -f $(LIBCFE)
	$(AR) cr $(LIBCFE) $(ALLOBJS)
	$(RANLIB) $(LIBCFE)