summaryrefslogtreecommitdiffstats
path: root/src/occ_405/Makefile
diff options
context:
space:
mode:
authorWilliam Bryan <wilbryan@us.ibm.com>2015-08-06 17:38:30 -0500
committerWilliam A. Bryan <wilbryan@us.ibm.com>2015-08-07 13:03:14 -0500
commit415a7a297bcd313516be30ae88277379f3377cc9 (patch)
tree5f7f7a8ecfb49e5ad6268d16efcc5ac5feadae1d /src/occ_405/Makefile
parentc64c10490a90584ad69d12dd4fac1a4288a26c45 (diff)
downloadtalos-occ-415a7a297bcd313516be30ae88277379f3377cc9.tar.gz
talos-occ-415a7a297bcd313516be30ae88277379f3377cc9.zip
OCC405 Stripped Down and Compiles
Change-Id: Ic5c0536de429106975f5b5b0831c645d6f53e86c Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19650 Tested-by: William A. Bryan <wilbryan@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com> Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Diffstat (limited to 'src/occ_405/Makefile')
-rwxr-xr-xsrc/occ_405/Makefile154
1 files changed, 90 insertions, 64 deletions
diff --git a/src/occ_405/Makefile b/src/occ_405/Makefile
index bba6075..da572d0 100755
--- a/src/occ_405/Makefile
+++ b/src/occ_405/Makefile
@@ -1,11 +1,11 @@
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
-# $Source: src/occ/Makefile $
+# $Source: src/occ_405/Makefile $
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2015
+# Contributors Listed Below - COPYRIGHT 2015
# [+] International Business Machines Corp.
#
#
@@ -22,70 +22,96 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+# This Makefile compiles all of the SSX code required for the P9 port
+# of SSX. See the "img_defs.mk" file in this directory.
-include cfiles.mk
-include gpefiles.mk
-
-APP = occ
-APP_INCLUDES += -I../ssx
-APP_INCLUDES += -I../lib
-APP_INCLUDES += -I./incl
-APP_INCLUDES += -I./trac
-APP_INCLUDES += -I./async
-APP_INCLUDES += -I./errl
-APP_INCLUDES += -I./gpe
-APP_INCLUDES += -I./thread
-APP_INCLUDES += -I./aplt
-APP_INCLUDES += -I./aplt/incl
-APP_INCLUDES += -I./rtls
-APP_INCLUDES += -I./dcom
-APP_INCLUDES += -I./sensor
-APP_INCLUDES += -I./pss
-APP_INCLUDES += -I./proc
-APP_INCLUDES += -I./cent
-APP_INCLUDES += -I./cmdh
-APP_INCLUDES += -I./amec
-APP_INCLUDES += -I.
-APP_INCLUDES += -I../occ
-APP_INCLUDES += -I../../occ
-APP_INCLUDES += -I./timer
-APP_INCLUDES += -I./firdata
-
-export APP_INCLUDES
-
-D += -DOCC_FIRMWARE=1 \
- -DSIMICS_MAGIC_PANIC=1 \
- -DOCC=1 \
- -DNONCACHEABLE_SUPPORT=1 \
- -DUSE_SSX_APP_CFG_H=1
-
-# TODO: Needs section comment on default values for compile defs and info on what defs do
-#D = -DVERIFICATION=1 \
- -DSSX_STACK_CHECK=0 \
- -DINITIALIZE_PMC=0 \
- -DINITIALIZE_SIMICS_IO=0 \
- -DINITIALIZE_RTX_IO=1 \
- -DINITIALIZE_PBA=1 \
- -DSIMICS_MAGIC_PANIC=1 \
- -DSSX_KERNEL_TRACE_ENABLE=1
-
-# TODO: Aren't trace strings hashed out of the image already?
-# If this makefile is called as "make NO_TRAC_STRINGS=1" then trace strings
-# won't be built into the image. This will be used for metrics regarded to the
-# realistic OCC Code Size. Note that "make clean" must be run before this define
-# will be picked up by the compiler, otherwise previously compiled objects will
-# be used. You can also see the space used by strings by running:
-# strings occ.bin | \grep "ERR\|INF\|IMP" | sed 's/^...: %s: //g' | wc -m
-ifdef NO_TRAC_STRINGS
-D += -DNO_TRAC_STRINGS=1
-endif
+#Pull in the definitions that affect all makefiles for this image
+include img_defs.mk
+
+#Pull in object file names for the top directory
+include topfiles.mk
+
+SSX_MAKE_DIR := $(SSX_SRCDIR)/occhw
+OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS))
+OBJDIRS = $(dir ${OBJS})
+SSXLIB := $(OBJDIR)/ssx/libssx.a
+COMMONLIB := $(OBJDIR)/common/libcommon.a
+OCCLIB := $(OBJDIR)/occlib/libocc.a
+PPC405LIB := $(OBJDIR)/ppc405lib/libppc405.a
+LINK_OBJS = $(OBJS) $(SSXLIB) $(COMMONLIB) $(OCCLIB) $(PPC405LIB)
+LINK_SCRIPT = $(addprefix $(OBJDIR)/, linkscript)
+LDFLAGS += --oformat=elf32-powerpc -melf32ppc
+LIB_DIRS = -L$(OBJDIR)/ssx \
+ -L$(OBJDIR)/ssx/ppc405 \
+ -L$(OBJDIR)/ssx/ppc32 \
+ -L$(OBJDIR)/commonlib \
+ -L$(OBJDIR)/occlib \
+ -L$(OBJDIR)/ppc405lib \
+ -L$(OBJDIR) \
+ -L$(OBJDIR)/aplt \
+ -L$(OBJDIR)/cmdh \
+ -L$(OBJDIR)/dcom \
+ -L$(OBJDIR)/errl \
+ -L$(OBJDIR)/pss \
+ -L$(OBJDIR)/rtls \
+ -L$(OBJDIR)/thread \
+ -L$(OBJDIR)/timer \
+ -L$(OBJDIR)/trac \
+
+#default target is to make a binary application image
+#This removes all unecessary headers from the ELF executable
+$(OBJDIR)/$(IMAGE_NAME).bin $(OBJDIR)/$(IMAGE_NAME).dis: $(OBJDIR)/$(IMAGE_NAME).out
+ $(OBJCOPY) -O binary $< $(OBJDIR)/$(IMAGE_NAME).bin
+ $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_NAME).dis
+
+#create a linked ELF executable
+$(OBJDIR)/$(IMAGE_NAME).out: $(LINK_OBJS) $(LINK_SCRIPT)
+ $(LD) -e __ssx_boot -T$(LINK_SCRIPT) $(LDFLAGS) -Map $(OBJDIR)/$(IMAGE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_NAME).out $(LIB_DIRS) -lssx -locc -lppc405 -lcommon
+
+#pass the link command file through the C preprocessor to evaluate macros and remove comments
+$(LINK_SCRIPT): linkocc.cmd
+ $(CPP) -E -x c -P $(DEFS) linkocc.cmd -o $(LINK_SCRIPT)
+
+#Create an obj directory if needed
+$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d): | $(OBJDIRS)
-SOURCES = ${all_cfiles} ${all_gpefiles}
-MODE = validation
-PGP_ASYNC_SUPPORT = 1
+$(OBJDIRS):
+ mkdir -p $(OBJDIRS)
+
-include ./app.mk
+#Build the SSX kernel library
+$(SSXLIB):
+ $(MAKE) -I $(IMAGE_SRCDIR) -C $(SSX_MAKE_DIR)
-pgas:
- $(CC) $(CFLAGS) -c -Wa,-al -Wa,--listing-cont-lines='10' ${all_gpefiles}
+#Build the code that is common for all processors (PPE's and 405)
+$(COMMONLIB):
+ $(MAKE) -I $(IMAGE_SRCDIR) -C $(COMMONLIB_SRCDIR)
+#Build the code that is common for all OCC processors (GPEs and 405)
+$(OCCLIB):
+ $(MAKE) -I $(IMAGE_SRCDIR) -C $(OCCLIB_SRCDIR)
+
+#Build the library code that only works on the ppc405
+$(PPC405LIB):
+ $(MAKE) -I $(IMAGE_SRCDIR) -C $(PPC405LIB_SRCDIR)
+
+# collect all of the trace hash files for this image into a single trexStringFile
+.PHONY : tracehash
+tracehash:
+ mkdir -p $(OBJDIR)
+ $(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile
+
+# load and run the 405 image in simics
+run: $(OBJDIR)/$(IMAGE_NAME).out
+ $(SIMICS_WS)/simics \
+ -e '$$occ_405_binary_to_load=$(OBJDIR)/$(IMAGE_NAME).out' modelsetup.simics
+
+#clean out all generated files
+.PHONY : clean
+clean:
+ rm -fr $(OBJDIR)
+
+#Add dependencies to header files
+ifneq ($(MAKECMDGOALS),clean)
+include $(OBJS:.o=.d)
+endif
OpenPOWER on IntegriCloud