A multi-task system CPU diagnosis method and device

By disabling interrupts in a multitasking operating system and using separate processes and clock interrupt service routines for CPU diagnostics, the efficiency and accuracy issues of CPU diagnostics in multitasking systems are resolved, meeting the high safety and reliability requirements of nuclear power safety-grade DCS.

CN115599535BActive Publication Date: 2026-02-06CHINA TECHENERGY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110778514.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-09
Publication Date
2026-02-06
Estimated Expiration
2041-07-09

AI Technical Summary

Technical Problem

Under a multitasking operating system, existing technologies cannot effectively perform CPU diagnostics and cannot meet the high safety and high reliability requirements of nuclear power safety-grade DCS.

Method used

In a multi-tasking real-time operating system, CPU diagnosis is performed by disabling all system interrupts and using separate process and clock interrupt service routines. After generating diagnostic results, interrupts are restored, and a preset mode word is used for diagnosis, thereby improving diagnostic accuracy.

Benefits of technology

It enables efficient CPU diagnostics in multi-tasking systems, avoids interruption and diagnostic process concurrency issues, and meets the safety and reliability requirements of nuclear power safety-grade DCS.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115599535B_ABST
    Figure CN115599535B_ABST
Patent Text Reader

Abstract

The application provides a multi-task system CPU diagnosis method and device, wherein when a CPU diagnosis instruction is acquired, all interrupts of the system are closed; a diagnosis event is determined based on the CPU diagnosis instruction and diagnosis is performed; when diagnosis is completed, a diagnosis result is generated and the closed interrupts are opened, so that the CPU diagnosis can be efficiently performed in the system running process. The application utilizes a clock interrupt service program to realize the CPU diagnosis in a single process mode under a multi-task real-time operating system, avoids the problem that interrupts and diagnosis processes interrupt the CPU diagnosis concurrently, and realizes the CPU diagnosis of the multi-task operating system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data security, and particularly relates to a multi-task system CPU diagnosis method and device for meeting a nuclear safety level application under a multi-task real-time operating system. BACKGROUND

[0002] In the existing software safety specification, according to the software requirement of the IEC60880 standard A class safety function, self-monitoring of the hardware needs to be met. Diagnosing the CPU when the system is in a running state is one of the effective ways to improve the reliability of the system. The CPU should be diagnosed periodically to shorten the fault diagnosis time. When a fault is found, the diagnosis information can be timely reported. For example, in the field of nuclear power safety level DCS which has high requirements on safety and reliability, a targeted design must be used to achieve the goal of high safety and high reliability.

[0003] At present, embedded products are divided into two categories: single-task operating system and multi-task operating system. The CPU diagnosis under the single-task operating system is relatively mature, and all functions are executed in a fixed cycle sequence. The CPU diagnosis under the multi-task operating system is generally not performed, and at most only part of the CPU diagnosis in the startup phase is performed. It cannot meet the high safety requirements. SUMMARY

[0004] Therefore, the embodiments of the present application provide a multi-task system CPU diagnosis method and device to realize the CPU diagnosis of the multi-task system.

[0005] To achieve the above object, the embodiments of the present application provide the following technical solutions.

[0006] A multi-task system CPU diagnosis method comprises the following steps:

[0007] When the CPU diagnosis instruction is acquired, all interrupts of the system are closed.

[0008] Based on the CPU diagnosis instruction, a diagnosis event is determined and diagnosis is performed.

[0009] When the diagnosis is completed, a diagnosis result is generated and the closed interrupts are started.

[0010] Optionally, in the multi-task system CPU diagnosis method, when the CPU diagnosis instruction is acquired, all interrupts of the system are closed, which comprises the following steps:

[0011] It is judged whether a CPU diagnosis process is started, and when the CPU diagnosis process is started, the CPU diagnosis process is initialized, a communication pipe is created and a connection is established, a CPU diagnosis thread is created when the CPU diagnosis instruction is acquired, and all interrupts of the system are closed.

[0012] Optionally, in the multi-task system CPU diagnosis method, the determining diagnosis events and performing diagnosis based on the CPU diagnosis instruction comprises:

[0013] determining whether a system CPU diagnosis flag is activated, and executing the diagnosis events in the CPU diagnosis instruction when the CPU diagnosis flag is activated.

[0014] Optionally, in the multi-task system CPU diagnosis method, the executing the diagnosis events in the CPU diagnosis instruction comprises:

[0015] acquiring diagnosis data matched with the diagnosis events, and performing diagnosis on diagnosis objects corresponding to the diagnosis events by using the diagnosis data.

