Commit c695746d authored by julien.delange's avatar julien.delange
Browse files

finish to integrate gprof for LEON/RTEMS



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@642 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 7b8fa421
......@@ -43,11 +43,6 @@ ifeq ($(ENABLE_DYNAMIC_CONFIGURATION),1)
CFLAGS+=-D__PO_HI_USE_DYNAMIC_CONFIGURATION
endif
ifdef USE_GPROF
CFLAGS+=-pg -D__PO_HI_USE_GPROF
LDFLAGS+=-pg
endif
ifdef TARGET_INCLUDE
INCLUDE=-I. -I$(RUNTIME_PATH)/include/ $(TARGET_INCLUDE)
else
......
......@@ -28,7 +28,7 @@ TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_POSIX -DLEON_RTEMS
TARGET_INCLUDE = -I $(RUNTIME_PATH)/config/leon-rtems/
LD =
LD = sparc-rtems-ld
TARGET_LDFLAGS = -lrtemsbsp -lc
target-clean:
......@@ -48,3 +48,8 @@ define bsp-link-cxx
-o $(BINARY) $(LINK_OBJS) $(LINK_LIBS)
endef
ifdef USE_GPROF
TARGET_LDFLAGS+=-Wl,--wrap,Clock_isr
TARGET_CFLAGS+=-D__PO_HI_USE_GPROF
endif
......@@ -65,9 +65,7 @@ static char sccsid[] = "@(#)gmon.c 1.0 (E.S.A) 10/05/2010";
#include <rtems.h>
#include <bsp.h>
/*
* This was derived from above and modified to add different profiling info.
*/
#define CONFIG_OS_PROFILE_OVER_SERIAL 1
/*
* Histogram counters are unsigned shorts (according to the kernel).
......@@ -274,6 +272,7 @@ static char *s_profil = 0;
static void moncontrol( int mode );
static rtems_isr profile_clock_isr(rtems_vector_number vector);
static rtems_isr Clock_isr(rtems_vector_number vector);
static void moncontrol( int mode )
{
......@@ -531,12 +530,12 @@ overflow:
extern rtems_status_code __real_Clock_isr();
static uint32_t pc = 0;
/*
rtems_isr __wrap_Clock_isr()
{
if( s_profil && s_profil_sz )
{
// SAVE_L1(pc);
/* This identifies the function that was just entered. */
// SAVE_L1(pc);
if( pc )
{
pc -= (int)s_lowpc;
......@@ -549,16 +548,81 @@ rtems_isr __wrap_Clock_isr()
__real_Clock_isr();
}
*/
rtems_isr Clock_isr(rtems_vector_number vector);
static rtems_isr profile_clock_isr(rtems_vector_number vector)
{
SAVE_L1(pc);
Clock_isr(vector);
}
#if (CONFIG_OS_PROFILE_OVER_SERIAL == 1)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <errno.h>
#include <sys/systm.h>
#define SERIAL_VERBOSE_MODE 1
#define BAUDRATE B57600
/******************************************************
* Private global variables declaration
******************************************************/
/**
* the serial connection file descriptor
**/
static int serialFD = -1;
/******************************************************
* Function implementation
******************************************************/
int initialize_serial()
{
struct termios oldtio, newtio;
serialFD = open( "/dev/apburasta0" , O_RDWR | O_NOCTTY);
if( serialFD < 0 )
{
#if(SERIAL_VERBOSE_MODE == 1)
printk("can't open new device! error = %d" , serialFD);
#endif
return -1;
}
tcgetattr(serialFD , &oldtio);
bzero(&newtio, sizeof(newtio));
newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR | ICRNL;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VTIME] = 0;
newtio.c_cc[VMIN] = 1;
tcflush(serialFD , TCIFLUSH);
tcsetattr(serialFD , TCSANOW , &newtio);
return 0;
}
void write_serial(uint8_t vector[] , unsigned int dim)
{
write(serialFD , vector , dim);
}
#endif /* TIMELINE_USE_SERIAL_CABLE */
#endif
......@@ -106,6 +106,7 @@ int __po_hi_wait_initialization ()
void __po_hi_wait_end_of_instrumentation ()
{
#include <po_hi_time.h>
__po_hi_time_t now;
__po_hi_get_time (&now);
__po_hi_delay_until (__po_hi_add_times (now, __po_hi_seconds (10)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment