Method for verifying whether upgrade software is successfully started or not and related device

通过在MCU的升级标志区中选取分区可靠性标志位和升级软件的正常执行时长检查,解决了MCU升级后系统异常的问题,提高了升级的可靠性和安全性,确保了MCU升级后的稳定 sex.

CN118963809APending Publication Date: 2024-11-15TIANJIN JINGWEI HIRAIN TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411348284.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

After the MCU is upgraded, the system abnormality caused by the wrong upgrade file and cannot work normally. How to ensure the stability and reliability of the system after the upgrade and reduce the risk of system failure caused by abnormal upgrade file.

Method used

By selecting the partition reliability flag bit in the MCU's upgrade flag area and checking the normal execution time of the upgrade software, we can determine whether the upgrade software is successfully started. If the partition reliability flag is reliable, confirm that the startup is successful. Otherwise, multiple attempts and durations will be performed. Check to ensure partition reliability and avoid abnormal situations and data loss.

Benefits of technology

Improve the reliability and security of the upgrade, reduce the risk of system crash caused by abnormal upgrade files, and ensure the stability and security of the MCU after upgrading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963809A_ABST
    Figure CN118963809A_ABST
Patent Text Reader

Abstract

The invention discloses a method for verifying whether upgrade software is successfully started or not and a related device. The method comprises the steps that firstly, when it is queried that a chip entry address is normally started, a first to-be-started partition is selected, and a partition reliability flag bit of the first to-be-started partition is selected from an upgrading flag area of an MCU; when the partition reliability flag bit is reliable, whether the upgrading software is successfully started or not is checked based on the partition reliability flag bit and the normal execution duration of the upgrading software; when the partition reliability flag bit is unreliable, whether the upgrading software is successfully started or not is checked based on the partition starting frequency of the first partition to be started and the normal execution duration of the upgrading software. According to the application, whether the upgrading software is successfully started or not is verified by detecting the reliability flag bit of the first to-be-started partition, so that the condition of system crash or data loss caused by various abnormal conditions in the upgrading process is avoided, and the upgrading reliability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of MCU technology, and in particular to a method and related device for verifying whether upgraded software has been successfully started. Background Art

[0002] MCU (Microcontroller Unit) is a chip that integrates a processor core, memory, and various input / output interfaces, and is commonly used in embedded systems. It is usually used to control various devices and systems, such as home appliances, automotive electronic systems, industrial automation equipment, etc. MCU has the characteristics of small size, low power consumption, low cost, easy integration and development, so it is widely used in embedded systems. As the product develops during use, it may be found that there are vulnerabilities, errors, performance improvements, product improvements, or communication protocol updates in the MCU firmware. These problems need to be fixed or improved through upgrades to ensure that the safety, stability, and functional performance of the product can keep pace with the times and meet market demand and regulatory requirements.

[0003] In the related technology, when upgrading the MCU, the file to be upgraded needs to be a software that can run normally. After the software is signed to generate an image, it is written to the MCU side, and the MCU side verifies the signature. After the signature is verified, the validity of the upgrade file is not checked, and the software is directly started. When the upgrade file is mistransmitted by the user and the wrong upgrade file is used, when the signature file is made for upgrading, protection cannot be performed, and the upgrade will be directly started after success. This can easily cause the MCU to be abnormal after the upgrade and unable to work normally.

[0004] Therefore, how to ensure the stability and reliability of the system after the MCU is upgraded, while reducing the risk of system failure due to abnormal upgrade files, is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention

[0005] Based on the above problems, the present application provides a verification method and related devices for whether the upgrade software is successfully started, which can ensure the stability and reliability of the system after the MCU is upgraded, while reducing the risk of system failure due to abnormal upgrade files.

[0006] The embodiments of the present application disclose the following technical solutions:

[0007] A method for verifying whether an upgrade software is successfully started, the method comprising:

[0008] In response to the query that the chip entry address is started normally, selecting a first partition to be started, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU;

[0009] Selecting a partition reliability flag of the first partition to be started from the upgrade flag area of ​​the MCU, wherein the reliability flag of the first partition to be started is used to mark whether the first partition to be started is reliable;

[0010] When the partition reliability flag of the first partition to be started is reliable, checking whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software;

[0011] When the partition reliability flag of the first partition to be started is unreliable, it is checked whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software.

