Abnormal information dump method of embedded multi-core operating system

By creating a circular buffer for exception information in an embedded multi-core operating system and redefining the printk interface, the problem of obtaining system debugging information in a serial port-less environment is solved, and the orderly storage and multiple acquisition methods of exception information are realized, thereby improving system maintenance efficiency.

CN121901009APending Publication Date: 2026-04-21EAST CHINA INST OF COMPUTING TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
EAST CHINA INST OF COMPUTING TECH
Filing Date
2025-12-23
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In real-world applications where there is no serial port, it is difficult to obtain exception information from the embedded real-time operating system, leading to system maintenance difficulties.

Method used

During the initialization of the exception dump module, an exception information circular buffer is created, and the printk interface is redefined to temporarily store exception information in the circular buffer. The dump method is configured to support storage in memory, network, or non-volatile storage, ensuring data integrity and order.

Benefits of technology

This enables the effective acquisition of system debugging information even in a serial port-less environment, improving the efficiency and reliability of system maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901009A_ABST
    Figure CN121901009A_ABST
Patent Text Reader

Abstract

The invention discloses an abnormal information dump method of an embedded multi-core operating system, which comprises the following steps of: in an initialization process of an abnormal dump module, creating an abnormal information annular buffer area, and configuring an abnormal information dump mode at the same time; on the premise that the system log information with the abnormal information is output to the abnormal information annular buffer area, the printk interface is re-hooked and defined; when a system is abnormal, an abnormal event is converted into an abnormal vector, an abnormal processing function is called, the output content of the abnormal processing function is transmitted through a printk interface, the abnormal information annular buffer area is output to a specified address or file according to a configured abnormal information unloading mode, and one-time abnormal information annular buffer area emptying operation is achieved. The problem that the system debugging information is difficult to obtain under the condition that no serial port exists in an actual application environment is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of embedded real-time operating system technology, specifically relating to a method for dumping abnormal information in an embedded multi-core operating system. It relates to a method for intercepting critical system log information when the domestic embedded real-time operating system ReWorks runs on an SMP multi-core system, and recording and saving it through a network, memory or non-volatile storage device. Background Technology

[0002] During the startup process, the embedded real-time operating system initializes the serial port hardware as early as possible, defining the printk interface as output to the serial port. The initialization interfaces of each module of the system will output debugging information to the serial port through printk, so as to help system software development engineers obtain information and analyze and troubleshoot problems encountered during the startup process.

[0003] The initialization of the Printk interface and exception management module occurs at the following points in the system startup process: Figure 1 As shown, because the printk interface does not require triggering system interrupts, consumes little system resources, and can be used in the system's exception and interrupt handling functions, various modules, drivers, and applications of the operating system rely on this interface to output debugging information. Software engineers can use this to judge the system's running status and analyze and locate the cause of problems during the development process.

[0004] Exception management is a crucial function in embedded real-time operating systems. It is a mechanism for detecting, handling, and recovering from errors, interrupts, and abnormal events during system operation. Through the co-design of hardware and software, it responds promptly to faults, preventing system crashes or data loss. These functions are core to ensuring the high reliability, real-time performance, and stability of the system.

[0005] like Figure 2 As shown, when a system error occurs and an exception event is triggered, the CPU jumps to the exception vector and enters the operating system's exception handling process. The operating system identifies the exception type, outputs key exception information, and calls the corresponding exception handling function. The key exception information output during the exception handling process is crucial for software engineers to analyze and locate problems; by default, it is output to the serial port via the printk interface.

[0006] However, outputting exception information via serial port has significant limitations. First, since the system also contains a large amount of serial port printing information (including both printk and printf methods) in addition to the exception handling module, especially in embedded real-time multi-core operating systems, each processor core may output printing information or enter the exception handling process and output exception information. Therefore, the key information in the exception handling process may become unrecognizable or disordered, losing its reference value and seriously affecting the efficiency of problem solving.

[0007] Furthermore, in real-world system environments, after software debugging is complete, the serial port on the hardware module used for printk output is usually no longer usable. If an error occurs during subsequent software operation, it will be impossible to obtain system debugging information (including error information), making system maintenance difficult. Summary of the Invention

[0008] The technical problem this invention aims to solve is that it is difficult to obtain system debugging information in practical application environments where there is no serial port.

[0009] To address the aforementioned technical problems, the present invention provides a method for dumping exception information in an embedded multi-core operating system, comprising the following steps: During the initialization of the exception dump module, an exception information circular buffer is created, and the exception information dumping method is configured. With the premise that system log information containing exception information is output to the exception information circular buffer, the printk interface is redefined and reattached. When a system exception occurs, the exception event is converted into an exception vector, the exception handling function is called, and the output of the exception handling function is transmitted through the printk interface. According to the configured exception information transfer method, the exception information circular buffer is output to the specified address or file, thus realizing a clearing operation of the exception information circular buffer.

[0010] Preferably, the abnormal information transfer method includes one or more of the following: storing in memory, sending over a network, and writing to non-volatile storage.

[0011] Preferably, mutual exclusion is used to ensure data integrity when the system log information is output to the abnormal information circular buffer.

[0012] Preferably, when the abnormal information circular buffer receives system log information, the order of saving print time information is added to avoid the printk print information from being interspersed and merged.

[0013] Preferably, the printk interface outputs information related to the exception type and the register value when the exception occurred.

