From 4103221248508ac1aa16a07e5ae7cac8b9860d57 Mon Sep 17 00:00:00 2001 From: William Bryan Date: Wed, 26 Aug 2015 17:01:40 -0500 Subject: Enable tracing I've reverted the way we trace from SSX_TRACE to the P8 way More useful way of compiling for Simics vs HW RTC: 133155 Change-Id: I7ac3ce9ad71e36de0cf0050f14ff3d2423c9f75f Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/20113 Tested-by: William A. Bryan Reviewed-by: Wael Elessawy Reviewed-by: Martha Broyles Reviewed-by: William A. Bryan --- src/occ_405/Makefile | 3 +++ src/occ_405/img_defs.mk | 9 +++++++-- src/occ_405/main.c | 10 ++++++---- src/occ_405/occ_defs.mk | 28 ++++++++++++++++++++++++++++ src/occ_405/ssx_app_cfg.h | 4 ++++ src/occ_405/trac/trac.h | 26 ++++++++++---------------- src/occ_405/trac/trac_interface.c | 15 +++++++++++---- src/occ_405/trac/trac_interface.h | 7 ++----- 8 files changed, 71 insertions(+), 31 deletions(-) create mode 100644 src/occ_405/occ_defs.mk (limited to 'src/occ_405') diff --git a/src/occ_405/Makefile b/src/occ_405/Makefile index 1d173dc..26e5169 100755 --- a/src/occ_405/Makefile +++ b/src/occ_405/Makefile @@ -28,6 +28,9 @@ #Pull in the definitions that affect all makefiles for this image include img_defs.mk +#Use tracepp instead of ppetracepp for 405 code +include occ_defs.mk + #Pull in object file names for the top directory include topfiles.mk diff --git a/src/occ_405/img_defs.mk b/src/occ_405/img_defs.mk index de8aec6..4695d51 100644 --- a/src/occ_405/img_defs.mk +++ b/src/occ_405/img_defs.mk @@ -113,8 +113,13 @@ ifndef PPETRACEPP_DIR export PPETRACEPP_DIR = $(abspath ../ppe/tools/ppetracepp) endif +ifndef TRACEPP_DIR +export TRACEPP_DIR = $(abspath ../tracepp) +endif + CC_ASM = $(GCC-TOOL-PREFIX)gcc TCC = $(PPETRACEPP_DIR)/ppetracepp $(GCC-TOOL-PREFIX)gcc +THCC = $(TRACEPP_DIR)/tracepp $(GCC-TOOL-PREFIX)gcc CC = $(GCC-TOOL-PREFIX)gcc AS = $(GCC-TOOL-PREFIX)as AR = $(GCC-TOOL-PREFIX)ar @@ -204,11 +209,11 @@ INCLUDES += $(IMG_INCLUDES) $(GLOBAL_INCLUDES) $(APP_INCLUDES) \ PIPE-CFLAGS = -pipe -Wa,-m405 GCC-CFLAGS += -g -Wall -fsigned-char -msoft-float \ - -mcpu=405 -mmultiple -mstring -m32 \ + -m32 -mbig-endian -mcpu=405 -mmultiple -mstring \ -meabi -msdata=eabi -ffreestanding -fno-common \ -fno-inline-functions-called-once -CFLAGS = -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES) +CFLAGS = -c $(GCC-CFLAGS) $(PIPE-CFLAGS) $(GCC-O-LEVEL) $(INCLUDES) ############################################################################ diff --git a/src/occ_405/main.c b/src/occ_405/main.c index bf0d653..d795eef 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -1278,10 +1278,12 @@ int main(int argc, char **argv) // enable and register additional interrupt handlers CHECKPOINT(INITIALIZING_IRQS); -// TODO: Uncomment when this is resolved. Causes SSX panic currently. -// Not needed until we want to be able to catch hardware OCC or -// PMC (or equivalent) errors. -// occ_irq_setup(); +// TODO: Uncomment when this is resolved in Simics. Causes SSX panic +// currently. Not needed until we want to be able to catch +// hardware OCC or PMC (or equivalent) errors. +#if !SIMICS_ENVIRONMENT + occ_irq_setup(); +#endif CHECKPOINT(IRQS_INITIALIZED); diff --git a/src/occ_405/occ_defs.mk b/src/occ_405/occ_defs.mk new file mode 100644 index 0000000..4c276e0 --- /dev/null +++ b/src/occ_405/occ_defs.mk @@ -0,0 +1,28 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/occ_405/occ_defs.mk $ +# +# OpenPOWER OnChipController Project +# +# Contributors Listed Below - COPYRIGHT 2015 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG +%.o: %.c +$(OBJDIR)/%.o: %.c + $(THCC) $(CFLAGS) $(DEFS) -o $@ $< + diff --git a/src/occ_405/ssx_app_cfg.h b/src/occ_405/ssx_app_cfg.h index d9a9b3b..9ab733a 100755 --- a/src/occ_405/ssx_app_cfg.h +++ b/src/occ_405/ssx_app_cfg.h @@ -162,6 +162,7 @@ do { \ #ifndef SIMICS_ENVIRONMENT #define SIMICS_ENVIRONMENT 1 +#warning Building for Simics! #endif #ifndef USE_SIMICS_IO @@ -180,6 +181,9 @@ do { \ #define USE_EPM_IO 0 #endif +#if SIMICS_ENVIRONMENT +#define PPC405_MMU_SUPPORT 0 +#endif /// The buffer used for 'ssxout' in VBU and lab applications /// diff --git a/src/occ_405/trac/trac.h b/src/occ_405/trac/trac.h index ea9961c..d5154d4 100755 --- a/src/occ_405/trac/trac.h +++ b/src/occ_405/trac/trac.h @@ -25,21 +25,21 @@ #ifndef _trac_h #define _trac_h -//************************************************************************* +//*************************************************************************/ // Includes -//************************************************************************* +//*************************************************************************/ #include -//************************************************************************* +//*************************************************************************/ // Externs -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Macros -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Defines/Enums -//************************************************************************* +//*************************************************************************/ #ifndef NO_TRAC_STRINGS #define ERR_MRK "ERR: " @@ -75,7 +75,7 @@ extern void dumpHexString(const void *i_data, const unsigned int len, const char #else //TRAC_TO_SIMICS -/* + #define TRAC_ERR(frmt,args...) \ TRACE(g_trac_err,ERR_MRK frmt,##args) #define TRAC_INFO(frmt,args...) \ @@ -86,14 +86,8 @@ extern void dumpHexString(const void *i_data, const unsigned int len, const char TRACE(g_trac_inf,DBG_MRK fmt,##args) #define DEBUG_HEXDUMP(data, len, string) \ TRACEBIN(g_trac_inf, string, data,len) -*/ -#define TRAC_ERR SSX_TRACE -#define TRAC_INFO SSX_TRACE -#define TRAC_IMP SSX_TRACE -#define DBG_PRINT SSX_TRACE -#define DEBUG_HEXDUMP SSX_TRACE_BIN -#endif //TRAC_TO_SIMICS +#endif //TRAC_TO_SIMICS #ifdef MAIN_DEBUG #define MAIN_DBG(frmt,args...) \ diff --git a/src/occ_405/trac/trac_interface.c b/src/occ_405/trac/trac_interface.c index c524d79..a49cbba 100755 --- a/src/occ_405/trac/trac_interface.c +++ b/src/occ_405/trac/trac_interface.c @@ -56,13 +56,13 @@ #define TRAC_TIME_200MHZ 2 #define TRAC_TIME_167MHZ 3 // 166666667Hz -//************************************************************************* +//*************************************************************************/ // Structures -//************************************************************************* +//*************************************************************************/ -//************************************************************************* +//*************************************************************************/ // Globals -//************************************************************************* +//*************************************************************************/ /// Instantiate the buffers for the traces. /// @@ -74,6 +74,13 @@ uint8_t g_trac_inf_buffer[TRACE_BUFFER_SIZE]; uint8_t g_trac_err_buffer[TRACE_BUFFER_SIZE]; uint8_t g_trac_imp_buffer[TRACE_BUFFER_SIZE]; +#if SIMICS_ENVIRONMENT +// Necessary for use in Simics (to get address) +uint8_t* g_trac_inf_buffer_ptr = g_trac_inf_buffer; +uint8_t* g_trac_err_buffer_ptr = g_trac_err_buffer; +uint8_t* g_trac_imp_buffer_ptr = g_trac_imp_buffer; +#endif + // Need to modify the addTraceToErrl() function in errl.c when new trace buffer is added/removed tracDesc_t g_trac_inf = (tracDesc_t) &g_trac_inf_buffer; tracDesc_t g_trac_err = (tracDesc_t) &g_trac_err_buffer; diff --git a/src/occ_405/trac/trac_interface.h b/src/occ_405/trac/trac_interface.h index f573899..c5f21bd 100755 --- a/src/occ_405/trac/trac_interface.h +++ b/src/occ_405/trac/trac_interface.h @@ -43,13 +43,10 @@ #define TRACE(i_td,i_string,args...) \ - SSX_TRACE(i_string, args...) -// trace_adal_write_all(i_td,trace_adal_hash(i_string,-1),__LINE__,0,##args) + trace_adal_write_all(i_td,trace_adal_hash(i_string,-1),__LINE__,0,##args) #define TRACEBIN(i_td,i_string,i_ptr,i_size) \ - SSX_TRACE_BIN(i_string, i_ptr, i_size) -// trac_write_bin(i_td,trace_adal_hash(i_string,0),__LINE__,i_ptr,i_size) - + trac_write_bin(i_td,trace_adal_hash(i_string,0),__LINE__,i_ptr,i_size) #ifndef NO_TRAC_STRINGS -- cgit v1.2.1