[0012] In a possible implementation, when the partition reliability flag of the first partition to be started is reliable, checking whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software includes:

[0013] When the partition reliability flag of the first partition to be started is reliable, rewriting the partition reliability flag of the first partition to be started to unreliable, and starting the upgrade software;

[0014] Calculate the first normal execution time after the upgrade software is started;

[0015] When the first normal execution time is greater than or equal to a preset time, rewriting the partition reliability flag of the first partition to be started as reliable, so as to indicate that the upgrade software is successfully started;

[0016] When the first normal execution time is less than a preset time, the partition reliability flag of the first partition to be started is not rewritten to mark the failure of starting the upgrade software.

[0017] In a possible implementation, the method further includes:

[0018] When the first normal execution time is less than a preset time, the MCU is reset, and the process of checking whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software is performed.

[0019] In a possible implementation, when the partition reliability flag of the first partition to be started is unreliable, checking whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software includes:

[0020] When the partition reliability flag of the first partition to be started is unreliable, checking the number of partition startups of the first partition to be started;

[0021] When the partition startup times of the first partition to be started do not meet the preset times, updating the partition startup times of the first partition to be started to obtain the update times, and starting the upgrade software;

[0022] Calculate the second normal execution time after the upgrade software is started;

[0023] When the second normal execution time is greater than or equal to a preset time, rewriting the partition reliability flag of the first partition to be started to reliable, so as to mark that the upgrade software is successfully started;

[0024] When the second normal execution time is less than the preset time, the partition reliability flag of the first partition to be started is not rewritten to mark the failure of starting the upgrade software.

[0025] In a possible implementation, the method further includes:

[0026] When the partition startup times of the first partition to be started meets the preset times, the MCU is reset and switched to the second partition to be started to verify whether the upgrade software is successfully started.

[0027] In a possible implementation, the method further includes:

[0028] When the second normal execution time is less than the preset time, the MCU is reset, and the process of checking whether the upgrade software is successfully started based on the partition startup times of the first partition to be started and the normal execution time of the upgrade software is performed.

[0029] A device for verifying whether an upgrade software is successfully started, the device comprising:

[0030] A first selection unit, in response to the query of the chip entry address being started normally, is used to select a first partition to be started, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU;

[0031] A second selection unit is used to select a partition reliability flag of the first partition to be started from the upgrade flag area of ​​the MCU, wherein the reliability flag of the first partition to be started is used to mark whether the first partition to be started is reliable;

[0032] a first checking unit, for checking whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software, when the partition reliability flag of the first partition to be started is reliable;

[0033] The second checking unit is used to check whether the upgrade software is successfully started based on the number of partition startup times of the first partition to be started and the normal execution time of the upgrade software when the partition reliability flag of the first partition to be started is unreliable.

[0034] In a possible implementation manner, the first checking unit specifically includes:

[0035] a rewriting startup unit, for rewriting the partition reliability flag bit of the first partition to be started to unreliable when the partition reliability flag bit of the first partition to be started is reliable, and starting the upgrade software;

[0036] A first calculation unit, used to calculate a first normal execution time after the upgrade software is started;

[0037] A first rewriting unit, when the first normal execution time is greater than or equal to a preset time, is used to rewrite the partition reliability flag of the first partition to be started to reliable, so as to indicate that the upgrade software is successfully started;

[0038] The first setting unit is used for not rewriting the partition reliability flag of the first partition to be started when the first normal execution time is less than a preset time, so as to mark the failure of starting the upgrade software.

[0039] A verification device for whether upgraded software is successfully started includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the verification method for whether the upgraded software is successfully started as described above is implemented.

[0040] A computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the verification method as described above to determine whether the upgrade software is successfully started.

[0041] Compared with the prior art, this application has the following beneficial effects:

