Function test method and system of controller

By building a firmware image file that includes startup boot program, controller application software and functional testing software, and dynamically selecting execution paths using interrupt instructions, the problem of lack of flexibility and independence of controller testing methods in the prior art is solved, and higher system stability and security are achieved.

CN120010438APending Publication Date: 2025-05-16SAIC GM WULING AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510062939.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The existing controller testing methods lack flexibility and cannot dynamically select and execute different software modules according to actual needs. The independence of the test software and application software is insufficient, resulting in the impact of system stability and reliability.

Method used

Build a firmware image file that includes the startup boot program, the controller application software and the functional testing software, and dynamically select the execution path through the interrupt command to ensure that the test software and the application software are independent of each other.

Benefits of technology

It improves the flexibility and controllability of controller functional testing, avoids mutual interference between testing software and application software, and enhances the stability and security of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120010438A_ABST
    Figure CN120010438A_ABST
Patent Text Reader

Abstract

The invention discloses a function test method and system for a controller. The function test method comprises the steps that a firmware image file is constructed, and a firmware image is burnt into the controller; when the controller is powered on and started, an interrupt instruction is obtained, and the controller is controlled to execute the controller application software or the function test software according to the interrupt instruction. According to the method, the integrated firmware image file is constructed, and the execution path is dynamically selected according to the interrupt instruction, so that the problems of flexibility and controllability of the controller in the function test are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of function testing of controllers, and relates to a function testing method and system for a controller. Background Art

[0002] In modern industrial control systems, the reliability and safety of controllers are crucial. In order to ensure that the controllers function properly and meet performance standards before leaving the factory, a series of rigorous tests are usually required. These tests are completed by dedicated functional test software, which can detect various functions of the controller and generate detailed test reports. However, how to safely switch to the normal application operation state after the test is completed, and how to flexibly select and execute different software modules according to actual needs are important challenges facing the current technology field.

[0003] Existing controller testing methods often rely on fixed execution paths, lack flexibility, and cannot dynamically select and execute different software modules according to actual needs. This not only affects test efficiency, but may also introduce potential safety hazards. In addition, the existing technology fails to fully consider the independence between the test software and the application software during the controller startup process, which may cause the two to interfere with each other, affecting the stability and reliability of the system. Summary of the invention

[0004] In view of the deficiencies in the prior art, the present application provides a controller functional testing method and system, which solves the flexibility and controllability problems of the controller in functional testing by constructing an integrated firmware image file and dynamically selecting an execution path according to interrupt instructions.

[0005] To achieve the above objectives, in a first aspect, the present invention provides a method for testing the function of a controller, comprising:

[0006] Constructing a firmware image file and burning the firmware image into the controller; wherein the firmware image file includes: a boot program, a controller application software and a function test software, and the controller application software and the function test software are independent of each other;

[0007] When the controller is powered on, an interrupt instruction is obtained, and according to the interrupt instruction, the controller is controlled to execute the controller application software or function test software.

[0008] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by constructing a firmware image file including a boot program, controller application software and functional test software, the burning process is simplified, ensuring that the two software are independent of each other, and avoiding mutual interference between the test software and the application software; when the controller is powered on, different software modules can be dynamically selected for execution according to interrupt instructions and actual needs, thereby improving the response speed and controllability of the operation.

[0009] In some embodiments of the first aspect of the present application, when the controller is powered on, an interrupt instruction is obtained, and according to the interrupt instruction, the controller is controlled to execute the controller application software or the function test software, including:

[0010] Obtaining an interrupt instruction, and setting a preset identifier of the controller according to the interrupt instruction;

[0011] If the preset identifier meets the preset numerical condition and the validity and integrity check of the functional test software passes, all interrupts of the controller are turned off and the peripherals of the controller are initialized, and the functional test software is executed;

[0012] Otherwise, the controller application software is executed.