[0016] Optionally, in the multi-task system CPU diagnosis method, when performing diagnosis, a preset mode word is used for diagnosis.

[0017] The preset mode word is of the type: 0x55555555, 0xAAAAAAAA, 0xFFFFFFFF, 0x33333333, 0x99999999, 0x66666666, 0x0F0F0F0F, or 0xF0F0F0F0.

[0018] A multi-task system CPU diagnosis device comprises:

[0019] an instruction acquisition unit configured to close all interrupts of a system when a CPU diagnosis instruction is acquired;

[0020] a diagnosis unit configured to determine diagnosis events and perform diagnosis based on the CPU diagnosis instruction;

[0021] a recovery unit configured to generate a diagnosis result and start the closed interrupts when diagnosis is completed.

[0022] Optionally, in the multi-task system CPU diagnosis device, the instruction acquisition unit is specifically configured to:

[0023] determine whether a CPU diagnosis process is started, initialize the CPU diagnosis process when the CPU diagnosis process is started, create a communication pipe and establish a connection, create a CPU diagnosis thread when the CPU diagnosis instruction is acquired, and close all interrupts of the system.

[0024] Optionally, in the multi-task system CPU diagnosis device, the diagnosis unit is specifically configured to:

[0025] determine whether a system CPU diagnosis flag is activated, and execute the diagnosis events in the CPU diagnosis instruction when the CPU diagnosis flag is activated.

[0026] Optionally, in the multi-task system CPU diagnosis device, the diagnosis unit, when executing the diagnosis event in the CPU diagnosis instruction, is specifically configured to:

[0027] Obtain diagnosis data matched with the diagnosis event, and diagnose the diagnosis object corresponding to the diagnosis event by using the diagnosis data.

[0028] Optionally, in the multi-task system CPU diagnosis device, the diagnosis unit, when diagnosing, uses a preset mode word for diagnosis.

[0029] The preset mode word is of the type 0x55555555, 0xAAAAAAAA, 0xFFFFFFFF, 0x33333333, 0x99999999, 0x66666666, 0x0F0F0F0F, or 0xF0F0F0F0.

[0030] Based on the technical solution, when the CPU diagnosis instruction is obtained, all interrupts of the system are closed; the diagnosis event is determined based on the CPU diagnosis instruction and diagnosis is performed; when the diagnosis is completed, the diagnosis result is generated and the closed interrupts are opened, so that the CPU diagnosis can be efficiently performed in the system running process. The present solution uses a separate process to implement the CPU diagnosis by using the clock interrupt service program under the multi-task real-time operating system, avoids the problem that the interrupts and diagnosis processes interrupt the CPU diagnosis at the same time, and realizes the CPU diagnosis of the multi-task operating system. BRIEF DESCRIPTION OF DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of the provided drawings.

[0032] Figure 1 The flowchart of the multi-task system CPU diagnosis method disclosed in the embodiments of the present application;

[0033] Figure 2 The structural diagram of the multi-task system CPU diagnosis device disclosed in the embodiments of the present application. DETAILED DESCRIPTION

[0034] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments of the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort are within the protection scope of the present application.

[0035] The present application provides a multi-task system CPU diagnosis method to realize CPU diagnosis of a multi-task system.

[0036] Step S101: When the CPU diagnosis instruction is acquired, all interrupts of the system are closed.

[0037] CPU, Central Processing Unit, i.e. central processor. The CPU is the operation and control core of a computer system, and is the final execution unit of information processing and program running.

[0038] In this step, the system monitors whether the CPU diagnosis instruction is acquired in real time. When the CPU diagnosis instruction is detected, it indicates that the system needs to perform CPU diagnosis. In order to prevent interrupting the diagnosis object during the diagnosis process and thus breaking the diagnosis process, in the present solution, all interrupts of the system are closed in advance. Only after the interrupts are closed, the diagnosis process will not be disturbed. Therefore, in the present solution, when the CPU diagnosis instruction is acquired, all interrupts of the system need to be closed.

[0039] In this step, the acquisition of the CPU diagnosis instruction can mean that the CPU diagnosis process in the system is detected to be started.

[0040] Step S102: Determine the diagnosis event based on the CPU diagnosis instruction and perform diagnosis.

[0041] In this step, after detecting that all interrupts of the system are closed, the system is diagnosed based on the CPU diagnosis instruction. During the diagnosis process, the diagnosis event is determined according to the index in the CPU diagnosis instruction. After the diagnosis event is determined, the CPU diagnosis (registers, execution instructions, etc.) is performed, and the diagnosis result is generated and returned.