[0042] The present application provides a verification method and related device for whether the upgrade software is successfully started. Specifically, when executing the verification method for whether the upgrade software is successfully started provided by the embodiment of the present application, first, when the chip entry address is queried and the chip entry address is normally started, the first partition to be started can be selected, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU. Then, the partition reliability flag of the first partition to be started is selected from the upgrade flag area of ​​the MCU, wherein the reliability flag of the first partition to be started is used to mark whether the first partition to be started is reliable. Then, when the partition reliability flag of the first partition to be started is reliable, the upgrade software is checked based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software. Whether the upgrade software is successfully started; when the partition reliability flag of the first partition to be started is unreliable, the upgrade software is checked based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software. By detecting the reliability flag of the first partition to be started, the present application can avoid various abnormal situations that cause system crashes or data loss during the upgrade process, thereby improving the reliability of the upgrade. At the same time, by checking the partition reliability flag to verify whether the upgrade software is successfully started, the reliability of the bootable partition can be evaluated before starting. If the reliability flag is reliable, it means that the partition has been verified to be reliable, reducing the possibility of abnormalities when the upgrade software is started. In addition, since the upgrade software is selected from the upgrade flag area of ​​the MCU, it can avoid using the wrong upgrade file to upgrade the MCU, thereby improving the security of the upgrade. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0044] Figure 1a A method flow chart of a method for verifying whether an upgrade software is successfully started provided in an embodiment of the present application;

[0045] Figure 1b A method for checking whether the upgraded software is successfully started is provided in an embodiment of the present application;

[0046] Figure 1c Another method for checking whether the upgraded software is successfully started is provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of the structure of a verification device for determining whether an upgrade software is successfully started provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] To facilitate understanding of the technical solutions provided by the embodiments of the present application, the background technology involved in the embodiments of the present application will be described below.

[0049] MCU (Microcontroller Unit) is a chip that integrates a processor core, memory, and various input / output interfaces, and is commonly used in embedded systems. It is usually used to control various devices and systems, such as home appliances, automotive electronic systems, industrial automation equipment, etc. MCU has the characteristics of small size, low power consumption, low cost, easy integration and development, so it is widely used in embedded systems.

[0050] As the product develops during use, it may be found that there are vulnerabilities, errors, performance improvements, product improvements or communication protocol updates in the MCU firmware. These problems need to be repaired or improved through upgrades to ensure that the security, stability and functional performance of the product can keep pace with the times and meet market demand and regulatory requirements.

[0051] When upgrading the MCU, the file to be upgraded needs to be a software that can run normally, and the software needs to be signed to generate an image before being flashed to the MCU. After receiving the upgrade file, the MCU will verify the signature to verify the legitimacy of the signature. If the signature verification passes, the MCU will not check the validity of the upgrade file, but will directly start the software. However, when the upgrade file is mistransmitted by the user, the wrong upgrade file is used, and a forged signature file is created for the upgrade, since no validity check is performed, even if the upgrade is successful, the MCU may become abnormal after the upgrade and fail to work properly.

[0052] In order to solve this problem, an embodiment of the present application provides a verification method and related device for whether the upgrade software is successfully started. First, when the chip entry address is queried and the chip is started normally, the first partition to be started is selected. Then the partition reliability flag of the first partition to be started is selected from the upgrade flag area of ​​the MCU. Then, when the partition reliability flag of the first partition to be started is reliable, the upgrade software is checked to see whether it is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software; when the partition reliability flag of the first partition to be started is unreliable, the upgrade software is checked to see whether it is successfully started based on the number of partition starts of the first partition to be started and the normal execution time of the upgrade software. The present application verifies whether the upgrade software is successfully started by detecting the reliability flag of the first partition to be started, which can avoid various abnormal situations during the upgrade process that cause system crashes or data loss, thereby improving the reliability of the upgrade. At the same time, by checking the partition reliability flag, the reliability of the partition to be started can be evaluated before starting. If the reliability flag is reliable, it means that the partition has been verified to be reliable, which reduces the possibility of abnormalities when the upgrade software is started. In addition, since the upgrade software is selected from the upgrade mark area of ​​the MCU, it is possible to avoid using an incorrect upgrade file to upgrade the MCU, thereby improving the security of the upgrade.

[0053] 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 application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] See also Figure 1a , which is a flow chart of a method for verifying whether the upgrade software is successfully started provided by an embodiment of the present application, such as Figure 1a As shown, the verification method of whether the upgrade software is successfully started may include steps S101-S104:

[0055] S101: In response to querying that the chip entry address is started normally, selecting a first partition to be started.

[0056] The first partition to be started is used to start the upgrade software of the microcontroller unit MCU.