[0013] Compared with the prior art, the above embodiment has the following beneficial effects: the introduction of a preset identifier mechanism enables the controller to determine whether to execute the functional test software according to specific conditions, thereby increasing the safety and reliability of the operation; at the same time, by turning off interrupts and deinitializing peripherals, the purity of the test environment is ensured and interference factors are reduced.

[0014] In some embodiments of the first aspect of the present application, executing the controller application software includes:

[0015] Verifying the integrity and validity of the controller application software according to a preset verification algorithm, and executing the controller application software if the verification passes;

[0016] Otherwise, the controller is controlled to return to execute the boot program.

[0017] Compared with the prior art, the above embodiment has the following beneficial effects: through a strict verification mechanism, the integrity and validity of the controller application software are ensured, system failures caused by software damage or tampering are avoided, and stability and security are enhanced.

[0018] In some embodiments of the first aspect of the present application, after executing the functional testing software, the method further includes:

[0019] Destroy the functional test software according to preset program destruction conditions; wherein the preset program destruction conditions include any one or more of the following combinations: the completion flag of the functional test software is set, the initialization flag of the controller application software is set, the initialization completion flag of the boot program is set, and an erase instruction signal is received.

[0020] Compared with the prior art, the above embodiment has the following beneficial effects: by defining multiple destruction conditions, the functional test software can be safely destroyed in different scenarios, avoiding the risk of the controller abnormally entering the test software, while also preventing the leakage of sensitive information, thereby enhancing the confidentiality and security of the system.

[0021] In some embodiments of the first aspect of the present application, destroying the functional test software according to a preset program destruction condition includes:

[0022] Obtaining an interrupt message instruction, and setting a completion flag of the functional test software according to the interrupt message instruction;

[0023] If the completion flag of the functional test software meets the preset numerical condition, all interrupts of the controller are turned off and the peripherals of the controller are initialized;

[0024] The functional test software is erased according to a preset erase instruction.

[0025] Compared with the prior art, the above embodiment has the following beneficial effects: by setting the completion flag and detailed erasure process, it ensures the timely destruction of the functional test software after the test is completed, improves the security and reliability of the system, and also provides feedback on the erasure status for easy monitoring and maintenance.

[0026] In some embodiments of the first aspect of the present application, destroying the functional test software according to a preset program destruction condition includes:

[0027] Controlling the controller to reset and power on again;

[0028] Initialize the controller application software and obtain interrupt message instructions;

[0029] According to the interrupt instruction, setting the initialization flag of the controller application software;

[0030] If the initialization flag of the controller application software meets the preset numerical condition, all interrupts of the controller are turned off and the peripherals of the controller are initialized;

[0031] The functional test software is erased according to a preset erase instruction.

[0032] Compared with the prior art, the above embodiment has the following beneficial effects: the functional test software can also be destroyed during the initialization of the controller application software, thereby ensuring the purity of the environment before the application software is started, avoiding potential safety hazards, and improving the stability and security of the system.

[0033] In some embodiments of the first aspect of the present application, destroying the functional test software according to a preset program destruction condition includes:

[0034] Controlling the controller to reset and power on again;

[0035] Controlling the controller to execute the controller application software and obtain an erase instruction signal;

[0036] According to the erase instruction signal, shut down all interrupts of the controller and deinitialize the peripherals of the controller;

[0037] The functional test software is erased according to a preset erase instruction.

[0038] Compared with the prior art, the above embodiment has the following beneficial effects: it allows the functional test software to be dynamically destroyed according to external instructions during the operation of the controller application software, increases the flexibility and response speed of the system, and ensures the timeliness and security of software destruction.

[0039] In some embodiments of the first aspect of the present application, destroying the functional test software according to a preset program destruction condition includes:

[0040] Controlling the controller to reset and power on again, so that the controller executes the boot program;

[0041] Obtaining an interrupt message instruction, and setting an initialization completion flag of the boot program according to the interrupt message instruction;

[0042] If the initialization completion flag of the boot program meets the preset numerical condition, all interrupts of the controller are turned off and the peripherals of the controller are initialized;