[0042] Step S103: When the diagnosis is completed, the diagnosis result is generated and the closed interrupts are opened.

[0043] In this step, the diagnosis progress of the CPU diagnosis is monitored in real time. When the CPU diagnosis is completed, the closed interrupts of the system are restored, so that the system can normally run according to the rules.

[0044] It can be seen that the application provides a CPU diagnosis technology in a multitask real-time operating system environment, which can efficiently diagnose the CPU during system operation. The scheme uses a separate process to realize CPU diagnosis using a clock interrupt service program in a multitask real-time operating system, avoiding the problem of concurrent interruption of CPU diagnosis by interrupts and diagnosis processes.

[0045] In another embodiment of the technical scheme disclosed in the application, different sets of diagnosis data can be preconfigured for different diagnosis objects, and these diagnosis data can be changed based on existing rules. By using multiple sets of changeable diagnosis data to diagnose the diagnosis object, the diagnosis accuracy is improved. Therefore, in the above-mentioned scheme, the task system CPU diagnosis method is characterized in that the diagnosis event in the CPU diagnosis instruction is executed, including:

[0046] Obtaining diagnosis data matched with the diagnosis event, and using the diagnosis data to diagnose the diagnosis object corresponding to the diagnosis event.

[0047] In another embodiment of the technical scheme disclosed in the application, in the multitask operating system, the CPU diagnosis function uses a separate process. When the Quality of Service (QOS) safety mechanism is started, the system automatically runs the CPU diagnosis process. The priority of this process is set to the highest, and the current instance is set to 255.

[0048] A management thread and a clock interrupt service program are started in the CPU diagnosis process, wherein:

[0049] The main thread is used to initialize the CPU diagnosis, start the management thread, and communicate with the user application using messages.

[0050] The management thread is used to configure I / O access permissions, thread priority, data structure initialization, read IRQ clock, initialize signal event, start clock interrupt service program, manage CPU diagnosis, and output the detection result through the interface.

[0051] The interrupt service program is triggered once every 1ms or other time interval. The interval at which the CPU diagnosis is performed once can be determined according to the actual application. In this paper, the interval at which the CPU diagnosis is performed once is 100ms. The interrupt processing program uses assembly language to perform CPU register, multiple instruction detection and mode detection.

[0052] Therefore, in the above-mentioned scheme, when the CPU diagnosis instruction is obtained, all interrupts of the system are closed, which can include:

[0053] The application judges whether a CPU diagnosis process is started, and when the CPU diagnosis process is started, it indicates that CPU diagnosis is about to be performed. Before the CPU positive terminal is formally executed, the CPU diagnosis process is initialized, a communication pipe is created and a connection is established, and a precise timer is created. An interface message is waited for to start a diagnosis instruction. If the start diagnosis instruction arrives, it is judged whether a CPU diagnosis flag is activated. When the CPU diagnosis flag is activated, a CPU diagnosis thread is created, a diagnosis event in the CPU diagnosis instruction is executed, a clock interrupt service program is started, and all interrupts of the system are closed.

[0054] In another embodiment of the application, the diagnosis event refers to giving a plurality of different groups of input data in succession and executing corresponding diagnosed instructions in the CPU diagnosis process. According to the instruction execution result, it is judged whether the diagnosis is successful. For example, four addition ADC instructions with carry are set for diagnosis, four groups of different input data are given in advance, the processing process is executed four times, and the execution result of the processing process is checked to see whether it meets the expectation. This method can improve the accuracy of instruction diagnosis. For another example, if the diagnosis event is to diagnose the core register, a plurality of preset initial values are given, read-write operations are performed according to the initial values, and it is judged whether the diagnosis is correct. If the diagnosis event is to diagnose addition, subtraction, multiplication, division, AND, OR, NOT, loop shift, random number, stack out and stack in, a plurality of preset initial values are also given, and the initial values are compared with the values after the instruction operation to judge whether the instruction execution is correct. That is, in this solution, the diagnosed instructions in the CPU diagnosis process can include ADC, memory read-write, stack out and stack in, AND, OR, NOT, loop shift and the like.

[0055] In another embodiment of the application, a group of fixed pattern words and random numbers can be defined to diagnose the CPU register to improve the execution efficiency. In the CPU diagnosis process, the pattern word has a representative meaning, the detection of the register needs to cover all bits, and a pattern word capable of covering all bits is given. Therefore, a group of typical data is found for CPU diagnosis, which can improve the CPU diagnosis efficiency on the basis of not needing to list all data. Through the group of typical pattern words, the fixed fault, state transition fault, flip coupling fault and power coupling fault of the register can be detected.