[0057] First, the system will query to ensure that the entry address of the chip can be started normally. This is the first step of system startup and a prerequisite for ensuring that the MCU upgrade process can proceed smoothly. At the same time, there may be multiple spare upgrade partitions during the MCU upgrade process, and the system will select the first partition to be started. This partition is selected because it will be used to start the MCU upgrade software, that is, the new version of the firmware program. The first partition to be started is selected to determine where to start the upgrade software, which is a key step in the upgrade process.

[0058] The purpose of this step is to ensure a good starting point and correct upgrade partitions during the MCU upgrade process to ensure the smooth progress of the upgrade process and the stability of the system.

[0059] Optionally, the upgrade partition of the MCU may include but is not limited to a first partition to be started and a second partition to be started. The second partition to be started is a standby upgrade partition.

[0060] S102: Selecting a partition reliability flag of the first partition to be started from the upgrade flag area of ​​the MCU.

[0061] The reliability flag of the first partition to be started is used to mark whether the first partition to be started is reliable.

[0062] Among multiple available upgrade partitions, the first partition to be started is selected, and the partition is used to start the upgrade software of the microcontroller unit MCU. The reliability flag of the first partition to be started is obtained from the upgrade flag area of ​​the MCU to mark whether the partition is reliable.

[0063] The partition reliability flag of the first partition to be started is selected in the upgrade flag area of ​​the MCU to mark the reliability of the first partition to be started. The function of this flag is to indicate which partition the system should load first when starting up to ensure that the system can start from the partition with higher reliability. If the reliability flag of the first partition to be started is set to "reliable", the system will select this partition as the boot partition; otherwise, if it is set to "unreliable", the system may select other partitions for startup.

[0064] It should be noted that if the first partition to be started has not successfully started the MCU's upgrade software when starting the current upgrade software, the first partition to be started flag will be set to unreliable; if the first partition to be started has successfully started the MCU's upgrade software when starting the current upgrade software, the first partition to be started flag will be set to reliable.

[0065] Reasons for selecting the reliability flag of the first partition to be started:

[0066] (1) Boot sequence control: By setting the reliability flag, the system can be controlled to give priority to partitions with higher reliability during startup, thereby improving the stability and reliability of the system.

[0067] (2) Fault recovery: If a system failure occurs during the startup process, the reliability flag can be set to specify the backup partition as the boot partition, thereby achieving fault recovery and system self-healing.

[0068] (3) System security: Selecting a partition with higher reliability as the boot partition can reduce the possibility of the system encountering abnormal situations and improve system security.

[0069] Therefore, the partition reliability flag of the first partition to be started is selected from the upgrade flag area of ​​the MCU to determine which partition to load when the system starts, so as to ensure that the system can start and run normally in the most reliable way.

[0070] S103: When the partition reliability flag of the first partition to be started is reliable, check whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software.

[0071] The first partition to be started is considered a reliable partition, and the system should try to start from this partition first. The setting of the reliability flag is usually based on some reliability evaluation indicators, such as the stability of the storage medium where the partition is located, data integrity, etc. The partition reliability flag is used to instruct the system to select a reliable partition for startup. Therefore, when the reliability flag is set to reliable, the system will give priority to this partition for startup to improve the stability and reliability of the system.

[0072] At the same time, during the startup process, the system will monitor the execution time of the upgrade software. The normal execution time refers to the expected time range required for the upgrade software to start up. If the upgrade software is successfully executed within a reasonable time range, that is, the expected normal execution time is reached, the system can consider that the upgrade software has been successfully started. By checking the normal execution time of the upgrade software, it can be ensured that the upgrade software is started within a reasonable time and no abnormalities or errors occur.

[0073] See also Figure 1b A method for checking whether the upgrade software is successfully started is provided in an embodiment of the present application. Accordingly, when the partition reliability flag of the first partition to be started is reliable, checking whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software includes A1-A4:

[0074] A1: When the partition reliability flag of the first partition to be started is reliable, rewrite the partition reliability flag of the first partition to be started to unreliable, and start the upgrade software.

[0075] When the partition reliability flag of the first partition to be started is reliable, the system will perform the following steps to check whether the upgrade software is successfully started: first, rewrite the partition reliability flag of the first partition to be started to unreliable, indicating that the partition is currently unreliable. Then, start the upgrade software and try to execute it on the first partition to be started.

[0076] A2: Calculate the first normal execution time after the upgrade software is started.

[0077] Once the upgrade software is successfully started in the first partition to be started, the system will start recording the normal execution time of the upgrade software, that is, the time from startup to normal execution completion.