[0014] This invention provides a method for dumping exception information in an embedded multi-core operating system. During the initialization of the exception dump module, an exception information circular buffer is created, and the exception information dumping method is configured. With the system log information containing exception information output to the exception information circular buffer as a prerequisite, the printk interface is redefined. When a system exception occurs, the exception event is converted into an exception vector, the exception handling function is called, and the output of the exception handling function is transmitted through the printk interface. Based on the configured exception information dumping method, the exception information circular buffer is output to a specified address or file, thus achieving a single clearing operation of the exception information circular buffer. This solves the problem of difficulty in obtaining system debugging information in practical application environments without a serial port. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of the existing system startup process; Figure 2 This is a schematic diagram of the exception handling process in an existing embedded system. Figure 3 This is a schematic diagram of the abnormal information circular buffer mechanism provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the abnormal information dumping mechanism provided in an embodiment of the present invention. Detailed Implementation

[0016] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.

[0017] Before the addition of the abnormal information temporary ring buffer mechanism designed in this paper, the abnormal handling process starts from the triggering of an abnormal event. The CPU jumps into the abnormal vector defined by the operating system for the hardware, finds the abnormal handling function of the corresponding abnormal event through the abnormal vector, and calls the printk interface in the abnormal handling function to print out information such as the type of the current abnormal event, the CPU register value when the exception occurred, and the stack pointer through the serial port.

[0018] To address the issue of exception information intermingling with other system printouts during exception handling, and to obtain system debugging information in real-world application environments without a serial port, such as... Figure 1 As shown, this embodiment of the invention provides a method for dumping exception information in an embedded multi-core operating system, including the following steps: like Figure 3As shown, during the initialization of the exception dump module, an exception information circular buffer is created, and the printk interface is redefined to output to the exception information circular buffer. From then on, all printk output strings in the system will be temporarily stored in the exception information circular buffer. The integrity of the written data is guaranteed by mutual exclusion means such as atomic variables. The system log information (including exception information) is temporarily stored in the circular buffer. By adding the order of saving information by printing time, the printk printing information will no longer be interleaved and merged, realizing the sequential saving of log information. At the same time, even in the hardware environment without a serial port, the system log information can be saved and retrieved.

[0019] When a system exception occurs, the exception event is converted into an exception vector, the exception handling function is called, the output of the exception handling function is transmitted to the exception dump module, and output via the printk interface. An exception information circular buffer is then cleared, and the information in the circular buffer is output to a specified address or file according to the exception dump module's configuration. When debugging information needs to be read, the system user can also manually call the exception dump module's output interface to obtain the most recent debugging information.

[0020] like Figure 4 As shown, the exception dump module initialization also configures the exception information dumping mode. The dump module can be divided into three modes based on the destination of the debug information dump: write to memory, send over the network, and write to persistent storage. System users can choose which methods to use for output, selecting 1 to 3. When configuring the dumping mode, corresponding dumping parameters must also be specified. When storing in memory, the memory address must be specified; when sending over the network, a network connection identifier must be provided; and when writing to persistent storage, the file path for storing the information must be specified.

[0021] When the exception dump module output interface is called by the exception handling function or by the system user, the information in the exception information ring buffer will be output to the specified address or path according to the configuration of the exception information dump module.

[0022] System users can obtain system debugging information and analyze the system status by viewing memory, network reception, or non-volatile storage media (files in memory).

[0023] The beneficial effects of the embodiments of the present invention are as follows: 1) This paper designs a circular buffer mechanism for abnormal information to temporarily store various log information of the system, so that the output order and source of abnormal information can be recorded, which solves the problem of mutual interleaving and fusion of serial port printing information in embedded real-time operating systems.

[0024] 2) Based on the mechanism described in 1), this paper also designs an anomaly information dumping mechanism. To enable software development engineers to obtain exception information through means other than serial ports, a mechanism is provided that allows them to export system exception information at appropriate times for analysis and troubleshooting of system operation.

[0025] The key points of the embodiments of the present invention are as follows: a) The operating system establishes a circular buffer for exception information and redirects the printk interface from serial port output to output to the circular buffer, thereby intercepting and temporarily storing system log information; b) The operating system defines an exception information dumping mechanism, providing multiple dumping paths such as memory, network, and persistent storage. Users can choose the appropriate method to save and view system log information according to their actual hardware and software environment.

Claims

1. A method for dumping exception information in an embedded multi-core operating system, characterized in that, Includes the following steps: During the initialization of the exception dump module, an exception information circular buffer is created, and the exception information dumping method is configured. With the premise that system log information containing exception information is output to the exception information circular buffer, the printk interface is redefined and reattached. When a system exception occurs, the exception event is converted into an exception vector, the exception handling function is called, and the output of the exception handling function is transmitted through the printk interface. According to the configured exception information transfer method, the exception information circular buffer is output to the specified address or file, thus realizing a clearing operation of the exception information circular buffer.

2. The method for dumping abnormal information in an embedded multi-core operating system as described in claim 1, characterized in that, The abnormal information transfer method includes one or more of the following: storing in memory, sending over a network, and writing to non-volatile storage.

3. The method for dumping abnormal information in an embedded multi-core operating system as described in claim 1, characterized in that, Mutual exclusion is used to ensure data integrity when the system log information is output to the exception information circular buffer.

4. The method for dumping abnormal information in an embedded multi-core operating system as described in claim 1, characterized in that, When the abnormal information ring buffer receives system log information, the order of saving the printing time information is added to avoid the printk printing information from being intertwined and merged.

5. The method for dumping abnormal information in an embedded multi-core operating system as described in claim 1, characterized in that, The printk interface outputs information related to the exception type and the register value at the time of the exception.