Embedded software real-time tracking system adopting special caching mechanism and resolution mechanism

introduction

Embedded systems are hotspots in today's computer software field, and real-time is the basic requirement of embedded systems. With the continuous development of embedded technology, in the case of the continuous growth of embedded applications and the increasing complexity of embedded systems, the debugging phase has become more and more important in the whole system development process. The debugging environment and debugging technology directly affect the efficiency and quality of software development. The efficient debugging system can greatly reduce the development time of embedded systems and reduce the workload of system development.

The tracking debugging system mainly has two methods: JTAG online debugging and runtime tracking debugging. JTAG online debugging has great limitations when debugging real-time systems. For example, after the parameter is queried through the breakpoint, the system can no longer run according to the normal sequence, and the transition state of the system sequential execution cannot be detected. Runtime tracking and debugging adopts software instrumentation technology. By embedding tracking points in the program, developers can observe the output information in real time through the tracking point during the running of the program, such as the information exchanged between modules and the sequence of program running. .

The real-time tracking system designed by this project is based on the runtime tracking and debugging method, and uses the ARM11 series processor as the hardware development platform to run on the Nucleus real-time operating system. The Nucl eus real-time operating system is a preemptive multi-tasking operating system. During the execution of the program, low-priority tasks are preempted by high-priority tasks, and tracking task conflicts may occur, resulting in tracking information being overwritten and out of order. Especially when the amount of tracking information is large, the tracking information is lost once the transmission peak is exceeded. The real-time tracking system adopts a special caching mechanism and an analysis mechanism, which can solve the problem of tracking information loss and realize complete and orderly transmission of tracking information.

1 original tracking scheme

The real-time tracking system consists of a tracking information buffer unit, a transmission control unit, and a PC-side parsing unit, as shown in FIG. The tracking information cache unit is responsible for the assembly of the tracking information and the management of the tracking cache. The transmission control unit is responsible for moving the tracking information from the tracking cache to the PC end, and the PC end parsing unit is responsible for parsing the tracking information.

Design of nested caching mechanism and parsing mechanism for embedded software tracking information

The trace cache management mechanism refers to how to manage the read and write permissions of the trace cache, and how to record changes in the read and write indexes. In a trace scheme with a trace backup cache, the trace cache management mechanism is also responsible for managing the backup cache. In the tracking system, all tracking information is encapsulated into a fixed frame format (message header + message content) at the output of the tracking point, and is written into the same circular queue of length X bytes in the tracking information buffer unit.

Since the tracking source in the real-time tracking system of the Nucleus multitasking operating system is mainly divided into low-level interrupts, advanced interrupts/timers and tasks, in the process of tracking the tracking points in the tracking source, tracking points of different priorities may be A competition for global trace information caching occurs. The tracking conflict scenario is shown in Figure 2. Only one write pointer access tracking information cache is set in the tracking information cache unit to ensure the ordering of the tracking information. However, conflicts occur when different priority tracking sources are switched, and the write pointer needs to be protected on site.

Design of nested caching mechanism and parsing mechanism for embedded software tracking information


Because blocking high-priority tasks can cause system process exceptions, in the event of a conflict, in order to ensure the integrity of the tracking information, and can not block high-priority tasks, only the tracking requests in the high-priority tasks can be discarded. When the operating system tasks are frequently switched, more trace information is discarded. The tracking information discarding phenomenon is characterized in that the tracking information is lost and continuously lost (actively preempting all the tracking in the task), and the tracking information discarding is independent of the tracking information transmission loss. Therefore, the caching mechanism in the tracking system needs to be optimized.

2 tracking optimization program one

2.1 Physical Cache Management Mechanism

The physical cache management mechanism adopts a tracking information frame format including a tracking header, a tracking information content, and a tracking tail. In the process of tracking the source data being interrupted each other, the integrity of the tracking information is not considered, and the tracking information is tracked according to the interrupted priority order. Write to the trace cache. The tracking information is written into the scenario as shown in Figure 3. Task 1 trace information is written to the trace information cache and interrupted by the advanced interrupt/timer. The advanced interrupt/timer writes its trace header to the current write pointer until the entire trace information is written. Task 1 obtains execution rights, and its unwritten trace information is immediately written to the end of the advanced interrupt/timer trace information until the entire trace information is written.

Design of nested caching mechanism and parsing mechanism for embedded software tracking information

2.2 Transmission Control Mechanism

The real-time tracking system communicates between the PC and the ARM subsystem through the serial port. The transmission control unit describes the communication flow between the PC and the ARM subsystem. It uses the DMA bus controller to track information. DMA is a data exchange mode that accesses data directly from memory without going through the ARM processor's CPU. In the DMA mode, the CPU only needs to issue an instruction to the DMA bus controller to process the data transmission and receive the feedback information of the data transmission completion, thereby greatly reducing the CPU resource occupancy rate. The transmission control unit adopts the DMA synchronization interrupt to send the tracking information, and transmits the tracking information to the serial port transmission register each time in the same length byte transmission, and then sends the tracking information to the PC end to analyze the display unit by configuring the serial port transmission register.

Wall Switch And Socket

Wall Switch And Socket,Wireless Wall Switch,Decora Light Switch,Push Button Light Switch

ZHEJIANG HUAYAN ELECTRIC CO.,LTD , https://www.huayanelectric.com