[0043] The functional test software is erased according to a preset erase instruction.

[0044] Compared with the prior art, the above embodiment has the following beneficial effects: after the boot program is initialized, the functional test software is destroyed, thereby ensuring the security and stability of the system startup process, avoiding unnecessary resource occupation, and improving the overall performance of the system.

[0045] In some embodiments of the first aspect of the present application, destroying the functional test software according to a preset program destruction condition includes:

[0046] Control the controller to reset and power on again, and obtain a resident boot instruction;

[0047] According to the resident boot instruction, controlling the controller to keep executing the startup boot program within a preset time range;

[0048] Obtaining an erase instruction signal, and according to the erase instruction signal, disabling all interrupts of the controller and deinitializing peripherals of the controller;

[0049] The functional test software is erased according to a preset erase instruction.

[0050] Compared with the prior art, the above embodiment has the following beneficial effects: by resident boot instructions and a pause mechanism, it ensures that the controller maintains the execution state of the boot program within a specific time, provides a time window for obtaining erase instructions, enhances the flexibility and controllability of the system, and ensures the security and timeliness of software destruction.

[0051] In a second aspect, the present invention also provides a controller function test system, a burning module and a control module;

[0052] The burning module is used to construct a firmware image file and burn the firmware image into the controller; the firmware image file includes: a boot program, a controller application software and a function test software, and the controller application software and the function test software are independent of each other;

[0053] The control module is used to obtain an interrupt instruction when the controller is powered on and start, and control the controller to execute the controller application software or function test software according to the interrupt instruction.

[0054] Compared with the prior art, the above embodiments of the present application have the following beneficial effects: by constructing a firmware image file including a boot program, controller application software and functional test software, the burning process is simplified, ensuring that the two software are independent of each other, and avoiding mutual interference between the test software and the application software; when the controller is powered on and started, different software modules can be dynamically selected for execution according to interrupt instructions and actual needs, thereby improving the response speed and controllability of the operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 : A flow chart of a controller functional testing method provided in some embodiments of the present invention.

[0056] Figure 2 : is a structural diagram of a functional testing system for a controller provided in some embodiments of the present invention.

[0057] Figure 3 : A schematic diagram of a firmware image file of a controller functional testing method provided in some embodiments of the present invention.

[0058] Figure 4 : A jump logic diagram of a controller functional testing method provided in some embodiments of the present invention.

[0059] Figure 5 : A schematic diagram of destroying test software of a controller functional testing method provided in some embodiments of the present invention.

[0060] Figure 6 : A schematic diagram of destroying test software of a controller functional testing method provided in some embodiments of the present invention.

[0061] Figure 7 : A schematic diagram of destroying test software of a controller functional testing method provided in some embodiments of the present invention.

[0062] Figure 8 : A schematic diagram of destroying test software of a controller functional testing method provided in some embodiments of the present invention.

[0063] Fig. 9 : A schematic diagram of destroying test software of a controller functional testing method provided in some embodiments of the present invention. DETAILED DESCRIPTION

[0064] 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.

[0065] Embodiment 1:

[0066] Please refer to Figure 1 , a controller function test method provided by an embodiment of the present invention, comprising steps S1 to S2:

[0067] Step S1: construct a firmware image file and burn the firmware image into the controller.

[0068] Among them, Figure 3 The schematic diagram of the firmware image file shown in the figure includes: a boot program, a controller application software and a function test software, and the controller application software and the function test software are independent of each other.

[0069] In this embodiment, step S1 simplifies the burning process by constructing a firmware image file including a boot program, controller application software and function test software, ensures that the two software are independent of each other, and avoids mutual interference between the test software and the application software.

[0070] Step S2: When the controller is powered on, an interrupt instruction is obtained, and according to the interrupt instruction, the controller is controlled to execute the controller application software or the function test software.

[0071] Preferably, in some embodiments of the present application, step S2 can be implemented by the following preferred implementation, including steps S21 to S22, as follows:

[0072] S21: Obtain an interrupt instruction, and set a preset identifier of the controller according to the interrupt instruction;

[0073] S22: If the preset identifier meets the preset numerical conditions and the validity and integrity checks of the functional test software are passed, all interrupts of the controller are turned off and the peripherals of the controller are initialized, and the functional test software is executed; otherwise, the controller application software is executed.

[0074] In steps S21-S22, a preset identifier mechanism is introduced so that the controller can determine whether to execute the functional test software according to specific conditions, thereby increasing the safety and reliability of the operation; at the same time, by turning off interrupts and deinitializing peripherals, the purity of the test environment is ensured and interference factors are reduced.

[0075] Further, in step S22, the execution of the controller application software can be implemented by the following preferred implementations, which are as follows:

[0076] The integrity and validity of the controller application software are verified according to a preset verification algorithm. If the verification passes, the controller application software is executed; otherwise, the controller is controlled to return to execute the boot program.

[0077] In this preferred embodiment, a strict verification mechanism is used to ensure the integrity and validity of the controller application software, thereby avoiding system failures caused by software damage or tampering and enhancing stability and security.

[0078] For example, Figure 4 As shown in the jump logic diagram, after power-on, the preset identifier (FCT_TestF l ag) is set according to the interrupt instruction. After the initialization is completed, it waits for a period of time, such as 20ms, in a loop. If the value of the preset identifier is 1, it means that a test is required, then jump to the test step. If it is not 1, then jump to execute the application software. In addition, after jumping to the test software or application software, the software package needs to be verified before execution. If the verification is successful, it will be executed. If it fails, it will jump again according to the rules.

[0079] In summary, in this embodiment, when the controller is powered on and started, step S2 can dynamically select and execute different software modules according to interrupt instructions and actual needs, thereby improving the response speed and controllability of the operation.

[0080] In particular, after the test software is executed and the test is completed in step S2, in order to avoid the risk of the controller abnormally entering the test software, the following preferred implementation step S3 may be further performed, specifically as follows:

[0081] S3: destroying the functional test software according to a preset program destruction condition;

[0082] The preset program destruction conditions include any one or more of the following combinations: the completion flag of the functional test software is set, the initialization flag of the controller application software is set, the initialization completion flag of the boot program is set, and an erase instruction signal is received.

[0083] In this preferred embodiment, by defining multiple destruction conditions, the functional test software can be safely destroyed in different scenarios, avoiding the risk of the controller abnormally entering the test software, while also preventing the leakage of sensitive information, thereby enhancing the confidentiality and security of the system.

[0084] Further, the step S3 can be implemented by the following preferred implementation, including S31-S33, as follows:

[0085] S31: Obtain an interrupt message instruction, and set a completion flag of the functional test software according to the interrupt message instruction;

[0086] S32: If the completion flag of the functional test software meets the preset numerical condition, all interrupts of the controller are disabled and the peripherals of the controller are initialized;

[0087] S33: Erasing the functional test software according to a preset erasing instruction.

[0088] In addition, in the specific implementation, Figure 5 A schematic diagram of test software destruction is shown. After destruction, it should be checked after resetting and powering on to confirm whether it is destroyed.

[0089] In this preferred embodiment, S31-S33 ensures the timely destruction of the functional test software after the test is completed by setting the completion flag and detailed erasure process, thereby improving the security and reliability of the system, and also provides feedback on the erasure status for easy monitoring and maintenance.

[0090] Preferably, the step S3 can also be implemented by another preferred implementation as follows, including steps S34-S38, as follows:

[0091] S34: Control the controller to reset and power on again;

[0092] S35: Initialize the controller application software and obtain the interrupt message instruction;

[0093] S36: setting the initialization flag of the controller application software according to the interrupt instruction;

[0094] S37: If the initialization flag of the controller application software meets the preset numerical condition, all interrupts of the controller are disabled and the peripherals of the controller are initialized;

