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
|
# Make header for SBE image build
#
# Settings to for SBE image file build
#
# IMG_INCLUDES : Aplication-specific header search paths
#
# DEFS : A string of -D<symbol>[=<value>] to control compilation
#
# PK : Default ..; The path to the PK source code.
# The default is set for building the PK
# subdirectories.
#
# PK_THREAD_SUPPORT : (0/1, default 1); Compile PK thread and
# semaphore suppprt
#
# PK_TIMER_SUPPORT : (0/1, default 1); Compile PK timer suppprt
#
# GCC-O-LEVEL : The optimization level passed to GCC (default -Os). May
# also be defined empty (GCC-O-LEVEL=) to disable
# optimization. This variable can also be used to pass
# any other non-default setting to GCC, e.g.
# make GCC-O-LEVEL="-Os -fno-branch-count-reg"
#
# GCC-TOOL-PREFIX : The full path (including executable file prefixes) to
# the GCC cross-development tools to use. The default is
# "ppcnf-mcp5-"
#
# CTEPATH : This variable defaults to the afs/awd CTE tool
# installation - The PORE binutils are stored there. If
# you are not in Austin be sure to define CTEPATH in
# your .profile.
#
# OBJDIR : target directory for all generated files
IMAGE_SEEPROM_NAME := seeprom_main
IMAGE_SBE_NAME := sbe_main
IMAGE_LOADER_NAME := loader_main
PPE_TYPE := std
ifndef IMAGE_SRCDIR
export IMAGE_SRCDIR = $(abspath .)
endif
ifndef CACHE_SRCDIR
export CACHE_SRCDIR = $(abspath ../../hwp/cache)
endif
ifndef CORE_SRCDIR
export CORE_SRCDIR = $(abspath ../../hwp/core)
endif
ifndef PERV_SRCDIR
export PERV_SRCDIR = $(abspath ../../hwp/perv)
endif
ifndef NEST_SRCDIR
export NEST_SRCDIR = $(abspath ../../hwp/nest)
endif
ifndef HWPLIB_SRCDIR
export HWPLIB_SRCDIR = $(abspath ../../hwp/lib)
endif
ifndef IMG_INCLUDES
export IMG_INCLUDES = -I$(IMAGE_SRCDIR) -I$(CACHE_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR)
endif
ifndef BASE_OBJDIR
export BASE_OBJDIR = $(abspath ../obj)
endif
export IMG_OBJDIR = $(BASE_OBJDIR)/$(IMAGE_SEEPROM_NAME)
ifndef PK_SRCDIR
export PK_SRCDIR = $(abspath ../../pk)
endif
ifndef TOOLS_ATTR_DIR
export TOOLS_ATTR_DIR = $(abspath ../../tools/scripts)
endif
ifndef TOOLS_IMAGE_DIR
export TOOLS_IMAGE_DIR = $(abspath ../../tools/image)
endif
ifndef IMPORT_XML_DIR
export IMPORT_XML_DIR = $(abspath ../../importtemp/xml)
endif
ifndef IMPORT_COMMON_DIR
export IMPORT_COMMON_DIR = $(abspath ../../importtemp/common)
endif
ifndef P2P_SRCDIR
export P2P_SRCDIR = $(abspath ../../tools/PowerPCtoPPE)
endif
ifndef PPETRACEPP_DIR
export PPETRACEPP_DIR = $(abspath ../../tools/ppetracepp)
endif
ifndef PLAT_FAPI2_DIR
export PLAT_FAPI2_DIR = $(abspath ../plat)
endif
ifndef PPE_FAPI2_DIR
export PPE_FAPI2_DIR = $(abspath ../../hwpf/plat)
endif
ifndef BASE_FAPI2_DIR
export BASE_FAPI2_DIR = $(abspath ../../importtemp/fapi2)
endif
ifndef CC_ROOT
export CC_ROOT = ${CTEPATH}/tools/gcc405lin/prod
endif
ifndef GCC-TOOL-PREFIX
GCC-TOOL-PREFIX = ${CC_ROOT}/usr/bin/powerpc-linux-
endif
ifndef BINUTILS-TOOL-PREFIX
BINUTILS-TOOL-PREFIX = $(CTEPATH)/tools/ppetools/prod/powerpc-eabi/bin/
endif
OBJDIR = $(BASE_OBJDIR)$(SUB_OBJDIR)
CC_ASM = $(GCC-TOOL-PREFIX)gcc
#TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)g++
TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
CC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
AS = $(BINUTILS-TOOL-PREFIX)as
AR = $(BINUTILS-TOOL-PREFIX)ar
LD = $(BINUTILS-TOOL-PREFIX)ld
OBJDUMP = $(BINUTILS-TOOL-PREFIX)objdump
OBJCOPY = $(BINUTILS-TOOL-PREFIX)objcopy
TCPP = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc
THASH = $(PPETRACEPP_DIR)/tracehash.pl
CPP = $(GCC-TOOL-PREFIX)gcc
ifdef P2P_ENABLE
PCP = $(P2P_SRCDIR)/ppc-ppe-pcp.py
endif
ifndef CTEPATH
$(warning The CTEPATH variable is not defined; Defaulting to /afs/awd)
export CTEPATH = /afs/awd/projects/cte
endif
ifeq "$(PK_TIMER_SUPPORT)" ""
PK_TIMER_SUPPORT = 1
endif
ifeq "$(PK_THREAD_SUPPORT)" ""
PK_THREAD_SUPPORT = 1
endif
ifeq "$(PK_TRACE_SUPPORT)" ""
PK_TRACE_SUPPORT = 1
endif
# Generate a 16bit trace string hash prefix value based on the name of this image. This will form
# the upper 16 bits of the 32 bit trace hash values.
ifndef PK_TRACE_HASH_PREFIX
PK_TRACE_HASH_PREFIX := $(shell echo $(IMAGE_SEEPROM_NAME) | md5sum | cut -c1-4 | xargs -i printf "%d" 0x{})
endif
ifndef GCC-O-LEVEL
#GCC-O-LEVEL = -Os
#GCC-O-LEVEL = -O -g
GCC-O-LEVEL = -O
endif
GCC-DEFS += -DIMAGE_NAME=$(IMAGE_SEEPROM_NAME)
GCC-DEFS += -DPK_TIMER_SUPPORT=$(PK_TIMER_SUPPORT)
GCC-DEFS += -DPK_THREAD_SUPPORT=$(PK_THREAD_SUPPORT)
GCC-DEFS += -DPK_TRACE_SUPPORT=$(PK_TRACE_SUPPORT)
GCC-DEFS += -DPK_TRACE_HASH_PREFIX=$(PK_TRACE_HASH_PREFIX)
GCC-DEFS += -DUSE_PK_APP_CFG_H=1
GCC-DEFS += -D__PK__=1
GCC-DEFS += -D__SBE__=1
GCC-DEFS += -D__PPE__=1
GCC-DEFS += -DFAPI2_NO_FFDC=1
DEFS += $(GCC-DEFS)
export LD_LIBRARY_PATH = /afs/awd.austin.ibm.com/proj/p3/cte/tools/gcc405lin/vol1/usr/lib
############################################################################
INCLUDES += $(IMG_INCLUDES)
INCLUDES += -I$(IMAGE_SRCDIR)/../../../include
INCLUDES += -I$(PLAT_FAPI2_DIR)/include
INCLUDES += -I$(PPE_FAPI2_DIR)/include
INCLUDES += -I$(BASE_FAPI2_DIR)/include
INCLUDES += -I$(PK_SRCDIR)/../include
INCLUDES += -I$(PK_SRCDIR)/$(PPE_TYPE)
INCLUDES += -I$(PK_SRCDIR)/../include
INCLUDES += -I$(PK_SRCDIR)/kernel
INCLUDES += -I$(PK_SRCDIR)/ppe
INCLUDES += -I$(PK_SRCDIR)/ppe42
INCLUDES += -I$(PK_SRCDIR)/../sbe/sbefw
INCLUDES += -I$(PK_SRCDIR)/trace
INCLUDES += -I$(PK_SRCDIR)/../tools/ppetracepp
INCLUDES += -I$(IMPORT_COMMON_DIR)/include
PIPE-CFLAGS = -pipe -Wa,-m405
# -Wno-error=unused-label , needs to be in.
GCC-CFLAGS += -Wall -Werror -Wno-unused-label
GCC-CFLAGS += -msoft-float -mcpu=405 -mmulhw
GCC-CFLAGS += -meabi -msdata=eabi
GCC-CFLAGS += -ffreestanding
GCC-CFLAGS += -fno-common
GCC-CFLAGS += -fsigned-char
GCC-CFLAGS += -fno-inline-functions-called-once
GCC-CFLAGS += -ffixed-r11
GCC-CFLAGS += -ffixed-r12
GCC-CFLAGS += -ffixed-r14
GCC-CFLAGS += -ffixed-r15
GCC-CFLAGS += -ffixed-r16
GCC-CFLAGS += -ffixed-r17
GCC-CFLAGS += -ffixed-r18
GCC-CFLAGS += -ffixed-r19
GCC-CFLAGS += -ffixed-r20
GCC-CFLAGS += -ffixed-r21
GCC-CFLAGS += -ffixed-r22
GCC-CFLAGS += -ffixed-r23
GCC-CFLAGS += -ffixed-r24
GCC-CFLAGS += -ffixed-r25
GCC-CFLAGS += -ffixed-r26
GCC-CFLAGS += -ffixed-r27
GCC-CFLAGS += -ffixed-cr1
GCC-CFLAGS += -ffixed-cr2
GCC-CFLAGS += -ffixed-cr3
GCC-CFLAGS += -ffixed-cr4
GCC-CFLAGS += -ffixed-cr5
GCC-CFLAGS += -ffixed-cr6
GCC-CFLAGS += -ffixed-cr7
CFLAGS =
PPE-CFLAGS = $(CFLAGS) -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES)
CPPFLAGS = -E -std=c++11
#CPPFLAGS = -E
ASFLAGS = -mppe42
ifdef P2P_ENABLE
#use this to disable optimizations (fused compare/branch etc.)
PCP-FLAG =
#use this to enable optimizations
#PCP-FLAG =
endif
############################################################################
#override the GNU Make implicit rule for going from a .C to a .o
%.o: %.C
$(OBJDIR)/%.s: %.C
$(TCC) $(PPE-CFLAGS) $(DEFS) -S -std=c++11 -o $@ $<
#override the GNU Make implicit rule for going from a .c to a .o
%.o: %.c
$(OBJDIR)/%.s: %.c
$(CC) $(PPE-CFLAGS) $(DEFS) -S -o $@ $<
#override the GNU Make implicit rule for going from a .S to a .o
%.o: %.S
$(OBJDIR)/%.s: %.S
$(TCPP) $(PPE-CFLAGS) $(DEFS) $(CPPFLAGS) -o $@ $<
.PRECIOUS: $(OBJDIR)/%.s
ifndef P2P_ENABLE
$(OBJDIR)/%.o: $(OBJDIR)/%.s
$(AS) $(ASFLAGS) -o $@ $<
else
$(OBJDIR)/%.es: $(OBJDIR)/%.s
$(PCP) $(PCP-FLAG) -f $<
.PRECIOUS: $(OBJDIR)/%.es
$(OBJDIR)/%.o: $(OBJDIR)/%.es
$(AS) $(ASFLAGS) -o $@ $<
endif
# From the GNU 'Make' manual - these scripts uses the preprocessor to
# create dependency files (*.d), then mungs them slightly to make them
# work as Make targets. The *.d files are include-ed in the
# subdirectory Makefiles.
$(OBJDIR)/%.d: %.C
@set -e; rm -f $@; \
echo -n "$(OBJDIR)/" > $@.$$$$; \
$(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(OBJDIR)/%.d: %.c
@set -e; rm -f $@; \
echo -n "$(OBJDIR)/" > $@.$$$$; \
echo "$(INCLUDES)"; \
$(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(OBJDIR)/%.d: %.S
@set -e; rm -f $@; \
echo -n "$(OBJDIR)/" > $@.$$$$; \
$(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
|