[0078] By calculating the normal execution time, the system can evaluate the running status of the upgrade software. If the first normal execution time reaches or exceeds the preset time requirement, it can be inferred that the upgrade software runs successfully and reliably on the first partition to be started. On the contrary, if the first normal execution time does not reach the preset requirement, it may indicate that there is a problem or instability in starting the upgrade software on the partition.

[0079] A3: When the first normal execution time is greater than or equal to a preset time, rewrite the partition reliability flag of the first partition to be started as reliable to indicate that the upgrade software is successfully started.

[0080] If the first normal execution time of the upgrade software reaches or exceeds the preset time, the system will rewrite the partition reliability flag of the first partition to be started as reliable, indicating that the upgrade software is successfully started on the partition.

[0081] Optionally, the preset duration may be, but is not limited to, 3 seconds. The user may adjust the preset duration according to actual needs, and this application does not impose any specific restrictions on the preset duration.

[0082] After the upgrade is successful, the reliability flag corresponding to the current running partition is changed to reliable (true), which effectively protects the system from the impact of erroneous upgrade files and improves the stability and credibility of the system.

[0083] In a possible implementation, the method further includes:

[0084] When the first normal execution time is less than a preset time, the MCU is reset, and the process of checking whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software is performed.

[0085] In order to deal with the situation that the upgrade software does not start correctly or an abnormality occurs, the system will reset the MCU, that is, restart the MCU, in the hope that the problem can be solved after the restart. At the same time, the system will check again whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software. Through multiple startup attempts and time checks, the system can determine the startup status of the upgrade software and take further processing measures.

[0086] In the event that the upgrade software does not start correctly or an exception occurs, the system does not directly check whether the upgrade software has started successfully, but instead performs corresponding reliability checks and startup frequency controls, and takes measures such as hard reset when necessary to avoid the system from not being able to operate normally due to upgrade file exceptions.

[0087] A4: When the first normal execution time is less than a preset time, the partition reliability flag of the first partition to be started is not rewritten to mark the failure of starting the upgrade software.

[0088] If the first normal execution time of the upgrade software does not reach the preset time, the system will not rewrite the partition reliability flag of the first partition to be started, and the partition reliability flag of the first partition to be started will still be unreliable, indicating that the startup of the upgrade software has failed.

[0089] S104: When the partition reliability flag of the first partition to be started is unreliable, check whether the upgrade software is successfully started based on the partition startup times of the first partition to be started and the normal execution time of the upgrade software.

[0090] During the MCU upgrade process, when the reliability flag of the first partition to be started is unreliable, it means that there may be some problems or abnormalities in the partition, which may cause the upgrade software to fail to start normally. In order to determine whether the upgrade software is successfully started, the system will check the number of partition startups of the first partition to be started and the execution time of the upgrade software. By recording the number of partition startups and monitoring the execution time of the upgrade software, the system can evaluate the startup status of the upgrade software.

[0091] See also Figure 1cAnother method for checking whether the upgrade software is successfully started is provided in an embodiment of the present application. Accordingly, when the partition reliability flag of the first partition to be started is unreliable, checking whether the upgrade software is successfully started based on the partition startup number of the first partition to be started and the normal execution time of the upgrade software includes B1-B5:

[0092] B1: When the partition reliability flag of the first partition to be started is unreliable, check the partition startup times of the first partition to be started.

[0093] When the partition reliability flag of the first partition to be started is unreliable, the system will monitor the number of times the partition attempts to start. If the number of startups of the partition reaches the preset number requirement, the system will continue to proceed to the subsequent steps to check the startup status of the upgrade software. If the number of startups does not meet the preset requirement, the system may update the number of startups and continue to monitor in order to subsequently determine the startup status of the upgrade software.

[0094] It should be noted that the default number of partition startups for a newly upgraded partition that has never been started is 3.

[0095] B2: When the partition startup times of the first partition to be started does not meet the preset times, the partition startup times of the first partition to be started are updated to obtain the update times, and the upgrade software is started.

[0096] If the partition boot count of the first partition to be booted does not meet the preset count requirement, the system will update the boot count, that is, increase the current boot count. The purpose of this is to ensure that the system can accurately track the partition boot status and perform subsequent steps to start the upgrade software after reaching the preset count.