[0095] S38: Erasing the functional test software according to a preset erasing instruction.

[0096] For example, in specific implementation, Figure 6 A test software destruction schematic diagram is shown. After receiving the interrupt message instruction, an initialization flag (FCT_EraseF l ag) is set according to the instruction. The controller waits for 20ms and checks the flag. If the value of the flag is 1, it means that erasure is required. Similarly, after erasing, it is necessary to verify whether the erasure is successful.

[0097] In this preferred embodiment, step S3 can also ensure the purity of the environment before the application software is started by destroying the functional test software during the initialization of the controller application software, avoiding potential safety hazards and improving the stability and security of the system.

[0098] Preferably, the step S3 can also be implemented by another preferred implementation as follows, including steps S39-S312, as follows:

[0099] S39: Control the controller to reset and power on again;

[0100] S310: Control the controller to execute the controller application software and obtain an erase instruction signal;

[0101] S311: according to the erase instruction signal, shut down all interrupts of the controller and initialize the peripherals of the controller;

[0102] S312: Erasing the functional test software according to a preset erasing instruction.

[0103] For example, in specific implementation, Figure 7 A schematic diagram of destroying a test software is shown. After the test is completed, the power is reset and restarted, the application software is run, and after receiving the host computer instruction, the test software is directly erased. Similarly, after erasing, it is necessary to verify whether the erasure is successful.

[0104] In this preferred embodiment, step S3 can also increase the flexibility and response speed of the system and ensure the timeliness and safety of software destruction by dynamically destroying the functional test software according to external instructions during the operation of the controller application software.

[0105] Preferably, the step S3 can also be implemented by another preferred implementation as follows, including steps S313-S316, which are specifically as follows:

[0106] S313: Control the controller to reset and power on again, so that the controller executes the boot program;

[0107] S314: Obtain an interrupt message instruction, and set an initialization completion flag of the boot program according to the interrupt message instruction;

[0108] S315: If the initialization completion flag of the boot program meets the preset value condition, all interrupts of the controller are disabled and the peripherals of the controller are initialized;

[0109] S316: Erasing the functional test software according to a preset erasing instruction.

[0110] For example, in specific implementation, Figure 8 A test software destruction diagram shown in the figure can erase the test software when initializing the boot, which is similar to when the application software is initialized. The difference is that an interrupt signal is received when the boot program is started, and then a similar initialization completion flag is set, and whether to erase is selected based on this flag.

[0111] In this preferred embodiment, step S3 can also ensure the security and stability of the system startup process, avoid unnecessary resource occupation, and improve the overall performance of the system by destroying the functional test software after the boot program is initialized.

[0112] Preferably, the step S3 can also be implemented by another preferred implementation as follows, including steps S317-S320, which are specifically as follows:

[0113] S317: Control the controller to reset and power on again, and obtain a resident boot instruction;

[0114] S318: controlling the controller to keep executing the startup boot program within a preset time range according to the resident boot instruction;

[0115] S319: Obtain an erase instruction signal, and according to the erase instruction signal, disable all interrupts of the controller and initialize the peripherals of the controller;

[0116] S320: Erasing the functional test software according to a preset erasing instruction.

[0117] For example, in specific implementation, Fig. 9 A test software destruction diagram is shown. When the boot program is running, a stay boot instruction (Stay InBoot) is set in the interrupt task. According to this instruction, the controller is controlled to keep running in the boot program. In addition, if an erase instruction is received from the host computer, an erase operation is performed. Similarly, after erasing, it is also necessary to verify whether the erasure is successful.

[0118] In this preferred embodiment, step S3 can also ensure that the controller maintains the execution state of the boot program within a specific time through the resident boot instruction and pause mechanism, providing a time window for obtaining the erase instruction, enhancing the flexibility and controllability of the system, and ensuring the security and timeliness of software destruction.