[0056] In this solution, the fixed pattern word can be 0x55555555, 0xAAAAAAAA, 0xFFFFFFFF, 0x33333333, 0x99999999, 0x66666666, 0x0F0F0F0F, 0xF0F0F0F0. When the addition instruction or the memory read-write operation is executed in the diagnosis process, all the pattern words are executed in sequence, and the checking of the instruction or the memory operation can be realized.

[0057] In conclusion, the application discloses a periodic CPU diagnosis scheme under a multitask real-time operating system. A high-priority process is used, a clock interrupt service program is created in the high-priority process, CPU core registers are read and written for checking and instructions are checked for checking (CPU diagnosis), when there is an interrupt in the system, all interrupts in the system are closed first, after the CPU diagnosis is completed, all interrupts in the system are started again. The diagnosis result is sent to other application programs in the form of a message through a message mechanism, and the system can be controlled to enter a fault state once a diagnosis fault occurs in the CPU diagnosis process, otherwise the system continues to run.

[0058] Corresponding to the above diagnosis method, the application discloses a multitask system CPU diagnosis device. The specific working content of each unit in the device is described in the above method embodiment. The multitask system CPU diagnosis device provided in the embodiment of the application is described below. The multitask system CPU diagnosis device described below can be correspondingly referred to the multitask system CPU diagnosis method described above. Referring to Figure 2 The device can include:

[0059] The instruction acquisition unit 100 is configured to close all interrupts in the system when the CPU diagnosis instruction is acquired.

[0060] The diagnosis unit 200 is configured to determine a diagnosis event based on the CPU diagnosis instruction and perform diagnosis.

[0061] The recovery unit 300 is configured to generate a diagnosis result and start the closed interrupts when the diagnosis is completed.

[0062] Corresponding to the above method, the instruction acquisition unit in the multitask system CPU diagnosis device is specifically configured to:

[0063] Determine whether a CPU diagnosis process is started, initialize the CPU diagnosis process when the CPU diagnosis process is started, create a communication pipe and establish a connection, create a CPU diagnosis thread when the CPU diagnosis instruction is acquired, and close all interrupts in the system.

[0064] Corresponding to the above method, the determination of a diagnosis event based on the CPU diagnosis instruction and the diagnosis in the multitask system CPU diagnosis device include:

[0065] Determine whether a system CPU diagnosis flag is activated, and execute a diagnosis event in the CPU diagnosis instruction when the CPU diagnosis flag is activated.

[0066] 4. The multitask system CPU diagnosis method according to claim 1, wherein the execution of the diagnosis event in the CPU diagnosis instruction includes:

[0067] acquire diagnostic data matched with the diagnostic event, and diagnose the diagnostic object corresponding to the diagnostic event by using the diagnostic data.

[0068] 5. The multi-task system CPU diagnosis method of claim 1, wherein determining a diagnostic event based on the CPU diagnosis instruction and performing diagnosis comprises:

[0069] determining a diagnostic event based on the CPU diagnosis instruction and performing diagnosis by using a preset mode word;

[0070] the preset mode word is of the type: 0x55555555, 0xAAAAAAAA, 0xFFFFFFFF, 0x33333333, 0x99999999, 0x66666666, 0x0F0F0F0F, 0xF0F0F0F0.

[0071] For the convenience of description, the above system is described in various modules based on functions. Of course, the functions of the modules can be implemented in one or more software and / or hardware when the present application is implemented.

[0072] Each embodiment in the specification is described in a progressive manner, and the same and similar parts of each embodiment can be referred to each other. Each embodiment mainly describes the difference from other embodiments. Especially, the system or system embodiment is basically similar to the method embodiment, so the description is relatively simple, and the related parts can be referred to the part of the method embodiment. The above-described system and system embodiment are only illustrative, and the units described as separate components can be or can not be physically separated, and the components displayed as units can be or can not be physical units, that is, they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment according to the actual needs. Those skilled in the art can understand and implement without creative labor.

[0073] The skilled person can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in the present text can be realized by electronic hardware, computer software or combination of the two. In order to clearly show the interchangeability of hardware and software, the components and steps of each example have been described in general in the above description. Whether the functions are realized by hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0074] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in RAM, flash memory, ROM, electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such that the processor can read information from, and

