Executing mechanism program verification method and device, electronic equipment and storage medium
By cyclic redundancy verification calculation and comparison of the execution program of the executor, the problem of inability to effectively judge the correctness and reliability of the execution program in the prior art is solved, and high accuracy and reliability verification of the execution program is achieved.
Patent Information
- Application Number
- CN202411494100.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art cannot effectively judge the correctness and reliability of the execution program, especially in the program operation stage, the correctness and reliability of the execution program cannot be guaranteed, and the modification of the integrity verification mark is inconvenient.
By obtaining the execution program of the executor, placing it in a storage area for verification calculation, obtaining the calculated verification value, and obtaining the first and second preset verification values through cyclic redundancy verification, and determining the verification result by comparing the results, improving the accuracy and reliability of the verification.
It realizes effective verification of the correctness and reliability of the executor, ensures the integrity and correctness of the executor in the run phase, and simplifies the modification of the integrity verification mark.
Smart Images

Figure CN119511820A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of program verification technology, and in particular to an actuator program verification method, device, electronic equipment and storage medium. Background Art
[0002] An actuator is a driving device that can provide linear or rotational motion. It uses some kind of driving energy (such as liquid, gas, electricity, etc.) and works under the control of a controller. A control chip is provided in the controller. When the control chip is started or in the process of operation, if the execution program in the storage area of the control chip is lost, fails or erroneous, the execution program in the control chip cannot be executed correctly. Therefore, a program verification method is needed to verify the execution program to ensure the correctness and reliability of the execution program.
[0003] In the related art, the method for verifying program data is to divide the program storage area of the control chip into storage area A and storage area B, where storage area A stores the main execution program and storage area B stores the backup execution program. In the startup phase, the integrity of the execution program is diagnosed by setting an integrity check flag. After analysis, the above verification method has the following disadvantages: (1) It can only judge the integrity of the execution program, but cannot judge the correctness of the program, and cannot guarantee the correctness and reliability of the execution program; (2) The execution program can only be verified in the startup phase of the execution program, and cannot guarantee the correctness and reliability of the execution program in the running phase of the execution program. If the execution program is lost, fails or erroneous during the running phase, the execution program cannot continue to run, affecting the normal use of the execution program; (3) When verifying the execution program, the integrity check flag written into the storage area of the control chip is called, but writing the integrity check flag into the storage area of the control chip is not convenient for modifying the integrity check flag. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, the present application provides an actuator program verification method, device, electronic device and storage medium to solve the above-mentioned technical problems.
[0005] The present invention provides an actuator program verification method, the method comprising: obtaining an execution program of the actuator; placing the execution program in a storage area to obtain a stored program, and performing verification calculation on the stored program to obtain a calculated verification value of the stored program; the verification calculation includes a cyclic redundancy check calculation; performing the verification calculation on the calculated verification value to obtain a comparison verification value of the calculated verification value; determining the verification result of the stored program based on a comparison result between the calculated verification value and a first preset verification value, and a comparison result between the comparison verification value and a second preset verification value; the first preset verification value is obtained by performing the verification calculation on the execution program; the second preset verification value is obtained by performing the verification calculation on the first preset verification value.
[0006] In one embodiment of the present invention, the process of determining the verification result of the stored program according to the comparison result of the calculated verification value and the first preset verification value, and the comparison verification value and the second preset verification value includes: if the calculated verification value is consistent with the first preset verification value, and the comparison verification value is consistent with the second preset verification value, then the verification result is determined to be correct verification; if the calculated verification value is inconsistent with the first preset verification value, and / or the comparison verification value is inconsistent with the second preset verification value, then the verification result is determined to be incorrect verification.
[0007] In one embodiment of the present invention, if the stored program includes stored programs located in different storage areas, then after determining the verification results of the stored programs, the method further includes: determining optional stored programs and unselectable stored programs according to the verification results of the stored programs located in different storage areas; the optional stored programs only include stored programs whose verification results are correct; the unselectable stored programs only include stored programs whose verification results are incorrect; if the number of the optional stored programs is less than a preset number threshold, the stored program is determined to be an error and an alarm is issued; if the number of the optional stored programs is greater than or equal to the preset number threshold, a target program is determined according to the priority of the optional stored programs; the target program is started and run; and the unselectable stored program is modified according to the target program so that the modified unselectable stored program is consistent with the target program.
[0008] In one embodiment of the present invention, the process of determining the target program according to the priority of the optional storage program includes: if the optional storage program only includes a first storage program and a second storage program, and the priority of the first storage program is the same as the priority of the second storage program, then the first storage program or the second storage program is used as the target program; the first storage program is stored in a first storage area; the second storage program is stored in a second storage area; if the optional storage program only includes a first storage program and a second storage program, and the priority of the first storage program is greater than the priority of the second storage program, then the first storage program is used as the target program; if the optional storage program only includes the first storage program, then the first storage program is used as the target program.
[0009] In one embodiment of the present invention, the process of running the target program includes: performing a program check on the target program to obtain a check result of the target program; deleting the target program from the stored programs located in different storage areas to obtain an unexecuted program; and performing a program check on the unexecuted program to obtain a check result of the unexecuted program; determining an update program based on the check result of the target program and the check result of the unexecuted program and executing the update program; the update program is a stored program whose check result is correct in the target program or the unexecuted program.
[0010] In one embodiment of the present invention, the process of determining an update program and executing the update program according to the verification result of the target program and the verification result of the unexecuted program includes: if the verification result of the target program is that the verification is correct, and there is a stored program with a verification result of a verification error in the unexecuted program, the target program is used as the update program, and the update program is executed, and the stored program with a verification result of a verification error in the unexecuted program is modified by the update program so that the modified stored program in the unexecuted program is consistent with the update program; if the verification result of the target program is that the verification is correct, and there is no stored program with a verification result of a verification error in the unexecuted program, the target program is used as the update program The update program is executed; if the verification result of the target program is a verification error, and there is a stored program with a verification result that is correct in the unexecuted program, any stored program with a verification result that is correct in the unexecuted program is used as the update program, and the update program is executed, and the target program and the stored program with a verification result that is incorrect in the unexecuted program are modified by the update program, so that the modified target program is consistent with the update program, and the modified stored program in the unexecuted program is consistent with the update program; if the verification result of the target program is a verification error, and there is no stored program with a verification result that is correct in the unexecuted program, the stored program is determined to be wrong and an alarm is issued.
[0011] According to one aspect of an embodiment of the present invention, there is provided an actuator program verification device, the device comprising: a program acquisition module, used to obtain an execution program of the actuator; a program verification module, used to place the execution program in a storage area, obtain a stored program, and perform verification calculations on the stored program to obtain a calculated verification value of the stored program; the verification calculations include cyclic redundancy check calculations; a value verification module, used to perform the verification calculations on the calculated verification value to obtain a comparison verification value of the calculated verification value; a result determination module, used to determine the verification result of the stored program based on a comparison result between the calculated verification value and a first preset verification value, and a comparison result between the comparison verification value and a second preset verification value; the first preset verification value is obtained by performing the verification calculations on the execution program; the second preset verification value is obtained by performing the verification calculations on the first preset verification value.
[0012] In one embodiment of the present invention, the device also includes: an electrically erasable programmable read-only memory, used to pre-store the first preset check value and the second preset check value; a check value modification module, used to modify the first preset check value and the second preset check value; a check value reading module, used to read the first preset check value and the second preset check value from the electrically erasable programmable read-only memory, and provide the first preset check value and the second preset check value to the result determination module.
[0013] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the actuator program verification method as described above.
[0014] According to one aspect of an embodiment of the present application, a computer storage medium is provided, including: computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned actuator program verification method.
[0015] Beneficial effects of the present invention: The present invention obtains the execution program of the execution mechanism, places the execution program in the storage area, obtains the stored program, performs verification calculation on the stored program, obtains the calculated verification value of the stored program, performs verification calculation on the calculated verification value, obtains the comparison verification value of the calculated verification value, and determines the verification result of the stored program according to the comparison result between the calculated verification value and the first preset verification value and the comparison result between the comparison verification value and the second preset verification value. In the above process, the correctness of the stored program is verified by comparing the calculated verification value with the first preset verification value, and the correctness of the calculated verification value is verified by comparing the comparison verification value with the second preset verification value. And when the calculated check value is consistent with the first preset check value, and the comparison check value is consistent with the second preset check value, the verification result of the stored program is determined to be correct, thereby improving the accuracy and reliability of the stored program verification; in addition, the calculated check value and the first preset check value are both calculated by cyclic redundancy check, and when the calculated check value is consistent with the first preset check value, the integrity and correctness of the stored program can be verified; the comparison check value and the second preset check value are both calculated by cyclic redundancy check, and when the comparison check value and the second preset check value are consistent, the integrity and correctness of the calculated check value can be verified.
[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0018] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application;
[0019] Figure 2 is a flow chart of an actuator program verification method shown in an exemplary embodiment of the present application;
[0020] Figure 3 is a flowchart of an exemplary embodiment of the present application showing the execution program startup operation;
[0021] Figure 4 is a flowchart of executing program verification shown in an exemplary embodiment of the present application;
[0022] Figure 5 is a flowchart of executing a partition startup of a program shown in an exemplary embodiment of the present application;
[0023] Figure 6 is a block diagram of an actuator program verification device shown in an exemplary embodiment of the present application;
[0024] Figure 7 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0026] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0027] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0028] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.
[0029] Reference Figure 1 As shown, the system architecture may include a memory 101 and a control chip 102. The control chip 102 may be at least one of a desktop graphics processing unit (GPU) computer, a GPU computing cluster, a neural network computer, etc. Relevant technicians may use the control chip 102 to obtain the execution program of the execution mechanism, place the execution program in the storage area, obtain the storage program, perform verification calculation on the storage program, obtain the calculation verification value of the storage program, perform verification calculation on the calculation verification value, obtain the comparison verification value of the calculation verification value, and determine the verification result of the storage program according to the comparison result between the calculation verification value and the first preset verification value and the comparison result between the comparison verification value and the second preset verification value. The memory 101 is used to pre-store the first preset verification value and the second preset verification value. In this embodiment, the memory 101 uses an EEPROM (Electrically Erasable Programmable Read-Only Memory) to pre-store the first preset verification value and the second preset verification value, and provide them to the control chip 102 for processing. In the control chip 102, the storage area is partitioned to form storage area A and storage area B. The execution program is stored in storage area A to obtain a first storage program. The execution program is stored in storage area B to obtain a second storage program. The first storage program and the second storage program back up each other.
[0030] In an illustrative manner, after acquiring the first preset check value and the second preset check value in the memory 101, the control chip 102 acquires the execution program of the execution mechanism, places the execution program in the storage area, obtains the stored program, performs a check calculation on the stored program, obtains the calculated check value of the stored program, performs a check calculation on the calculated check value, obtains the comparison check value of the calculated check value, and determines the verification result of the stored program according to the comparison result between the calculated check value and the first preset check value and the comparison result between the comparison check value and the second preset check value. In the above process, the correctness of the stored program is verified by comparing the calculated check value with the first preset check value, and the correctness of the stored program is verified by comparing the comparison check value with the second preset check value. The correctness of the calculated check value is verified by comparison, and when the calculated check value is consistent with the first preset check value, and the comparison check value is consistent with the second preset check value, the verification result of the stored program is determined to be correct, thereby improving the accuracy and reliability of the stored program verification; in addition, the calculated check value and the first preset check value are both calculated by cyclic redundancy check, and when the calculated check value is consistent with the first preset check value, the integrity and correctness of the stored program can be verified; the comparison check value and the second preset check value are both calculated by cyclic redundancy check, and when the comparison check value and the second preset check value are consistent, the integrity and correctness of the calculated check value can be verified.
[0031] It should be noted that the actuator program verification method provided in the embodiment of the present application is generally executed by the control chip 102 , and accordingly, the actuator program verification device is generally disposed in the control chip 102 .
[0032] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0033] Figure 2 is a flowchart of an actuator program verification method shown in an exemplary embodiment of the present application. The actuator program verification method can be executed by a computing processing device. The computing processing device can be Figure 1 The control chip 102 shown in FIG. Figure 2 As shown, the actuator program verification method at least includes steps S210 to S240, which are described in detail as follows:
[0034] In step S210, the execution program of the actuator is obtained. In one embodiment of the present application, the execution program is a driving program required by the actuator to complete linear or rotational motion, and the driving program is stored in the form of code.
[0035] In step S220, the execution program is placed in the storage area to obtain the storage program, and the storage program is verified and calculated to obtain the calculated verification value of the storage program. In one embodiment of the present application, the verification calculation includes a cyclic redundancy check calculation, and the cyclic redundancy check calculation has the function of verifying the integrity and correctness of the data. The storage area is a flash memory, and the flash memory is divided into an A storage area and a B storage area. After obtaining the execution program, the execution program is stored in the A storage area to obtain a first storage program, and the execution program is stored in the B storage area to obtain a second storage program. The first storage program and the second storage program are backed up by each other, and the priorities of the first storage program and the second storage program can be the same, and the priorities of the first storage program and the second storage program can be different. For example, the priority of the first storage program is greater than the priority of the second storage program.
[0036] In step S230, the calculated check value is checked and calculated to obtain a comparison check value of the calculated check value. In one embodiment of the present application, the comparison check value is obtained by checking and calculating the calculated check value, and the comparison check value is compared with a second preset check value to verify the correctness of the calculated check value.
[0037] In step S240, the verification result of the stored program is determined according to the comparison result of the calculated verification value and the first preset verification value, and the comparison result of the comparison verification value and the second preset verification value. In one embodiment of the present application, the first preset verification value is obtained by verifying and calculating the execution program; the second preset verification value is obtained by verifying and calculating the first preset verification value. The process of obtaining the execution program of the execution mechanism, placing the execution program in the storage area, obtaining the storage program, verifying and calculating the storage program, obtaining the calculation verification value of the storage program, verifying and calculating the calculation verification value, obtaining the comparison verification value of the calculation verification value, and determining the verification result of the stored program according to the comparison result of the calculation verification value and the first preset verification value, and the comparison result of the comparison verification value and the second preset verification value is performed in the control chip, and the control chip can adopt a microcontroller unit (MCU) chip, etc.
[0038] In one embodiment of the present application, the correctness of the stored program is verified by comparing the calculated check value with the first preset check value, and the correctness of the calculated check value is verified by comparing the comparison check value with the second preset check value. When the calculated check value is consistent with the first preset check value and the comparison check value is consistent with the second preset check value, the verification result of the stored program is determined to be correct, thereby improving the accuracy and reliability of the stored program verification. In addition, the calculated check value and the first preset check value are both calculated by a cyclic redundancy check, and when the calculated check value is consistent with the first preset check value, the integrity and correctness of the stored program can be verified. The comparison check value and the second preset check value are both calculated by a cyclic redundancy check, and when the comparison check value and the second preset check value are consistent, the integrity and correctness of the calculated check value can be verified.
[0039] In one embodiment of the present application, the process of determining the verification result of the stored program according to the comparison result of the calculated verification value and the first preset verification value and the comparison result of the comparison verification value and the second preset verification value includes:
[0040] If the calculated check value is consistent with the first preset check value, and the compared check value is consistent with the second preset check value, the check result is determined to be correct. In one embodiment of the present application, the calculated check value is consistent with the first preset check value, indicating that the stored program is complete and correct, and the compared check value is consistent with the second preset check value, indicating that the calculated check value is complete and correct. Only on the basis that the stored program is complete and correct and the calculated check value is complete and correct, the check result of the stored program is determined to be complete and correct, thereby improving the accuracy and reliability of the stored program check.
[0041] If the calculated check value is inconsistent with the first preset check value, and / or the compared check value is inconsistent with the second preset check value, the check result is determined to be a check error. In one embodiment of the present application, if at least one of the comparison results of the calculated check value and the first preset check value and the comparison results of the compared check value and the second preset check value is inconsistent, the stored program check error is determined.
[0042] In one embodiment of the present application, if the stored program includes stored programs located in different storage areas, after determining the verification result of the stored program, the execution mechanism program verification method further includes:
[0043] According to the verification results of the stored programs located in different storage areas, the optional stored programs and the non-optional stored programs are determined. In one embodiment of the present application, the optional stored programs only include the stored programs whose verification results are correct; the non-optional stored programs only include the stored programs whose verification results are wrong; the different storage areas include A storage area and B storage area, etc., wherein A storage area corresponds to the first storage area, and B storage area corresponds to the second storage area.
[0044] If the number of selectable stored programs is less than the preset number threshold, the stored program is determined to be wrong and an alarm is issued. In one embodiment of the present application, the preset number threshold is set according to the actual situation. For example, the preset number threshold is set to 1. After determining that the stored program is wrong, an alarm is issued to remind the staff to check and modify the stored program in time.
[0045] If the number of optional storage programs is greater than or equal to a preset number threshold, the target program is determined according to the priority of the optional storage programs. In one embodiment of the present application, if the optional storage programs include only one storage program, the storage program is used as the target program; if the optional storage programs include multiple storage programs, a storage program with a high priority is selected as the target program; if the priorities of multiple storage programs are the same, any one storage program is selected as the target program.
[0046] Start and run the target program; and modify the unselectable stored program according to the target program so that the modified unselectable stored program is consistent with the target program. In one embodiment of the present application, modifying the unselectable stored program according to the target program is conducive to the recovery of the unselectable stored program and ensures the consistency and correctness of the modified unselectable stored program with the target program.
[0047] In one embodiment of the present application, the process of determining the target program according to the priority of the optional storage program includes:
[0048] If the optional stored program includes only the first stored program and the second stored program, and the priority of the first stored program is the same as the priority of the second stored program, the first stored program or the second stored program is used as the target program. In one embodiment of the present application, the first stored program is stored in the first storage area; the second stored program is stored in the second storage area; when the optional stored program includes only the first stored program and the second stored program, the priority of the first stored program and the priority of the second stored program are compared, and if the priority of the first stored program and the priority of the second stored program are the same, any one of the first stored program and the second stored program is selected as the target program.
[0049] If the optional stored program includes only the first stored program and the second stored program, and the priority of the first stored program is greater than the priority of the second stored program, the first stored program is used as the target program. In one embodiment of the present application, when the optional stored program includes only the first stored program and the second stored program, the priority of the first stored program is compared with the priority of the second stored program. If the priority of the first stored program is greater than the priority of the second stored program (i.e., the first stored program is the main execution program and the second stored program is the backup execution program), the first stored program is used as the target program.
[0050] If the optional stored programs only include the first stored program, the first stored program is used as the target program. In one embodiment of the present application, when the optional stored programs only include the first stored program, the first stored program is directly used as the target program.
[0051] In one embodiment of the present application, the process of running the target program includes:
[0052] Perform a program check on the target program to obtain a check result of the target program. In one embodiment of the present application, the process of performing a program check on the target program includes: (1) performing a check calculation on the target program to obtain a calculated check value of the target program, recorded as a first check value; (2) performing a check calculation on the first check value to obtain a comparison check value of the first check value, recorded as a second check value; (3) if the first check value is consistent with the first preset check value, and the second check value is consistent with the second preset check value, then the check result of the target program is determined to be a correct check; (4) if the first check value is inconsistent with the first preset check value, and / or the second check value is inconsistent with the second preset check value, then the check result of the target program is determined to be a wrong check.
[0053] The target program is deleted from the stored programs located in different storage areas to obtain an unexecuted program; and the unexecuted program is program-verified to obtain a verification result of the unexecuted program. In one embodiment of the present application, the process of program-verifying the unexecuted program includes: (1) performing verification calculation on the unexecuted program to obtain a calculated verification value of the unexecuted program, recorded as a third verification value; (2) performing verification calculation on the third verification value to obtain a comparison verification value of the third verification value, recorded as a fourth verification value; (3) if the third verification value is consistent with the first preset verification value, and the fourth verification value is consistent with the second preset verification value, then the verification result of the unexecuted program is determined to be a correct verification; (4) if the third verification value is inconsistent with the first preset verification value, and / or the third verification value is inconsistent with the second preset verification value, then the verification result of the unexecuted program is determined to be a verification error.
[0054] According to the verification results of the target program and the verification results of the unexecuted program, the update program is determined and executed. In one embodiment of the present application, the update program is a stored program whose verification result is a correct verification in the target program or the unexecuted program. If the verification result of the target program is a correct verification, the target program is used as the update program; if the verification result of the target program is a verification error, the stored program whose verification result is a correct verification in the unexecuted program is used as the target program. If there are multiple stored programs whose verification results are correct in the unexecuted program, a stored program can be randomly selected as the update program from the stored programs whose verification results are correct in the unexecuted program, or a stored program with a high priority can be selected as the update program from the stored programs whose verification results are correct in the unexecuted program; if the verification result of the target program is a verification error, and there is no stored program whose verification result is a correct verification in the unexecuted program, it is determined that the stored program is wrong and an alarm is issued.
[0055] In one embodiment of the present application, the process of determining an update program and executing the update program according to the verification result of the target program and the verification result of the unexecuted program includes:
[0056] If the verification result of the target program is that the verification is correct, and there is a stored program with a verification result of a verification error in the unexecuted program, the target program is used as an update program, and the update program is executed. The stored program with a verification result of a verification error in the unexecuted program is modified by the update program so that the modified stored program in the unexecuted program is consistent with the update program. In one embodiment of the present application, on the one hand, if the verification result of the target program is that the verification is correct, the target program is used as an update program, and the program switching is not performed to avoid increasing the number of unnecessary program switching times; on the other hand, the stored program with a verification result of a verification error in the unexecuted program is modified by the update program to ensure the correctness of the stored program with a verification result of a verification error in the unexecuted program.
[0057] If the verification result of the target program is that the verification is correct, and there is no stored program in the unexecuted program whose verification result is a verification error, the target program is used as the update program and the update program is executed. In one embodiment of the present application, if the verification result of the target program is that the verification is correct, the target program is used as the update program and the program switching is not performed to avoid increasing the number of unnecessary program switching times.
[0058] If the verification result of the target program is a verification error, and there is a stored program in the unexecuted program whose verification result is a verification correct, then any stored program in the unexecuted program whose verification result is a verification correct is used as an update program, and the update program is executed, and the target program and the stored program in the unexecuted program whose verification result is a verification error are modified by the update program, so that the modified target program is consistent with the update program, and the modified stored program in the unexecuted program is consistent with the update program. In one embodiment of the present application, if the verification result of the target program is a verification error, then any stored program in the unexecuted program whose verification result is a verification correct is used as an update program to ensure the continuity and correctness of the program operation, and at the same time, the update program modifies the stored program in the target program and the unexecuted program whose verification result is a verification error to ensure the correctness of the stored program in the target program and the unexecuted program whose verification result is a verification error.
[0059] In one embodiment of the present application, if there are multiple stored programs whose verification results in the unexecuted program are correct, a stored program with a high priority is selected as the target program; if the priorities of multiple stored programs whose verification results in the unexecuted program are correct are the same, any one of the stored programs is selected as the target program.
[0060] If the verification result of the target program is a verification error, and there is no stored program with a verification result that is correct in the unexecuted program, the stored program is judged to be wrong and an alarm is issued, which is helpful to remind the staff that the stored program has an error and cannot work normally, and is conducive to timely verification and modification of the stored program.
[0061] In one embodiment of the present application, during the running of the update program, the update program is checked to obtain the check result of the update program, all stored programs except the update program are recorded as updated unexecuted programs, and the updated unexecuted programs are checked to obtain the check result of the updated unexecuted programs. Based on the check result of the update program and the check result of the modified unexecuted programs, the process of re-determining the update program can be performed multiple times according to the scheduled time until the program runs to the end or the check value results of all programs are check errors. The above process, on the one hand, ensures the correct and continuous operation of the program by checking the integrity and correctness of all programs multiple times. On the other hand, when the check value results of all programs are check errors and the program cannot continue to run, it can be discovered in time, which is convenient for the staff to check and modify the program in time.
[0062] Figure 3 is a flowchart of an exemplary embodiment of the present application showing the execution program startup operation, such as Figure 3As shown, the process of starting the execution program includes: (1) in the program startup phase: calling the program verification module to verify the stored programs in storage area A and the stored programs in storage area B; judging whether there is a stored program verification error flag, if there is no stored program verification error flag, taking the stored program in storage area A as the current execution program to enter the program running phase; if there is a stored program verification error flag, taking another stored program as the current execution program to enter the program running phase, and recovering the stored program with verification error through the current execution program; if all stored programs have verification error flags, then judging that the stored program is wrong and giving an alarm, and entering the startup phase again after the staff modifies the stored program; (2) in the program running phase: calling the program verification module again to perform program verification on the currently executed program and the unexecuted program to judge whether there is a program verification error flag If there is a program verification error, if there is no stored program verification error, the current execution program will continue to be executed, and the current execution program and the unexecuted program will be regularly verified; if the current execution program is verified correctly, and the unexecuted program has a verification error, the current execution program will continue to be executed, the unexecuted program will be restored according to the current execution program, and the current execution program and the unexecuted program will be regularly verified; if the current execution program has a verification error, and the unexecuted program has a verification error, the current execution program will be replaced by the unexecuted program, and the replaced execution program will be executed, and the execution program with verification errors will be restored by the replaced execution program, and the replaced execution program and the restored execution program will be regularly verified; if both the current execution program and the unexecuted program have verification errors, the stored program is determined to be wrong and an alarm is issued. After the staff modifies the stored program, the startup phase is entered again.
[0063] Figure 4 is a flowchart of executing program verification shown in an exemplary embodiment of the present application, such as Figure 4 As shown, the process of executing program verification includes: verifying the stored program in storage area A and the stored program in storage area B; judging whether the verification result of the stored program in storage area A and the verification result of the stored program in storage area B are both correct, if so, outputting a flag that the stored program in storage area A and the stored program in storage area B are both correct; if not, judging whether the verification result of the stored program in storage area A is correct and the verification result of the stored program in storage area B is incorrect, if so, outputting a flag that the verification result of the stored program in storage area A is correct and a flag that the verification result of the stored program in storage area B is incorrect; if not, judging that the verification result of the stored program in storage area A is incorrect and the verification result of the stored program in storage area B is correct, if so, outputting a flag that the verification result of the stored program in storage area A is incorrect and a flag that the verification result of the stored program in storage area B is correct; if not, outputting a flag that the stored program in storage area A and the stored program in storage area B are both incorrect.
[0064] Figure 5 is a flowchart of executing a partition startup of a program shown in an exemplary embodiment of the present application, such as Figure 5 As shown, the process of executing program partition startup includes: in the program startup stage, the stored program in storage area A and the stored program in storage area B are verified. If the stored program in storage area A is verified correctly and the stored program in storage area B is verified correctly, the stored program in storage area A is started; if the stored program in storage area A is verified correctly and the stored program in storage area B is verified incorrectly, the stored program in storage area A is started; if the stored program in storage area A is verified incorrectly and the stored program in storage area B is verified correctly, the stored program in storage area B is started; if the stored program in storage area A is verified incorrectly and the stored program in storage area B is verified correctly, the stored program in storage area B is started; if the stored program in storage area A is verified incorrectly and the stored program in storage area B is verified incorrectly, no stored program is started and an alarm is issued.
[0065] In one embodiment of the present application, the stored programs in storage area A and the stored programs in storage area B are verified in both the program startup phase and the program running phase. At the same time, the stored programs with verification errors can be restored according to the stored programs with verification errors, to ensure the integrity and correctness of the stored programs in storage area A and the integrity and correctness of the stored programs in storage area B, and then the stored programs in storage area A are preferentially selected for execution. In the program running phase, if the currently executed program has a verification error, the stored program in another storage area will be executed first, and then the executed program with verification errors will be restored, to ensure that the stored programs in storage area A and the stored programs in storage area B are both complete and correct.
[0066] The following describes an apparatus embodiment of the present application, which can be used to execute the actuator program verification method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned embodiment of the actuator program verification method of the present application.
[0067] Figure 6 is a block diagram of an actuator program verification device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The implementation environment shown in the figure is specifically configured in the control chip 102. The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applied.
[0068] like Figure 6 As shown, the exemplary actuator program verification device includes:
[0069] The program acquisition module 601 is used to acquire the execution program of the execution mechanism.
[0070] The program verification module 602 is used to place the execution program in the storage area, obtain the stored program, and perform verification calculation on the stored program to obtain the calculated verification value of the stored program.
[0071] The value verification module 603 is used to perform verification calculation on the calculated verification value to obtain a comparison verification value of the calculated verification value.
[0072] The result determination module 604 is used to determine the verification result of the stored program according to the comparison result between the calculated verification value and the first preset verification value and the comparison result between the comparison verification value and the second preset verification value.
[0073] In one embodiment of the present application, the execution program is a driving program required for the actuator to complete linear or rotational motion, and the driving program is stored in the form of code.
[0074] In one embodiment of the present application, the verification calculation includes a cyclic redundancy check calculation, which has the function of verifying data integrity and correctness. The storage area is a flash memory, and the flash memory is divided into an A storage area and a B storage area. After obtaining the execution program, the execution program is stored in the A storage area to obtain a first storage program, and the execution program is stored in the B storage area to obtain a second storage program. The first storage program and the second storage program are backed up by each other. The priorities of the first storage program and the second storage program can be the same, and the priorities of the first storage program and the second storage program can be different. For example, the priority of the first storage program is greater than the priority of the second storage program.
[0075] In one embodiment of the present application, the comparison check value is obtained by verifying the calculated check value, and the comparison check value is compared with the second preset check value to verify the correctness of the calculated check value.
[0076] In one embodiment of the present application, the first preset check value is obtained by checking and calculating the execution program; the second preset check value is obtained by checking and calculating the first preset check value. The process of obtaining the execution program of the execution mechanism, placing the execution program in the storage area, obtaining the storage program, checking and calculating the storage program, obtaining the calculation check value of the storage program, checking and calculating the calculation check value, obtaining the comparison check value of the calculation check value, and determining the verification result of the storage program according to the comparison result of the calculation check value with the first preset check value and the comparison result of the comparison check value with the second preset check value is carried out in the control chip, and the control chip can adopt a microcontroller unit, for example, a (Microcontroller Unit, MCU) chip.
[0077] In one embodiment of the present application, the correctness of the stored program is verified by comparing the calculated check value with the first preset check value, and the correctness of the calculated check value is verified by comparing the comparison check value with the second preset check value. When the calculated check value is consistent with the first preset check value and the comparison check value is consistent with the second preset check value, the verification result of the stored program is determined to be correct, thereby improving the accuracy and reliability of the stored program verification. In addition, the calculated check value and the first preset check value are both calculated by a cyclic redundancy check, and when the calculated check value is consistent with the first preset check value, the integrity and correctness of the stored program can be verified. The comparison check value and the second preset check value are both calculated by a cyclic redundancy check, and when the comparison check value and the second preset check value are consistent, the integrity and correctness of the calculated check value can be verified.
[0078] In one embodiment of the present application, the execution mechanism program verification device further includes:
[0079] The electrically erasable programmable read-only memory is used to pre-store a first preset check value and a second preset check value.
[0080] The check value modification module is used to modify the first preset check value and the second preset check value.
[0081] The check value reading module is used to read the first preset check value and the second preset check value from the electrically erasable programmable read-only memory, and provide the first preset check value and the second preset check value to the result determination module.
[0082] In one embodiment of the present application, the program acquisition module, the program verification module, the value verification module and the result determination module are arranged in the MCU chip, the electrically erasable programmable read-only memory is arranged independently in the MCU chip, and the verification value modification module can be a modification module provided by the electrically erasable programmable read-only memory, or can be a modification module independently arranged relative to the electrically erasable programmable read-only memory, which is not specifically limited here. By pre-storing the first preset verification value and the second preset verification value in the electrically erasable programmable read-only memory, it is convenient to modify the first preset verification value and the second preset verification value, improves the convenience and operability of modifying the first preset verification value and the second preset verification value, and optimizes the technical problems of directly writing the first preset verification value and the second preset verification value into the MCU chip, which is inconvenient to modify the first preset verification value and the second preset verification value during the upgrade of the execution program in the MCU chip, and the first preset verification value and the second preset verification value are easily lost.
[0083] In one embodiment of the present application, when the execution program in the MCU chip is executed normally, the unexecuted program on the MCU chip is also verified in real time to ensure the real-time nature of the verification.
[0084] It should be noted that the actuator program verification device provided in the above embodiment and the actuator program verification method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In actual application, the actuator program verification device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0085] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by one or more processors, the electronic device implements the execution mechanism program verification method provided in the above-mentioned embodiments.
[0086] Figure 7 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0087] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703, such as executing the method in the above embodiment. In the RAM 703, various programs and data required for system operation are also stored. The CPU 701, the ROM 702 and the RAM 703 are connected to each other through the bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.
[0088] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.
[0089] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 709, and / or installed from a removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, various functions defined in the system of the present application are executed.
[0090] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0091] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0092] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0093] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the aforementioned actuator program verification method. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0094] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the execution mechanism program verification method provided in each of the above embodiments.
[0095] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A method for checking an actuator program, characterized in that: The method comprises: obtaining the execution program of the execution agency; Placing the execution program in a storage area to obtain a stored program, and performing a check calculation on the stored program to obtain a calculated check value of the stored program; the check calculation includes a cyclic redundancy check calculation; Performing the verification calculation on the calculated verification value to obtain a comparison verification value of the calculated verification value; The verification result of the stored program is determined based on the comparison result of the calculated verification value with the first preset verification value and the comparison result of the comparison verification value with the second preset verification value; the first preset verification value is obtained by performing the verification calculation on the execution program; the second preset verification value is obtained by performing the verification calculation on the first preset verification value.
2. The actuator program verification method according to claim 1, characterized in that: The process of determining the verification result of the stored program according to the comparison result of the calculated verification value with the first preset verification value and the comparison result of the comparison verification value with the second preset verification value includes: If the calculated check value is consistent with the first preset check value, and the compared check value is consistent with the second preset check value, then the check result is determined to be correct; If the calculated check value is inconsistent with the first preset check value, and / or the compared check value is inconsistent with the second preset check value, the check result is determined to be a check error.
3. The actuator program verification method according to claim 2, characterized in that: If the stored programs include stored programs located in different storage areas, after determining the verification result of the stored programs, the method further includes: Determine optional stored programs and non-optional stored programs according to the verification results of the stored programs located in different storage areas; the optional stored programs only include the stored programs whose verification results are correct; the non-optional stored programs only include the stored programs whose verification results are wrong; If the number of the optional stored programs is less than a preset number threshold, the stored program is determined to be wrong and an alarm is issued; If the number of the optional stored programs is greater than or equal to the preset number threshold, determining the target program according to the priority of the optional stored programs; The target program is started and run; and the unselectable stored program is modified according to the target program so that the modified unselectable stored program is consistent with the target program.
4. The actuator program verification method according to claim 3, characterized in that: The process of determining the target program according to the priority of the optional stored program includes: If the optional stored programs only include the first stored program and the second stored program, and the priority of the first stored program is the same as that of the second stored program, the first stored program or the second stored program is used as the target program; the first stored program is stored in the first storage area; the second stored program is stored in the second storage area; If the optional stored programs only include the first stored program and the second stored program, and the priority of the first stored program is greater than the priority of the second stored program, the first stored program is used as the target program; If the optional stored programs only include the first stored program, the first stored program is used as the target program.
5. The actuator program verification method according to claim 3, characterized in that: The process of running the target program includes: Performing program verification on the target program to obtain a verification result of the target program; Deleting the target program from the stored programs located in different storage areas to obtain an unexecuted program; and performing a program check on the unexecuted program to obtain a check result of the unexecuted program; According to the verification result of the target program and the verification result of the unexecuted program, an update program is determined and executed; the update program is a stored program whose verification result is correct in the target program or the unexecuted program.
6. The actuator program verification method according to claim 5, characterized in that: The process of determining an update program and executing the update program according to the verification result of the target program and the verification result of the unexecuted program includes: If the verification result of the target program is that the verification is correct, and there is a stored program with a verification result of a verification error in the unexecuted program, the target program is used as the update program, and the update program is executed, and the stored program with a verification result of a verification error in the unexecuted program is modified by the update program so that the modified stored program in the unexecuted program is consistent with the update program; If the verification result of the target program is that the verification is correct, and there is no stored program with a verification result of a verification error in the unexecuted program, the target program is used as the update program, and the update program is executed; If the verification result of the target program is a verification error, and there is a stored program in the unexecuted program whose verification result is a verification correct, any stored program in the unexecuted program whose verification result is a verification correct is used as the update program, and the update program is executed, and the target program and the stored program in the unexecuted program whose verification result is a verification error are modified by the update program, so that the modified target program is consistent with the update program, and the modified stored program in the unexecuted program is consistent with the update program; If the verification result of the target program is a verification error, and there is no stored program with a verification result that is a verification correct in the unexecuted program, the stored program is determined to be wrong and an alarm is issued.
7. An actuator program verification device, characterized in that: The device comprises: A program acquisition module, used to acquire the execution program of the execution mechanism; A program verification module, used for placing the execution program in a storage area to obtain a stored program, and performing a verification calculation on the stored program to obtain a calculated verification value of the stored program; the verification calculation includes a cyclic redundancy check calculation; A value verification module, used to perform the verification calculation on the calculated verification value to obtain a comparison verification value of the calculated verification value; A result determination module is used to determine the verification result of the stored program according to the comparison result of the calculated verification value and the first preset verification value, and the comparison result of the comparison verification value and the second preset verification value; the first preset verification value is obtained by performing the verification calculation on the execution program; the second preset verification value is obtained by performing the verification calculation on the first preset verification value.
8. The actuator program checking device according to claim 7, characterized in that: The device also includes: A powered erasable programmable read-only memory, used for pre-storing the first preset check value and the second preset check value; A check value modification module, used to modify the first preset check value and the second preset check value; The check value reading module is used to read the first preset check value and the second preset check value from the electrically erasable programmable read-only memory, and provide the first preset check value and the second preset check value to the result determination module.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the actuator program verification method as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that: include: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the actuator program verification method according to any one of claims 1 to 7.