[0097] Optionally, the preset number of times may be, but is not limited to, 0. The user may adjust the size of the preset number of times according to actual conditions, and the present application does not impose any specific restrictions on the size of the preset number of times.

[0098] In a possible implementation, updating the partition startup times of the first partition to be started, and obtaining the update times means: reducing the partition startup times of the first partition to be started by one.

[0099] B3: Calculate the second normal execution time after the upgrade software is started.

[0100] Once the upgrade software is successfully started in the first partition to be started, the system will start recording the normal execution time of the upgrade software, that is, the time from startup to normal execution completion.

[0101] By calculating the normal execution time, the system can evaluate the running status of the upgrade software. If the second normal execution time reaches or exceeds the preset time requirement, it can be inferred that the upgrade software runs successfully and reliably on the first partition to be started. On the contrary, if the second normal execution time does not reach the preset requirement, it may indicate that there is a problem or instability in starting the upgrade software on the partition.

[0102] B4: When the second normal execution time is greater than or equal to a preset time, rewrite the partition reliability flag of the first partition to be started as reliable to indicate that the upgrade software is successfully started.

[0103] If the second normal execution time of the upgrade software reaches or exceeds the preset time, the system will rewrite the partition reliability flag of the first partition to be started as reliable, indicating that the upgrade software is successfully started on the partition.

[0104] B5: When the second normal execution time is less than the preset time, the partition reliability flag of the first partition to be started is not rewritten to mark the failure of starting the upgrade software.

[0105] If the second normal execution time of the upgrade software does not reach the preset time, the system will not rewrite the partition reliability flag of the first partition to be started, and the partition reliability flag of the first partition to be started will still be unreliable, indicating that the startup of the upgrade software has failed.

[0106] The purpose of the above steps is to determine whether the upgrade software is successfully started by checking the number of partition startups, calculating the execution time, and rewriting the partition reliability flag. If the software can run normally within the preset number of startups and execution time, then the partition will be considered reliable. Otherwise, the partition will remain unreliable, indicating that the upgrade software failed to start.

[0107] In a possible implementation, the method further includes:

[0108] When the partition startup times of the first partition to be started meets the preset times, the MCU is reset and switched to the second partition to be started to verify whether the upgrade software is successfully started.

[0109] If the number of boot times reaches the preset number, it is considered that the partition to be booted has tried to boot multiple times and failed, and the partition program software is abnormal. It will automatically switch to another partition for booting and reset the MCU to prevent the MCU from becoming a brick after the upgrade.

[0110] Compared with traditional MCU software upgrade solutions, it can avoid the misuse of the original upgrade file. Even if the upgrade file is abnormal, the MCU will not execute the partition by default, and will automatically switch to another available partition after partition reliability check. The dual-partition design also ensures that the MCU always has one partition available to avoid the chip being flashed during the upgrade.

[0111] In a possible implementation, the method further includes:

[0112] When the second normal execution time is less than the preset time, the MCU is reset, and the process of checking whether the upgrade software is successfully started based on the partition startup times of the first partition to be started and the normal execution time of the upgrade software is performed.

[0113] Based on the contents of S101-S104, it can be known that when the chip entry address is queried and the system starts normally, the first partition to be started is selected. Then, the partition reliability flag of the first partition to be started is selected from the upgrade flag area of ​​the MCU. Finally, when the partition reliability flag of the first partition to be started is reliable, the upgrade software is checked to see whether it is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software; when the partition reliability flag of the first partition to be started is unreliable, the upgrade software is checked to see whether it is successfully started based on the number of partition starts of the first partition to be started and the normal execution time of the upgrade software. This application verifies whether the upgrade software is successfully started by detecting the reliability flag of the first partition to be started, which can avoid various abnormal situations during the upgrade process that cause system crashes or data loss, thereby improving the reliability of the upgrade. At the same time, by checking the partition reliability flag, the reliability of the partition to be started can be evaluated before starting. If the reliability flag is reliable, it means that the partition has been verified to be reliable, which reduces the possibility of abnormalities when the upgrade software is started. In addition, since the upgrade software is selected from the upgrade mark area of ​​the MCU, it is possible to avoid using an incorrect upgrade file to upgrade the MCU, thereby improving the security of the upgrade.

