|
|||
Real Time Non-intrusive Debugging FrameworkSteven He, Cheong Siew Lee Abstract Conventional debugging technique is usually intrusive to the program execution, at time it may require halting of the program flow. This is risky especially in timing critical application, and it may lead to the unrecoverable system damage. This paper briefly discusses a low cost non-intrusive debugging methodology, specifically focus on the timing critical environment. Real time monitoring is the key consideration; other key considerations will be evaluated from hardware, firmware and software aspects, in order to make the setup as flexible as possible. Findings of a case study will also be shared in the subsequent section on this proven methodology. 1. Introduction Debugging is considered one of the most important steps in the development process; in fact this is one of the major activities during the early phase of the development. Having the right debugging tool from the beginning will significantly reduce the unproductive effort. Nevertheless, a single debugging tool may not be sufficient to complete a product development. As the saying goes, good mechanics have many tools; one can’t fix a car with just a hammer. Like good mechanics, good developer needs to be proficient with a variety of tools at different phase of development. Right tool promises great insight into the system operation, and it helps the developer quickly spot problems or issues that would take days to discover by other means. Two of the most common debugging techniques used in embedded system development are:
1. Framework Consideration The debugging framework considers three main aspects:
Figure 1 illustrates the proposed framework in order to realize the above considerations.
The framework can be described in three sections, namely the PC-host software, the DUT monitoring device and the DUT debugging framework. Communication interface between the components are shown in the arrow description. A. PC-host Control & Monitoring Software This is the main interface for user to perform the debugging activity of the DUT. The idea is to provide a configurable, simple to use and meaningful interface for user to perform real time debugging, without halting the program flow. As shown in Figure 1, the software mainly consists of two windows. The first window, as shown in Figure 2, shows the required debugging information by the end user. This means that under different application development scenario, the user is free to choose what debug information to be shown. For example, the edit field can be used to display the DUT internal RAM value. User can also customize a button for an application specific command, or to use a radio button to indicate “pass” or “fail” status.
The second window is an on-screen oscilloscope that allows the user to monitor the DUT internal states and parameters over a configurable timescale. Instead of receiving these states data in numerical form, the screen is very useful. It allows user to monitor internal state in graphical form, therefore user can observe a fix pattern of occurrence.
B. DUT Monitoring Device This is the hardware unit that realizes the target DUT independent requirement. This low cost device consists of a USB chip for PC interface, and an 8-bit microcontroller. The microcontroller provides JTAG and CAN interfaces for the target DUT:
C. DUT Debugging Framework This is a framework that encapsulates with user application to provide the necessary debug information to the PC-host software. User is free to customize the framework to suit the target application. With low cost in consideration, the framework footprint is small enough to fit into an 8-bit microcontroller. The DUT debugging framework consists of two components:
With target DUT independent in mind, the framework is written in C language and the hardware layer is abstracted. This enables the porting to other platform with minimum effort. With the above framework, the three main objectives as highlighted in Section 2 are fulfilled. The following section will highlight a case study. It shows that the proposed framework requires minimal CPU resources and suitable for low-cost 8-bit microcontroller. 3. Case Study: Debugging Class B Software Library The Class B Software Library is developed in compliance to the IEC60730 Annex H standard. The Software Library consists of a set of self-test routines to identify faults in the core registers, CPU clock and memory (both variable and invariable) in the MCU. The IEC60730 Annex H standard documents the requirements for electronic controls. It contains detailed tests and diagnostic methods to ensure the safe operation of embedded control hardware and software for household appliances. The framework is used to debug the failure in the integration test and regression test. The user is able to detect the failure and rectify accordingly, without stopping the test activity. A. Setup The Class B self-test routines are integrated into the DUT debugging framework. The routines are classified into 2 groups:
Startup routines contain the checking of volatile and non-volatile memories, and the CPU registers, using fix checking pattern. Runtime routines cover the above plus additional logic checking, with the coverage defined by user application. The startup routines will be executed during the application initialization. Runtime routines will be run continuously together with the user application; they cannot be stopped intermittently as this will affect the user application operation. Figure 4 & 5 show the integration of the Class B routines (highlighted as grey box) into the framework.
As shown in Figure 4, the startup routines will be executed during the initialization before the framework proceeds with the user’s operation. The framework scheduler will execute the runtime routines at periodic basis. A watchdog timer is maintained and service periodically to ensure that the user application does not stuck in infinite loop, else a reset will be triggered. The results of these routines will be collected using another timer and they are sent to the PC-host via CAN interface. The subsequent section will detail on how the PC-host displays these results in various meaningful ways. B. Runtime Debugging Figure 6 and Figure 7 show the screen snapshot of the PC-host software. The snapshots show the necessary debug information, configured by user, to be displayed in both real time and non-real time basis. In this case, the non-real time data is referred to the startup routines statuses, and the real time data show the runtime routines return values. To further enhance the readability of the real time data, user can choose to use the on-screen oscilloscope to monitor and investigate the changes of the internal states at predefined period, as shown in Figure 6. Timescale can be adjusted on-the-fly. The on-screen oscilloscope can be used to monitor the changes of the internal variables at one glance. This could be more helpful instead of displaying the continuous changes of the internal variables in numerical form.
Figure 7 shows the required debugging information configured for Class B Software Library testing:
4. Conclusion The above framework is proven on an 8-bit MCU, which consists of Class B Software Library, the debugging framework and a lean application layer to integrate the above. It shows the possibility of using a low cost debugging setup to realize the real-time non-intrusive debugging methodology. The results obtained are satisfactory, and the objectives are met. 5. Terminology
|
Home | Feedback | Register | Site Map |
All material on this site Copyright © 2017 Design And Reuse S.A. All rights reserved. |