diff options
-rw-r--r-- | sbe/sbefw/Makefile | 71 | ||||
-rw-r--r-- | sbe/sbefw/img_defs.mk | 244 | ||||
-rw-r--r-- | sbe/sbefw/link.cmd | 69 |
3 files changed, 14 insertions, 370 deletions
diff --git a/sbe/sbefw/Makefile b/sbe/sbefw/Makefile index f986ce8b..6709d479 100644 --- a/sbe/sbefw/Makefile +++ b/sbe/sbefw/Makefile @@ -1,76 +1,33 @@ -#remove this once we have a real compiler export P2P_ENABLE = 1 -#Pull in the definitions that affect all makefiles for this image -include img_defs.mk +export SUB_OBJDIR = /sbefw -#Pull in object file names for the top directory +include img_defs.mk include topfiles.mk -ifdef P2P_ENABLE -include $(P2P_SRCDIR)/p2pfiles.mk -endif - -PK_MAKE_DIR := $(PK_SRCDIR)/$(PPE_TYPE) OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS)) -PKLIB := $(OBJDIR)/pk/libpk.a - -LIB_DIRS = -L$(OBJDIR)/pk #-L$(OBJDIR)/commonlib -LINK_OBJS = $(OBJS) $(PKLIB) #$(COMMONLIB) -LINK_SCRIPT = $(addprefix $(OBJDIR)/, linkscript) -ifdef P2P_ENABLE -P2PLIB := $(OBJDIR)/p2p/libp2p.a -LIB_DIRS += -L$(OBJDIR)/p2p -LINK_OBJS += $(P2PLIB) -endif - -#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 __system_reset -T$(LINK_SCRIPT) -Map $(OBJDIR)/$(IMAGE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_NAME).out $(LIB_DIRS) $(OBJS) -lpk -lp2p #-lcommon +libsbefw.a: $(OBJS) + $(AR) crs $(OBJDIR)/libsbefw.a $(OBJDIR)/*.o -#pass the link command file through the C preprocessor to evaluate macros and remove comments -$(LINK_SCRIPT): link.cmd - $(CPP) -E -x c++ -P $(DEFS) link.cmd -o $(LINK_SCRIPT) +.PHONY: clean sbefw +sbefw: $(OBJS) -#Create an obj directory if needed -$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d): | $(OBJDIR) +$(OBJS) $(OBJS:.o=.d): | $(OBJDIR) $(OBJDIR): mkdir -p $(OBJDIR) - -.PHONY: clean $(PKLIB) $(P2PLIB) - -#Build macro-specific kernel code -$(PKLIB): - $(MAKE) -I $(IMAGE_SRCDIR) -C $(PK_MAKE_DIR) - -#Build the code that is common for all processors (PPEs and 405) -#$(COMMONLIB): -# $(MAKE) -I $(IMAGE_SRCDIR) -C $(COMMONLIB_SRCDIR) - -ifdef P2P_ENABLE -$(P2PLIB): - $(MAKE) -I $(IMAGE_SRCDIR) -C $(P2P_SRCDIR) -endif - -# 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 + echo "show something else" #clean the kernel directory first, then the application level clean clean: rm -fr $(OBJDIR) -#Add dependencies to header files ifneq ($(MAKECMDGOALS),clean) -include $(OBJS:.o=.d) +include $(OBJS:.o=.d) endif + + + + + diff --git a/sbe/sbefw/img_defs.mk b/sbe/sbefw/img_defs.mk deleted file mode 100644 index 4dbe10d7..00000000 --- a/sbe/sbefw/img_defs.mk +++ /dev/null @@ -1,244 +0,0 @@ -# Make header for GPE PK builds -# -# The application may define the following variables to control the -# build process: -# -# 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 -# -# SIMICS_ENVIRONMENT : (0/1, current default 0); Compile for Simics -# -# SIMICS_MAGIC_PANIC : (0/1, current default 0); Use Simics Magic -# breakpoint for PK_PANIC() instead of PowerPC trap. -# Note that Simics does not model trap correctly in -# external debug mode. -# -# 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_NAME := sbe_main - -# BS - 20150312 - changes to support SBE interrupts -PPE_TYPE := std - -ifndef IMAGE_SRCDIR -export IMAGE_SRCDIR = $(abspath .) -endif - -ifndef IMG_INCLUDES -export IMG_INCLUDES = -I$(IMAGE_SRCDIR) -endif - -ifndef BASE_OBJDIR -export BASE_OBJDIR = $(abspath ../../../obj) -endif - -export IMG_OBJDIR = $(BASE_OBJDIR)/$(IMAGE_NAME) - -ifndef PK_SRCDIR -export PK_SRCDIR = $(abspath ../../pk) -endif - -ifndef GCC-TOOL-PREFIX -GCC-TOOL-PREFIX = $(CTEPATH)/tools/ppcgcc/prod/bin/powerpc-linux- -#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/op-build/output/host/usr/bin/powerpc64-linux- -#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/op-build/buildroot/output/host/usr/bin/powerpc-linux- -#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/op-build/output/host/usr/powerpc64-buildroot-linux-gnu/bin/ -#GCC-TOOL-PREFIX = /afs/bb/u/rembold/openpower/opcustom/op-build/buildroot/output/host/usr/bin/powerpc-linux- -endif - -ifndef BINUTILS-TOOL-PREFIX -BINUTILS-TOOL-PREFIX = $(CTEPATH)/tools/ppetools/prod/powerpc-eabi/bin/ -endif - -ifndef P2P_SRCDIR -export P2P_SRCDIR = $(abspath ../../tools/PowerPCtoPPE) -endif - -ifndef PPETRACEPP_DIR -export PPETRACEPP_DIR = $(abspath ../../tools/ppetracepp) -endif - -OBJDIR = $(BASE_OBJDIR)$(SUB_OBJDIR) - - -CC_ASM = $(GCC-TOOL-PREFIX)gcc -TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc -CC = $(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_NAME) | md5sum | cut -c1-4 | xargs -i printf "%d" 0x{}) -endif - - -ifndef GCC-O-LEVEL -#GCC-O-LEVEL = -Os -GCC-O-LEVEL = -O -g -endif - -GCC-DEFS += -DIMAGE_NAME=$(IMAGE_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 += -D__PK__=1 -# BS - 20150312 -GCC-DEFS += -DUSE_PK_APP_CFG_H=1 -DEFS += $(GCC-DEFS) - -############################################################################ - -INCLUDES += $(IMG_INCLUDES) \ - -I$(PK_SRCDIR)/kernel -I$(PK_SRCDIR)/ppe42 -I$(PK_SRCDIR)/trace \ - -I$(PK_SRCDIR)/$(PPE_TYPE) -I$(PK_SRCDIR)/../include \ - -I$(PK_SRCDIR)/../tools/ppetracepp - -PIPE-CFLAGS = -pipe -Wa,-m405 - -GCC-CFLAGS += -Wall -fsigned-char -msoft-float \ - -mcpu=405 -m32 -mmulhw -mmultiple \ - -meabi -msdata=eabi \ - -ffreestanding -fno-common -Werror \ - -fno-inline-functions-called-once \ - -ffixed-r11 -ffixed-r12 \ - -ffixed-r14 -ffixed-r15 -ffixed-r16 -ffixed-r17 \ - -ffixed-r18 -ffixed-r19 -ffixed-r20 -ffixed-r21 \ - -ffixed-r22 -ffixed-r23 -ffixed-r24 -ffixed-r25 \ - -ffixed-r26 -ffixed-r27 \ - -ffixed-cr1 -ffixed-cr2 -ffixed-cr3 -ffixed-cr4 \ - -ffixed-cr5 -ffixed-cr6 -ffixed-cr7 #-lstdc++ - - -CFLAGS = -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES) - -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) $(CFLAGS) $(DEFS) -S -o $@ $< - - -#override the GNU Make implicit rule for going from a .c to a .o -%.o: %.c - -$(OBJDIR)/%.s: %.c - $(TCC) $(CFLAGS) $(DEFS) -S -o $@ $< - -#override the GNU Make implicit rule for going from a .S to a .o -%.o: %.S - -$(OBJDIR)/%.s: %.S - $(TCPP) $(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)/" > $@.$$$$; \ - $(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 $@.$$$$ - diff --git a/sbe/sbefw/link.cmd b/sbe/sbefw/link.cmd deleted file mode 100644 index a99cbbab..00000000 --- a/sbe/sbefw/link.cmd +++ /dev/null @@ -1,69 +0,0 @@ - -// Need to do this so that elf32-powerpc is not modified! -#undef powerpc - -#ifndef INITIAL_STACK_SIZE -#define INITIAL_STACK_SIZE 256 -#endif - -OUTPUT_FORMAT(elf32-powerpc); - -MEMORY -{ -// sram : ORIGIN = 0xFFF40000, LENGTH = 0xc0000 - sram : ORIGIN = 0xffff0000, LENGTH = 0x10000 -} - -SECTIONS -{ - . = 0xffff0000; - .text : {. = ALIGN(512); *(.vectors) *(.text)} > sram - - //////////////////////////////// - // Read-only Data - //////////////////////////////// - - . = ALIGN(8); - _RODATA_SECTION_BASE = .; - - // SDA2 constant sections .sdata2 and .sbss2 must be adjacent to each - // other. Our SDATA sections are small so we'll use strictly positive - // offsets. - - _SDA2_BASE_ = .; - .sdata2 . : { *(.sdata2) } > sram - .sbss2 . : { *(.sbss2) } > sram - - // Other read-only data. - - .rodata . : { *(.rodata*) *(.got2) } > sram - - _RODATA_SECTION_SIZE = . - _RODATA_SECTION_BASE; - - //////////////////////////////// - // Read-write Data - //////////////////////////////// - - . = ALIGN(8); - _DATA_SECTION_BASE = .; - - // SDA sections .sdata and .sbss must be adjacent to each - // other. Our SDATA sections are small so we'll use strictly positive - // offsets. - - _SDA_BASE_ = .; - .sdata . : { *(.sdata) } > sram - .sbss . : { *(.sbss) } > sram - - // Other read-write data - // It's not clear why boot.S is generating empty .glink,.iplt - - .rela . : { *(.rela*) } > sram - .rwdata . : { *(.data) *(.bss) } > sram -// .iplt . : { *(.iplt) } > sram - - _PK_INITIAL_STACK_LIMIT = .; - . = . + INITIAL_STACK_SIZE; - _PK_INITIAL_STACK = . - 1; - -} |