[0075] It is also important to note that the use of relational terms, such as first and second, and the like, are used solely to distinguish one from another entity or action without necessarily implying any actual relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0076] The above description of disclosed embodiments provides examples, and is not intended to be limiting. Many modifications and variations of the disclosed embodiments are possible, and would be apparent to those of ordinary skill in the art once the generic principles of the embodiments have been considered. Accordingly, the disclosure is to be considered as broadly as the foregoing summary allows. The application described and claimed herein is to be understood to encompass all modifications within the scope and spirit of the application as defined by the appended claims and equivalents thereof.

Claims

1. A CPU diagnostic method for a multitasking system, characterized in that, include: Create an independent CPU diagnostic process in the multitasking system and set the priority of the diagnostic process to the highest. Determine whether the CPU diagnostic process has started. When the CPU diagnostic process is started, initialize the CPU diagnostic process, create a communication pipe and establish a connection. In the CPU diagnostic process, start the management thread and the clock interrupt service routine. The main thread is responsible for initializing CPU diagnostics, starting the management thread, and communicating with the user application using messages. The management thread is responsible for configuring I / O access permissions, thread priorities, data structure initialization, reading the IRQ clock, initializing signal events, and starting the clock interrupt service routine. Wait for the interface message to enable CPU diagnostics. If the enable CPU diagnostics instruction arrives, determine whether the system CPU diagnostic flag is activated. When the CPU diagnostic flag is activated, create a CPU diagnostic thread and perform diagnostics under the periodic triggering of the clock interrupt service routine. During the diagnostic execution, disable all system interrupts. The diagnostic event is determined and a diagnosis is performed based on the CPU diagnostic instructions; When the diagnosis is complete, the diagnosis results are generated and the disabled interrupts are restored.

2. The CPU diagnostic method for a multitasking system according to claim 1, characterized in that, The process of determining diagnostic events and performing diagnoses based on the CPU diagnostic instructions includes: Based on the CPU diagnostic instructions, a diagnostic event is determined, diagnostic data matching the diagnostic event is obtained, and the diagnostic data is used to diagnose the diagnostic object corresponding to the diagnostic event.

3. The CPU diagnostic method for a multitasking system according to claim 1, characterized in that, During diagnosis, a preset pattern word pair is used for diagnosis; The preset mode word type is: 0x55555555,0xAAAAAAAA,0xFFFFFFFF,0x33333333,0x99999999,0x66666666,0x0F0F0F0F,0xF0F0F0F0.

4. A CPU diagnostic device for a multitasking system, characterized in that, include: The instruction acquisition unit is used to create an independent CPU diagnostic process in the multitasking system and set the priority of the diagnostic process to the highest. Determine whether the CPU diagnostic process has started. When the CPU diagnostic process is started, initialize the CPU diagnostic process, create a communication pipe and establish a connection. In the CPU diagnostic process, start the management thread and the clock interrupt service routine. The main thread is responsible for initializing CPU diagnostics, starting the management thread, and communicating with the user application using messages. The management thread is responsible for configuring I / O access permissions, thread priorities, data structure initialization, reading the IRQ clock, initializing signal events, and starting the clock interrupt service routine. The diagnostic unit is used to wait for the interface message to enable the CPU diagnostic instruction. If the enable CPU diagnostic instruction arrives, it determines whether the system CPU diagnostic flag is activated. When the CPU diagnostic flag is activated, a CPU diagnostic thread is created and the diagnosis is performed under the periodic triggering of the clock interrupt service routine. During the diagnostic execution, all system interrupts are turned off. The diagnostic event is determined based on the CPU diagnostic instruction and the diagnosis is performed. The recovery unit is used to generate diagnostic results and restore disabled interrupts when the diagnosis is completed.

5. The multi-tasking system CPU diagnostic device according to claim 4, characterized in that, When the diagnostic unit determines a diagnostic event and performs a diagnosis based on the CPU diagnostic instructions, it is specifically used for: Based on the CPU diagnostic instructions, a diagnostic event is determined, diagnostic data matching the diagnostic event is obtained, and the diagnostic data is used to diagnose the diagnostic object corresponding to the diagnostic event.

6. The multi-tasking system CPU diagnostic device according to claim 4, characterized in that, When performing a diagnosis, the diagnostic unit uses preset pattern word pairs for diagnosis; The preset mode word type is: 0x55555555,0xAAAAAAAA,0xFFFFFFFF,0x33333333,0x99999999,0x66666666,0x0F0F0F0F,0xF0F0F0F0.

Citation Information

Patent Citations

  • Semiconductor apparatus and diagnostic test method

    CN106201793A