[0119] In summary, compared with the prior art, the above embodiments of the present application have the following beneficial effects: by constructing a firmware image file including a boot program, controller application software and functional test software, and ensuring that the two are independent of each other, the flexibility and security of the system are improved; when the controller is powered on, the execution path can be flexibly selected according to the interrupt instruction, thereby enhancing the controllability and response speed of the system; by defining a variety of destruction conditions, the functional test software can be safely destroyed in different scenarios, avoiding the risk of the controller abnormally entering the test software, while also preventing the leakage of sensitive information, thereby enhancing the confidentiality and security of the system.

[0120] Embodiment 2:

[0121] Please refer to Figure 2 , a controller function test system disclosed in an embodiment of the present invention includes: a burning module M1 and a control module M2;

[0122] The burning module M1 is used to construct a firmware image file and burn the firmware image into the controller; wherein the firmware image file includes: a boot program, a controller application software and a function test software, and the controller application software and the function test software are independent of each other;

[0123] The burning module M1 of this embodiment simplifies the burning process by constructing a firmware image file including a boot program, controller application software and function test software, ensuring that the two software are independent of each other and avoiding mutual interference between the test software and the application software.

[0124] The control module M2 is used to obtain an interrupt instruction when the controller is powered on and start, and control the controller to execute the controller application software or function test software according to the interrupt instruction.

[0125] The control module M2 includes: an identifier setting unit and a judgment execution unit.

[0126] The identifier setting unit is used to obtain an interrupt instruction and set a preset identifier of the controller according to the interrupt instruction;

[0127] The judgment execution unit is used to close all interrupts of the controller and initialize the peripherals of the controller, and execute the functional test software if the preset identifier meets the preset numerical conditions and the validity and integrity checks of the functional test software are passed; otherwise, execute the controller application software.

[0128] The control module M2 of this embodiment introduces a preset identifier mechanism so that the controller can determine whether to execute the functional test software according to specific conditions, thereby increasing the safety and reliability of the operation; at the same time, by turning off interrupts and deinitializing peripherals, the purity of the test environment is ensured and interference factors are reduced.

[0129] The judgment execution unit includes: an application execution subunit.

[0130] The application execution subunit is used to verify the integrity and validity of the controller application software according to a preset verification algorithm, and if the verification passes, execute the controller application software; otherwise, control the controller to return to execute the boot program.

[0131] The application execution subunit of this embodiment ensures the integrity and validity of the controller application software through a strict verification mechanism, avoids system failures caused by software damage or tampering, and enhances stability and security.

[0132] Preferably, in order to avoid the risk of the controller abnormally entering the test software, after the test software completes the test, the present embodiment may further include a test software destruction module M3;

[0133] The test software destruction module M3 is used to destroy the functional test software according to the preset program destruction conditions; wherein the preset program destruction conditions include any one or more combinations of the following: the completion flag of the functional test software is set, the initialization flag of the controller application software is set, the initialization completion flag of the boot program is set, and an erase instruction signal is received.

[0134] The test software destruction module M3 includes: a first flag setting unit, a first restoration unit and an erasing unit.

[0135] The first flag setting unit is used to obtain an interrupt message instruction and set a completion flag of the functional test software according to the interrupt message instruction;

[0136] The first restoration unit is used to disable all interrupts of the controller and initialize the peripherals of the controller if the completion flag of the functional test software meets a preset numerical condition;

[0137] The erasing unit is used to erase the functional test software according to a preset erasing instruction.

[0138] In this embodiment, the test software destruction module M3 ensures the timely destruction of the functional test software after the test is completed by setting the completion flag and detailed erasure process, thereby improving the security and reliability of the system, and also provides feedback on the erasure status for easy monitoring and maintenance.

[0139] Preferably, the test software destruction module M3 may further include: a reset unit, an application initialization unit, a second flag setting unit, a second restoration unit and an erasing unit.

[0140] Wherein, the reset unit is used to control the controller to reset and power on again;

[0141] The application initialization unit is used to initialize the controller application software and obtain the interrupt message instruction;