[0114] See also Figure 2 , Figure 2 A schematic diagram of a structure of a verification device for whether the upgrade software is successfully started provided in an embodiment of the present application. Figure 2 As shown, the verification device for whether the upgrade software is successfully started includes:

[0115] A first selection unit 201, in response to the query of the chip entry address being started normally, is used to select a first partition to be started, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU;

[0116] A second selection unit 202 is used to select a partition reliability flag of a first partition to be started from the upgrade flag area of ​​the MCU, wherein the reliability flag of the first partition to be started is used to mark whether the first partition to be started is reliable;

[0117] A first checking unit 203, when the partition reliability flag of the first partition to be started is reliable, is used to check whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software;

[0118] The second checking unit 204 is used to check whether the upgrade software is successfully started based on the partition startup times of the first partition to be started and the normal execution time of the upgrade software when the partition reliability flag of the first partition to be started is unreliable.

[0119] In a possible implementation, the first checking unit 203 specifically includes:

[0120] a rewriting startup unit, for rewriting the partition reliability flag bit of the first partition to be started to unreliable when the partition reliability flag bit of the first partition to be started is reliable, and starting the upgrade software;

[0121] A first calculation unit, used to calculate a first normal execution time after the upgrade software is started;

[0122] A first rewriting unit, when the first normal execution time is greater than or equal to a preset time, is used to rewrite the partition reliability flag of the first partition to be started to reliable, so as to indicate that the upgrade software is successfully started;

[0123] The first setting unit is used for not rewriting the partition reliability flag of the first partition to be started when the first normal execution time is less than a preset time, so as to mark the failure of starting the upgrade software.

[0124] In a possible implementation manner, the device further includes:

[0125] The first reset execution unit is used to reset the MCU when the first normal execution time is less than a preset time, and to check whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software.

[0126] In a possible implementation, the second checking unit 204 specifically includes:

[0127] A third checking unit, configured to check the number of partition startups of the first partition to be started when the partition reliability flag of the first partition to be started is unreliable;

[0128] An update startup unit, when the partition startup number of the first partition to be started does not meet the preset number, is used to update the partition startup number of the first partition to be started, obtain the update number, and start the upgrade software;

[0129] A second calculation unit, used to calculate a second normal execution time after the upgrade software is started;

[0130] A second rewriting unit, when the second normal execution time is greater than or equal to a preset time, is used to rewrite the partition reliability flag of the first partition to be started to reliable, so as to indicate that the upgrade software is successfully started;

[0131] The second setting unit is used for not rewriting the partition reliability flag of the first partition to be started when the second normal execution time is less than a preset time, so as to mark the failure of starting the upgrade software.

[0132] In a possible implementation manner, the device further includes:

[0133] The reset switching unit is used to reset the MCU and switch to the second partition to be started to verify whether the upgrade software is successfully started when the partition startup times of the first partition to be started meet the preset times.

[0134] In a possible implementation manner, the device further includes:

[0135] The second reset execution unit is used to reset the MCU when the second normal execution time is less than the preset time, and execute the check whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software.

[0136] In addition, an embodiment of the present application also provides a verification device for whether the upgrade software is successfully started, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the verification method for whether the upgrade software is successfully started as described above is implemented.

[0137] In addition, an embodiment of the present application further provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes the verification method as described above to determine whether the upgrade software is successfully started.

[0138] The embodiment of the present application provides a verification device for whether the upgrade software is successfully started. First, when the chip entry address is queried and the startup is normal, the first partition to be started is selected based on the first selection unit 301, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU, and the partition reliability flag of the first partition to be started is selected from the upgrade flag area of ​​the MCU based on the second selection unit 302, wherein the reliability flag of the first partition to be started is used to mark whether the first partition to be started is reliable. When the partition reliability flag of the first partition to be started is reliable, the first inspection unit 303 checks whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software. When the partition reliability flag of the first partition to be started is unreliable, the second inspection unit 304 checks whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software. The present application uses the reliability flag to detect the partition to be started to verify whether the upgrade software is successfully started, so as to avoid abnormal situations in the upgrade process that cause system crashes or data loss, and improves the reliability and security of the upgrade by evaluating the partition reliability and avoiding the use of incorrect upgrade files.

[0139] The above is a detailed introduction to a verification method for whether an upgrade software is successfully started and related devices provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

