Method for processing software exception based on annular monitoring
By ring-monitoring the MainProgram, T0InterruptServiceProgram and T1InterruptServiceProgram of embedded software, the variable value changes are detected to ensure system stability, solving the problem of difficulty in troubleshooting of embedded software in harsh environments, and significantly improving the stability and security of the system.
Patent Information
- Application Number
- CN202410997609.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-12-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Embedded software may experience failures such as dead loops or program runs off in harsh environments. The existing technology fails to diagnose and resolve real faults in a timely manner through reset processing, affecting system stability and security.
The ring monitoring method is adopted to detect the change in variable values between MainProgram, T0InterruptServiceProgram and T1InterruptServiceProgram, so as to ensure that the three work normally at the same time before they can continue to run. Otherwise, error operations are performed to diagnose and resolve the fault.
It realizes timely diagnosis and resolution of program failures, improving the stability and security of system operation.
Smart Images

Figure CN119166451A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of embedded software development, and in particular relates to a method for processing software anomalies based on ring monitoring. Background Art
[0002] Embedded software development refers to the design and development of efficient, stable and reliable software for devices in the fields of smartphones, home appliances, automobiles, medical equipment and industrial control systems, so that these devices can realize various functions and connect with the outside world.
[0003] When the developed embedded software is running on the device, it may encounter interference from harsh environments such as electromagnetic fields and become out of control, causing the program to enter an infinite loop, run away, and other unexpected failures. The normal operation of the program is interrupted, and the device cannot continue to run and falls into a stagnant state. If not handled in time, unpredictable consequences may occur in serious cases.
[0004] At present, the method for dealing with the above situation is generally to press the reset button to force the system to reset. Although this method can handle it in time, it may hide the real fault of the program and make it unable to be diagnosed and solved in time. Over time, it is easy to expand the fault and affect the stability and security of the system during operation.
[0005] In view of this, a method for handling software anomalies based on ring monitoring is designed to solve the above problems. Summary of the invention
[0006] To solve the problems raised in the above background technology, the present invention provides a method for processing software anomalies based on ring monitoring, which has the characteristics of being able to timely diagnose and solve real program failures and greatly improve the stability and security of the system during operation.
[0007] To achieve the above object, the present invention provides the following technical solution: a method for processing software anomalies based on ring monitoring, comprising the following steps:
[0008] S1: When MainProgram works normally, detect whether T0InterruptServiceProgram works normally. If T0InterruptServiceProgram works normally, continue to detect, otherwise perform error operations;
[0009] S2: If T0InterruptServiceProgram works normally, check whether T1InterruptServiceProgram works normally. If T1InterruptServiceProgram works normally, continue to check, otherwise perform error operation;
[0010] S3: If T1InterruptServiceProgram works normally, check whether MainProgram works normally. If MainProgram works normally, repeat steps S1-S3, otherwise perform error operations.
[0011] Furthermore, in step S1, the specific steps of detecting whether T0InterruptServiceProgram works normally are:
[0012] S11: Set a variable T0Var in T0InterruptServiceProgram;
[0013] S12: Each time the MainProgram loops, the value of T0Var increases by one;
[0014] S13: Detect whether T0InterruptServiceProgram works normally based on the T0Var value.
[0015] Furthermore, in step S2, the specific steps of detecting whether T1InterruptServiceProgram works normally are:
[0016] S21: Set a variable T1Var in T1InterruptServiceProgram;
[0017] S22: Each time the MainProgram loops, the value of T1Var increases by one;
[0018] S23: Detect whether T1InterruptServiceProgram works normally based on the T1Var value.
[0019] Furthermore, in step S3, the specific steps of detecting whether the MainProgram works normally are:
[0020] S31: Set a variable mainVar in MainProgram;
[0021] S32: Each time the MainProgram loops, the mainVar value increases by one;
[0022] S33: Detect whether MainProgram works normally based on the mainVar value.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] The present invention detects software anomalies by three mutually monitoring software segments. During the detection process, as long as one of them works normally, the anomaly can be detected and corresponding processing can be made. Failure requires the simultaneous failure of the three monitoring points. Compared with the prior art, the real program faults can be diagnosed and resolved in a timely manner, greatly improving the stability and security of the system during operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a flow chart of the method for processing software anomalies based on ring monitoring of the present invention;
[0026] Figure 2 This is a composition diagram of the embedded software development management system of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] Example
[0029] A method for processing software anomalies based on ring monitoring comprises the following steps:
[0030] S1: Set a variable mainVar in MainProgram, set a variable T0Var in T0InterruptServiceProgram, and set a variable T1Var in T1InterruptServiceProgram;
[0031] S2: Each time the MainProgram loops, the mainVar value increases by one, and the change of T0Var is detected to determine whether T0InterruptServiceProgram works normally. If T0InterruptServiceProgram works normally, the detection continues, otherwise the error operation is performed;
[0032] S3: Each time the MainProgram loops, the value of T0Var increases by one, and the change of T1Var is detected to determine whether T1InterruptServiceProgram works normally. If T1InterruptServiceProgram works normally, the detection continues, otherwise the error operation is performed;
[0033] S4: Each time the MainProgram loops, the value of T1Var is increased by one, and the change of mainVar is detected at the same time to determine whether the MainProgram works normally. If the MainProgram works normally, the detection continues, otherwise an error operation is performed.
[0034] Application Examples
[0035] Assume that the interval of MainProgram executing variable increment is 10ms, the interval of entering T0InterruptServiceProgram is 1ms, and the interval of entering T1InterruptServiceProgram is 2ms. When the variable with the longest execution cycle accumulates to 2, after judging that the program is normal, the three variables mainVar, T0Var and T1Var are cleared at the same time.
[0036] MainProgram accumulates every 10ms. Every time mainVar of MainProgram is increased by 1, the count value T0Var of T0InterruptServiceProgram is detected to see if it is 10. If the count value T0Var is greater than 15 or less than 5, the program is considered abnormal. After the judgment, if the accumulated count value reaches 2, mainVar, T0Var and T1var are all cleared.
[0037] In T0InterruptServiceProgram, it is detected whether T0Var is twice the count value T1Var of T1InterruptServiceProgram. If it is detected that T0Var is less than T1Var or T0Var is greater than 4 times T1Var, it is judged as abnormal;
[0038] In T1InterruptServiceProgram, it is detected whether T1Var is 5 times the count value mainVar of MainProgram. If it is detected that the value of T1Var is less than 3 times mainVar or T1Var is greater than 8 times mainVar, it is judged as abnormal;
[0039] If the above judgment is abnormal, the process can be transferred to the error handling program for troubleshooting.
[0040] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for processing software anomalies based on ring monitoring, characterized in that: The following steps are involved: S1: When MainProgram works normally, detect whether T0InterruptServiceProgram works normally. If T0InterruptServiceProgram works normally, continue to detect, otherwise perform error operations; S2: If T0InterruptServiceProgram works normally, check whether T1InterruptServiceProgram works normally. If T1InterruptServiceProgram works normally, continue to check, otherwise perform error operation; S3: If T1InterruptServiceProgram works normally, check whether MainProgram works normally. If MainProgram works normally, repeat steps S1-S3, otherwise perform error operations.
2. The method for processing software anomalies based on ring monitoring according to claim 1, characterized in that: In step S1, the specific steps of detecting whether T0InterruptServiceProgram works normally are: S11: Set a variable T0Var in T0InterruptServiceProgram; S12: Each time the MainProgram loops, the value of T0Var increases by one; S13: Detect whether T0InterruptServiceProgram works normally based on the T0Var value.
3. The method for processing software anomalies based on ring monitoring according to claim 1, characterized in that: In step S2, the specific steps of detecting whether T1InterruptServiceProgram works normally are: S21: Set a variable T1Var in T1InterruptServiceProgram; S22: Each time the MainProgram loops, the value of T1Var increases by one; S23: Detect whether T1InterruptServiceProgram works normally based on the T1Var value.
4. The method for processing software anomalies based on ring monitoring according to claim 1, characterized in that: In step S3, the specific steps of detecting whether MainProgram works normally are: S31: Set a variable mainVar in MainProgram; S32: Each time the MainProgram loops, the mainVar value increases by one; S33: Detect whether MainProgram works normally based on the mainVar value.
