Trace interrupts with the capture engine

Jennifer Averett Jennifer.Averett at OARcorp.com
Wed Jan 7 19:10:40 UTC 2015


A couple of points:

  1.  What we had discussed in the past was using rtems-tld to generate
        wrappers

  2.  This only works for simple vectored and doesn't account for PIC interrupts

Jennifer Averett
On-Line Applications Research
________________________________________
From: Daniel Cederman [cederman at gaisler.com]
Sent: Wednesday, January 07, 2015 8:49 AM
To: devel at rtems.org
Cc: Joel Sherrill; Jennifer Averett; Daniel Hellstrom
Subject: Trace interrupts with the capture engine

Hello,

I am looking into adding support to the capture engine to trace
interrupts. One possible way, which seems generic and would not require
any changes to the BSPs, is to replace the ISR for a specific interrupt
with a wrapper that adds a record to the capture log before and after it
calls the original ISR. I have attached some code below to show how it
could be done. The wrapper could be installed/uninstalled using
rtems_interrupt_catch(). Would this be an acceptable solution or can you
see any immediate problems with this approach?

rtems_isr_entry original_vector_table[CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER];

static void record_interrupt(rtems_vector_number vector)
{
   void* rec;
   Thread_Control* tcb = _Thread_Get_executing();

   if (!rtems_capture_task_recorded (tcb))
     rtems_capture_record_task (tcb);

   rtems_capture_begin_add_record(tcb, RTEMS_CAPTURE_INTERRUPT_ENTER,
       sizeof(rtems_capture_interrupt_record_t), &rec);
   rtems_capture_append_to_record(rec, &vector,
sizeof(rtems_vector_number));
   rtems_capture_end_add_record(rec);

   original_vector_table[vector](vector);

   rtems_capture_begin_add_record(tcb, RTEMS_CAPTURE_INTERRUPT_EXIT,
       sizeof(rtems_capture_interrupt_record_t), &rec);
   rtems_capture_append_to_record(rec, &vector,
sizeof(rtems_vector_number));
   rtems_capture_end_add_record(rec);
}

void capture_interrupt(rtems_vector_number vector)
{
   rtems_interrupt_catch(record_interrupt, vector,
&original_vector_table[vector]);
}

--
Daniel Cederman
Software Engineer
Aeroflex Gaisler AB
Aeroflex Microelectronic Solutions – HiRel
Kungsgatan 12
SE-411 19 Gothenburg, Sweden
cederman at gaisler.com
www.Aeroflex.com/Gaisler


More information about the devel mailing list