[0140] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0141] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0142] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for verifying whether an upgraded software is successfully started, characterized in that: The method comprises: In response to querying that the chip entry address is normally started, selecting a first partition to be started, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU; Selecting a partition reliability flag of a first partition to be started from the upgrade flag area of ​​the MCU, wherein the reliability flag of the first partition to be started is used to indicate whether the first partition to be started is reliable; When the partition reliability flag of the first partition to be started is reliable, checking whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software; When the partition reliability flag of the first partition to be started is unreliable, whether the upgrade software is successfully started is checked based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software.

2. The method according to claim 1, characterized in that When the partition reliability flag of the first partition to be started is reliable, checking whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and the normal execution time of the upgrade software includes: When the partition reliability flag of the first partition to be started is reliable, rewriting the partition reliability flag of the first partition to be started to unreliable, and starting the upgrade software; Calculating the first normal execution time of the upgrade software after startup; When the first normal execution time is greater than or equal to a preset time, rewriting the partition reliability flag of the first partition to be started to reliable, so as to indicate that the upgrade software is successfully started; When the first normal execution time is less than a preset time, the partition reliability flag of the first partition to be started is not rewritten to indicate that the startup of the upgrade software has failed.

3. The method according to claim 2, characterized in that The method further comprises: When the first normal execution time is less than a preset time, the MCU is reset, and the process of checking whether the upgrade software is successfully started is performed based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software.

4. The method according to claim 1, wherein When the partition reliability flag of the first partition to be started is unreliable, checking whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software includes: When the partition reliability flag of the first partition to be started is unreliable, checking the number of partition startups of the first partition to be started; When the partition startup count of the first partition to be started does not meet the preset count, updating the partition startup count of the first partition to be started to obtain an update count, and starting the upgrade software; Calculating the second normal execution time after the upgrade software is started; When the second normal execution time is greater than or equal to a preset time, rewriting the partition reliability flag of the first partition to be started to reliable, so as to indicate that the upgrade software is successfully started; When the second normal execution time is less than the preset time, the partition reliability flag of the first partition to be started is not rewritten to indicate that the startup of the upgrade software has failed.

5. The method according to claim 4, characterized in that The method further comprises: When the partition startup times of the first partition to be started meets the preset times, the MCU is reset and the second partition to be started is switched to verify whether the upgrade software is successfully started.

6. The method according to claim 4, characterized in that The method further comprises: When the second normal execution time is less than the preset time, the MCU is reset, and the process of checking whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software is executed.

7. A device for verifying whether the upgraded software is started successfully, characterized in that: The device comprises: A first selection unit, in response to querying that the chip entry address is normally started, is used to select a first partition to be started, wherein the first partition to be started is used to start the upgrade software of the microcontroller unit MCU; A second selection unit is configured to select a partition reliability flag of a first partition to be started from the upgrade flag area of ​​the MCU, wherein the reliability flag of the first partition to be started is used to indicate whether the first partition to be started is reliable; a first checking unit, configured to check whether the upgrade software is successfully started based on the partition reliability flag of the first partition to be started and a normal execution time of the upgrade software when the partition reliability flag of the first partition to be started is reliable; The second checking unit is configured to check whether the upgrade software is successfully started based on the number of partition startups of the first partition to be started and the normal execution time of the upgrade software when the partition reliability flag of the first partition to be started is unreliable.

8. The device according to claim 7, characterized in that The first inspection unit specifically includes: a rewriting startup unit, configured to rewrite the partition reliability flag of the first partition to be started to unreliable when the partition reliability flag of the first partition to be started is reliable, and start the upgrade software; A first calculation unit, configured to calculate a first normal execution time after the upgrade software is started; a first rewriting unit, configured to rewrite the partition reliability flag of the first partition to be started to reliable when the first normal execution time is greater than or equal to a preset time, so as to indicate that the upgrade software is successfully started; The first setting unit is configured to not rewrite the partition reliability flag of the first partition to be started when the first normal execution time is less than a preset time, so as to mark the startup failure of the upgrade software.

9. A device for verifying whether the upgraded software is successfully started, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for verifying whether the upgrade software is successfully started according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on the terminal device, the terminal device executes the method for verifying whether the upgrade software is successfully started according to any one of claims 1 to 6.

Citation Information

Cited By

  • Software flashing verification method and device, storage medium, controller and vehicle

    CN120196348A