Code Confidence technical note 0001 - Kernel instrumentation and the eCos Events View

This technical note describes procedure for the logging of eCos kernel-level events within the eCos Events view. Alarm handling code is used within this illustration, but the procedure is applicable to other applications of this debugging technique.

A common requirement within real-time embedded systems is to execute code at regular intervals. When developing eCos applications, this is typically achieved by creating an alarm object and associating it with the eCos system clock. When the alarm is triggered, an alarm function is called which posts to a semaphore. An application thread waits on the semaphore within a loop to perform some application-specific activity.

To obtain a full picture of system behaviour when the alarm is triggered, it is necessary to enable instrumentation for interrupts, thread operations, counting semaphores, clock operations and alarm-related operations. We also enable application instrumentation to allow the logging of application-level thread execution. For the purposes of illustration, selective instrumentation is disabled. This allows kernel events to be recorded without the need to explicity enable such recording in application code. The appropriate eCos configuration options are shown in the following screenshot:

Instrumentation configuration for an alarm handler (click to zoom)


A breakpoint is placed within the loop of the application thread to allow retrieval of event records by the Code Confidence Tools following triggering of the alarm. On execution of the application, the following event records are generated:

eCos Events presentation for an alarm handler (click to zoom)


The event log presents the sequence of kernel events as they occur in real-time. An interrupt is raised by a hardware timer which results in the system clock ISR being called. The interrupt is acknowledged and the ISR returns with value 3 causing the associated DSR to be called. The system clock is incremented and the alarm triggers. The alarm function is then called in the context of the system clock DSR. The alarm function posts to the application-level semaphore which results in the application thread becoming runnable. The DSR then exits and the scheduler selects the application thread for execution. This thread raises an application-specific event (User1) to indicate execution. The high-resolution timestamps may be used to calculate the duration of each step in this activity. The tooltip indicates the current state of the semaphore at the moment execution was suspended in the loop of the application thread. Back…

News

2016-08-05 : Code Confidence announces tools update for eCos -- based on Eclipse Neon IDE. More…
2016-07-15 : Code Confidence Tools for FreeRTOS updated for Eclipse Neon IDE. More…
2015-10-02 : Hard fault exception decoding added to Code Confidence Tools for FreeRTOS. More…
2012-11-19 : Lauterbach TRACE32 PowerTools validation with Code Confidence Tools for eCos. More…

 Feed…
 Twitter…