[0142] The second flag setting unit is used to set the initialization flag of the controller application software according to the interrupt instruction;

[0143] The second restoration unit is used to disable all interrupts of the controller and deinitialize the peripherals of the controller if the initialization flag of the controller application software meets a preset numerical condition;

[0144] The erasing unit is used to erase the functional test software according to a preset erasing instruction.

[0145] In this embodiment, the test software destruction module M3 ensures a pure environment before the application software is started by destroying the functional test software during the initialization of the controller application software, avoids potential safety hazards, and improves the stability and security of the system.

[0146] Preferably, the test software destruction module M3 may further include: a reset unit, a first erasing instruction signal acquiring unit, a third restoring unit and an erasing unit.

[0147] Wherein, the reset unit is used to control the controller to reset and power on again;

[0148] The first erase instruction signal acquisition unit is used to control the controller to execute the controller application software and acquire an erase instruction signal;

[0149] The third restoration unit is used to disable all interrupts of the controller and initialize the peripherals of the controller according to the erase instruction signal;

[0150] The erasing unit is used to erase the functional test software according to a preset erasing instruction.

[0151] In this embodiment, the test software destruction module M3 increases the flexibility and response speed of the system and ensures the timeliness and safety of software destruction by dynamically destroying the functional test software according to external instructions during the operation of the controller application software.

[0152] Preferably, the test software destruction module M3 may further include: a reset unit, a third flag setting unit, a fourth restoration unit and an erasing unit.

[0153] The reset unit is used to control the controller to reset and power on again, so that the controller executes the boot program;

[0154] The third flag setting unit is used to obtain an interrupt message instruction and set an initialization completion flag of the boot program according to the interrupt message instruction;

[0155] The fourth restoring unit is used to disable all interrupts of the controller and deinitialize the peripherals of the controller if the initialization completion flag of the boot program meets a preset numerical condition;

[0156] The erasing unit is used to erase the functional test software according to a preset erasing instruction.

[0157] In this embodiment, the test software destruction module M3 destroys the functional test software after the boot program is initialized, thereby ensuring the security and stability of the system startup process, avoiding unnecessary resource occupation, and improving the overall performance of the system.

[0158] Preferably, the test software destruction module M3 may further include: a resident boot instruction acquisition unit, a boot retention unit, a second erasing instruction signal acquisition unit and an erasing unit.

[0159] The resident boot instruction acquisition unit is used to control the controller to reset and power on again, and acquire the resident boot instruction;

[0160] The maintaining guiding unit is used to control the controller to maintain the execution of the startup guiding program within a preset time range according to the resident guiding instruction;

[0161] The second erase instruction signal acquisition unit is used to acquire an erase instruction signal, and according to the erase instruction signal, turn off all interrupts of the controller and initialize the peripherals of the controller;

[0162] The erasing unit is used to erase the functional test software according to a preset erasing instruction.

[0163] In this embodiment, the test software destruction module M3 ensures that the controller maintains the execution state of the boot program within a specific time through the resident boot instruction and pause mechanism, provides a time window for obtaining the erase instruction, enhances the flexibility and controllability of the system, and ensures the security and timeliness of software destruction.

[0164] In summary, compared with the prior art, the above embodiments of the present application have the following beneficial effects: by constructing a firmware image file including a boot program, controller application software and functional test software, and ensuring that the two are independent of each other, the flexibility and security of the system are improved; when the controller is powered on, the execution path can be flexibly selected according to the interrupt instruction, thereby enhancing the controllability and response speed of the system; by defining a variety of destruction conditions, the functional test software can be safely destroyed in different scenarios, avoiding the risk of the controller abnormally entering the test software, while also preventing the leakage of sensitive information, thereby enhancing the confidentiality and security of the system.

[0165] The specific working process of each module described above can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here. The module division is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system.

[0166] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for functional testing of a controller, characterized in that: include: Constructing a firmware image file and burning the firmware image into the controller; wherein the firmware image file includes: a boot program, a controller application software and a function test software, and the controller application software and the function test software are independent of each other; When the controller is powered on, an interrupt instruction is obtained, and according to the interrupt instruction, the controller is controlled to execute the controller application software or function test software.

2. A controller function testing method as claimed in claim 1, characterized in that: When the controller is powered on and started, an interrupt instruction is obtained, and according to the interrupt instruction, the controller is controlled to execute the controller application software or function test software, including: Obtaining an interrupt instruction, and setting a preset identifier of the controller according to the interrupt instruction; If the preset identifier meets the preset numerical condition and the validity and integrity check of the functional test software passes, all interrupts of the controller are turned off and the peripherals of the controller are initialized, and the functional test software is executed; Otherwise, the controller application software is executed.

3. A controller function testing method as claimed in claim 2, characterized in that: The executing the controller application software comprises: Verifying the integrity and validity of the controller application software according to a preset verification algorithm, and executing the controller application software if the verification passes; Otherwise, the controller is controlled to return to execute the boot program.

4. A controller function testing method as claimed in claim 2, characterized in that: After executing the functional testing software, the method further comprises: Destroy the functional test software according to preset program destruction conditions; wherein the preset program destruction conditions include any one or more of the following combinations: the completion flag of the functional test software is set, the initialization flag of the controller application software is set, the initialization completion flag of the boot program is set, and an erase instruction signal is received.

5. A controller function testing method as claimed in claim 4, characterized in that: Destroying the functional test software according to a preset program destruction condition includes: Obtaining an interrupt message instruction, and setting a completion flag of the functional test software according to the interrupt message instruction; If the completion flag of the functional test software meets the preset numerical condition, all interrupts of the controller are turned off and the peripherals of the controller are initialized; The functional test software is erased according to a preset erase instruction.

6. A controller function testing method as claimed in claim 4, characterized in that: Destroying the functional test software according to a preset program destruction condition includes: Controlling the controller to reset and power on again; Initialize the controller application software and obtain interrupt message instructions; According to the interrupt instruction, setting the initialization flag of the controller application software; If the initialization flag of the controller application software meets the preset numerical condition, all interrupts of the controller are turned off and the peripherals of the controller are initialized; The functional test software is erased according to a preset erase instruction.

7. A controller function testing method as claimed in claim 4, characterized in that: Destroying the functional test software according to a preset program destruction condition includes: Controlling the controller to reset and power on again; Controlling the controller to execute the controller application software and obtain an erase instruction signal; According to the erase instruction signal, shut down all interrupts of the controller and deinitialize the peripherals of the controller; The functional test software is erased according to a preset erase instruction.

8. A controller function testing method as claimed in claim 4, characterized in that: Destroying the functional test software according to a preset program destruction condition includes: Controlling the controller to reset and power on again, so that the controller executes the boot program; Obtaining an interrupt message instruction, and setting an initialization completion flag of the boot program according to the interrupt message instruction; If the initialization completion flag of the boot program meets the preset numerical condition, all interrupts of the controller are turned off and the peripherals of the controller are initialized; The functional test software is erased according to a preset erase instruction.

9. A controller function testing method as claimed in claim 4, characterized in that: Destroying the functional test software according to a preset program destruction condition includes: Control the controller to reset and power on again, and obtain a resident boot instruction; According to the resident boot instruction, controlling the controller to keep executing the startup boot program within a preset time range; Obtaining an erase instruction signal, and according to the erase instruction signal, disabling all interrupts of the controller and deinitializing peripherals of the controller; The functional test software is erased according to a preset erase instruction.

10. A functional test system for a controller, characterized in that: include: Burning module and control module; The burning module is used to construct a firmware image file and burn the firmware image into the controller; the firmware image file includes: a boot program, a controller application software and a function test software, and the controller application software and the function test software are independent of each other; The control module is used to obtain an interrupt instruction when the controller is powered on and start, and control the controller to execute the controller application software or function test software according to the interrupt instruction.