Program upgrading method, electronic device, storage medium and program product
Through the second chip monitoring and automatic switching of the first program in the electronic device, the system damage caused by emergencies during the online upgrade process is solved, the reliability of the equipment and the accuracy of the upgrade process are improved, automatic upgrade and switching without user intervention is achieved, and a rapid fallback solution is provided, reducing maintenance costs.
Patent Information
- Application Number
- CN202411334980.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-09-24
AI Technical Summary
During the online upgrade of electronic devices, emergencies (such as sudden power outages) can easily cause system damage, and the existing technology performs partition switching through external commands, increasing the instability of equipment operation.
The second chip monitors the operating status of the first program in real time, automatically detects operation abnormalities, and sends a reset signal to the first chip to realize automatic zone cutting and ensures stable operation of the program.
It improves the reliability of electronic equipment and the accuracy of the upgrade process, reduces the possibility of human operation errors, realizes automatic upgrades and switching without user intervention, and provides a fast backoff solution, reducing maintenance costs.
Smart Images

Figure CN118860748B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of program upgrade, and in particular to a program upgrade method, electronic equipment, storage medium and program product. Background Art
[0002] As electronic devices (such as embedded devices) become more powerful and their systems become larger, the amount of data required to download for online upgrades is increasing, the time required for upgrades is increasing, and the device system is being updated more frequently. During the upgrade process of the device system, unexpected events (such as sudden power outages) can easily damage the electronic device system and make it unusable.
[0003] The related technology uses a dual partition method to upgrade the program. When a program needs to be upgraded, the upgrade data is downloaded to the currently unused partition level, and the upgrade is performed in the partition. After the upgrade, when switching to the upgraded program or switching to other partitions, external commands are required to switch. However, the external command may come from an untrusted source, and switching zones through external commands will increase the instability of the operation of the electronic device. Summary of the invention
[0004] The main purpose of this application is to provide a program upgrade method, electronic device, storage medium and program product, which can monitor the running status of the first program in the first partition through the second chip, realize automatic zone switching based on the running status, ensure the stable operation of the program, and improve the reliability of the electronic device.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a program upgrade method, which is applied to an electronic device including a first chip and a second chip; the program upgrade method includes: in response to not receiving a program running signal sent by a first program in a first partition within a first preset time period, the second chip generates exception information and sends a reset signal to the first chip; wherein the first program is run by the first chip; in response to the reset signal, the first chip is reset and reads the exception information of the second chip; in response to the exception information indicating that the first program runs abnormally, the first chip runs the second program in the second partition; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program.
[0007] According to the above-mentioned technical means, the running status of the first program can be monitored in real time through the second chip to ensure the stable operation of the first program. Once a problem with the operation of the first program is detected, the first chip can be notified to quickly switch back to the second partition which is running stably. The automated monitoring and switching process of the program running process reduces the possibility of human operation errors and improves the accuracy of the upgrade process. The user does not need to intervene in the upgrade process, and the upgrade and switching can be automatically completed without disturbing the user. At the same time, automated monitoring provides a quick rollback solution when an error occurs during the operation of the upgraded program. There is no need for technical personnel to control the electronic equipment at all times, which reduces the need for electronic equipment maintenance and reduces maintenance costs.
[0008] In the above scheme, the program upgrade method also includes: in response to the completion of the update of the first program in the first partition, the first boot program of the first partition verifies the first program to obtain a verification result; in response to the verification result indicating that the first program meets the running conditions, the first chip runs the first program; from the start of the running of the first program, the first program sends a program running signal to the second chip every second preset time period; wherein the second preset time period is less than or equal to the first preset time period.
[0009] According to the above-mentioned technical means, after the first program is updated, the first program is verified through the first boot program to ensure that the first program is in good condition and the operating environment is safe and reliable, which helps to reduce the risks during the operation of the first program and reduce potential problems and anomalies of the first program, and can also improve the security and reliability of the startup of the first program.
[0010] In the above scheme, the first chip is reset in response to a reset signal and reads the exception information of the second chip, including: the first chip is reset in response to the reset signal and runs the first boot program of the first partition; in response to the running of the first boot program, the first boot program reads the exception information; correspondingly, in response to the exception information indicating that the first program runs abnormally, the first chip runs the second program in the second partition, including: in response to the exception information indicating that the first program runs abnormally, the first boot program generates a zone cutting instruction and sends the zone cutting instruction to the first chip; the first chip runs the second program in the second partition in response to the zone cutting instruction.
[0011] According to the above-mentioned technical means, the application's fallback strategy can be implemented through the first boot program, which can ensure that there is always a version of the application in the electronic device that can run. Any problems during the update process will not cause the application to be unusable, thereby ensuring the smooth use of the electronic device and will not encounter interruptions in use or missing functions due to errors in the updated application.
[0012] In the above solution, the program upgrade method further includes: in response to the abnormal information indicating that the first program has no abnormality, the first chip runs the first program.
[0013] According to the above technical means, if there is no problem with the first program, the first program continues to run after the chip is reset, thereby reducing the probability that the electronic device fails to use the new version of the application program that runs normally due to errors in other hardware. When there is no abnormality in the updated application program, the electronic device can always use the new version of the application program, ensuring that users can continue to use the latest functions, providing users with a faster and smoother application experience.
[0014] In the above scheme, the program upgrade method also includes: in response to the existence of upgrade data of the application, the first chip saves the upgrade data to the first partition, and updates the application based on the upgrade data to obtain the first program; in response to the completion of the update of the first program in the first partition, the first chip sends an initialization instruction to the first boot program of the first partition; the first boot program performs program initialization settings in response to the initialization instruction to obtain an initialization result; the first chip runs the first program or the second program based on the initialization result.
[0015] According to the above technical means, before running the application, the first boot program will be initialized first, so that the first boot program is in a stable and available state, providing necessary hardware support for the subsequent operation of the application, which not only provides basic guarantees for the stable operation of the application, but also can improve the security and reliability of the application operation.
[0016] In the above solution, the program upgrade method further includes: the first chip obtains the initialization result of the first boot program after a third preset time period after sending the initialization instruction.
[0017] In the above scheme, based on the initialization result, running the first program or the second program includes: in response to the initialization result indicating that the program initialization setting is unsuccessful or the initialization result is not obtained after the third preset time period, the first chip performs a reset operation and runs the second program in the second partition; in response to the initialization result indicating that the program initialization setting is successful, the first chip runs the first program.
[0018] According to the above-mentioned technical means, the first chip will monitor the initialization result of the first boot program. If the first boot program is not initialized successfully, it means that the first program has an error in running, and it will switch to the second program that runs stably, ensuring that there is always a version of the application in the electronic device that can run. Any problems during the update process will not cause the application to be unusable, ensuring the smooth use of the electronic device.
[0019] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a memory for storing executable instructions; a second chip for executing the executable instructions stored in the memory, in response to not receiving a program running signal sent by a first program in a first partition within a first preset time period, generating exception information and sending a reset signal to the first chip; wherein the first program is run by the first chip; the first chip, when executing the executable instructions stored in the memory, is reset in response to the reset signal and reads the exception information of the second chip; in response to the exception information indicating that the first program is running abnormally, running the second program in the second partition; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program.
[0020] According to the above-mentioned technical means, the running status of the first program can be monitored in real time through the second chip to ensure the stable operation of the first program. Once a problem with the operation of the first program is detected, the first chip can be notified to quickly switch back to the second partition which is running stably. The automated monitoring and switching process of the program running process reduces the possibility of human operation errors and improves the accuracy of the upgrade process. The user does not need to intervene in the upgrade process, and the upgrade and switching can be completed automatically without disturbing the user. At the same time, automated monitoring provides a quick rollback solution when an error occurs during the operation of the upgraded program. There is no need for technical personnel to control the electronic equipment at all times, which reduces the need for electronic equipment maintenance and reduces maintenance costs.
[0021] In a third aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned program upgrade method are implemented.
[0022] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in the above-mentioned program upgrade method.
[0023] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application. 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.
[0025] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0026] Figure 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0027] Figure 2 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 1 ;
[0028] Figure 3 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 2 ;
[0029] Figure 4 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 3 ;
[0030] Figure 5 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 4 ;
[0031] Figure 6 It is a dual-partition operation architecture diagram provided in an embodiment of the present application;
[0032] Figure 7 It is a flowchart of a dual-zone automatic switching method provided in an embodiment of the present application;
[0033] Figure 8 It is an interactive schematic diagram of the dual-partition automatic switching method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0035] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in this application are only for the purpose of describing this embodiment and are not intended to limit this application.
[0036] In the following description, references to “some embodiments,” “this embodiment,” “this embodiment,” and examples, etc., describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
[0037] If similar descriptions of "first / second" appear in the application documents, the following instructions are added. In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the present embodiment described here can be implemented in an order other than that illustrated or described here.
[0038] In the embodiments of the present application, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, object A and / or object B may represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0039] At present, with the development of intelligent and networked automobiles, the Over-the-Air Technology (OTA) function has become an inevitable trend in the development of intelligent networked automobiles. OTA is a standard software upgrade method provided by the Android system and a technology for remote management through mobile communication networks. With the rapid development of existing automotive electronic equipment, the application of OTA remote upgrades of the software of various controllers in automobiles is becoming more and more widespread, which can effectively solve the functional and safety-related problems caused by software, realize functional iteration, and improve customer experience and satisfaction. When upgrading control components that are closely related to vehicle driving, such as the automotive power system and chassis system, how to ensure the success rate of the upgrade and reduce the upgrade time is the key to OTA upgrades.
[0040] The related technology implements OTA upgrade through dual partitions, downloads the software to the backup partition by reading the partition information, and then switches the partitions to achieve the upgrade.
[0041] However, the related art is to download the upgrade data to the currently unused partition level when a program needs to be upgraded, and upgrade the partition. When switching to the upgraded program or switching to other partitions after the upgrade, it is necessary to switch through external commands.
[0042] However, external commands may come from untrusted sources, and switching partitions through external commands will increase the instability of the operation of electronic devices. In addition, switching partitions through external commands may cause program instability or startup failure due to operational errors.
[0043] Based on the above problems, an embodiment of the present application provides a program upgrade method, in which the electronic device has dual storage partitions, one of the dual partitions contains an old version of the program that can run stably, and the other partition contains an updated new version. The updated program running in the electronic device can be detected by a system basis chip (SBC, System Basis Chip) in the electronic device, and automatic zone switching is implemented based on the running status of the program, thereby ensuring that the electronic device always has a program running stably, thereby improving the reliability of the electronic device.
[0044] Therefore, in order to solve the problems existing in the related technology, the applicant proposes that the second chip can periodically receive the program running signal sent by the first program in the first partition. When the program running signal is not received within the first preset time period, exception information is generated and a reset signal is sent to the first chip. The first chip is reset in response to the reset signal and reads the exception information of the second chip. If the exception information indicates that the first program is running abnormally, the second program in the second partition is run.
[0045] In this way, the embodiment of the present application can monitor the running status of the first program in real time through the second chip to ensure the stable operation of the first program. Once a problem with the operation of the first program is detected, the first chip can be notified to quickly switch back to the second partition that is running stably. The automated monitoring and switching process of the program running process reduces the possibility of human operation errors and improves the accuracy of the upgrade process. The user does not need to intervene in the upgrade process, and the upgrade and switching can be automatically completed without disturbing the user. At the same time, automated monitoring provides a quick rollback solution when an error occurs during the operation of the upgraded program. There is no need for technical personnel to constantly control the electronic equipment, which reduces the need for electronic equipment maintenance and reduces maintenance costs.
[0046] Through the program upgrade method of the embodiment of the present application, the second chip can not only monitor the running status of the application in real time to ensure stable operation of the system; it can also record the running information during the application upgrade and operation process, which is helpful for fault diagnosis and problem troubleshooting; it can also dynamically adjust the running configuration (for example, switching partitions) according to the monitored running status of the application to adapt to different operating environments, so as to improve the stability and safety of the operation of the electronic device.
[0047] The electronic device provided in the embodiment of the present application may be a smart electric vehicle or other device including a smart cockpit, an automotive electronic control unit (ECU, Electronic Control Unit), etc., which has extremely high requirements for reliability, safety and real-time performance. The electronic device using the program upgrade method provided in the embodiment of the present application provides a dual-partition upgrade system, which allows one partition to continue running while the other partition is updated, thereby ensuring the continuity and reliability of the system. For electronic devices involving driving safety and vehicle control that have high requirements for stable operation and real-time performance of application programs, the program upgrade method provided in the embodiment of the present application can quickly fall back to a known stable old version of the technical solution when problems occur in the new version of the application, thereby avoiding potential safety risks to the vehicle.
[0048] In some embodiments, electronic devices including smart cockpits and automotive ECUs may be equipped with new energy batteries. New energy batteries are not only used in energy storage power systems such as hydropower, thermal power, wind power and solar power stations, but are also widely used in electric vehicles such as electric bicycles, electric motorcycles, electric vehicles, and aerospace and other fields. With the continuous expansion of the application field of power batteries, the market demand is also constantly expanding. In the embodiment of the present application, the battery involved in the electronic device may be a battery cell. A battery cell refers to a basic unit that can realize the mutual conversion of chemical energy and electrical energy, which can be used to make a battery module or a battery pack, so as to supply power to an electrical device. A battery cell may be a secondary battery, which refers to a battery cell that can be used to activate the active material by charging after the battery cell is discharged. The battery cell may be a lithium ion battery, a sodium ion battery, a sodium lithium ion battery, a lithium metal battery, a sodium metal battery, a lithium sulfur battery, a magnesium ion battery, a nickel hydrogen battery, a nickel cadmium battery, a lead storage battery, etc., and the embodiment of the present application is not limited to this.
[0049] In an embodiment of the present application, the battery may also be a single physical module including one or more battery cells to provide a higher voltage and capacity. When there are multiple battery cells, the multiple battery cells are connected in series, in parallel or in mixed connection through a busbar. The battery can be used as a power source for electronic devices, and the electronic devices may be, but are not limited to, mobile phones, tablets, laptops, electric toys, electric tools, battery vehicles, electric cars, ships, spacecraft, and the like. Among them, electric toys may include fixed or mobile electric toys, for example, game consoles, electric car toys, electric ship toys, electric airplane toys, and the like, and spacecraft may include airplanes, rockets, space shuttles, spacecraft, and the like.
[0050] The program upgrade method provided in the embodiment of the present application can be executed by an electronic device comprising a first chip and a second chip, wherein the electronic device can be various types of terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), and can also be implemented as an electronic device with high real-time requirements such as a smart car, a wearable device, and a medical device.
[0051] See also Figure 1 , Figure 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 1 The electronic device shown includes: a first chip 110, a second chip 120 and a memory 130. The various components in the electronic device are coupled together via a bus system 140. It is understood that the bus system 140 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 140 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 140 is not described in detail. Figure 2 Various buses are labeled as bus system 140 .
[0052] The first chip 110 may be an integrated circuit chip with signal processing capability, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., wherein the general-purpose processor may be a microprocessor or any conventional processor, etc.
[0053] The second chip 120 may be a system basis chip (SBC) for functions such as power management, communication interface, monitoring diagnosis, and safety monitoring.
[0054] Here, the first chip 110 is the main chip of the electronic device, that is, it can be the central processing unit (CPU) of the electronic device. During the program upgrade, the first chip 110 can receive instructions for application upgrade, which may be triggered by a user interface, a remote server or other mechanisms; the first chip 110 can also communicate with the memory 130 to read and write upgrade data to ensure that the data is correctly written from the download source to the corresponding area in the memory; the first chip 110 can also perform operations such as checksum calculation and digital signature verification on the upgraded application to ensure the integrity and security of the new application; it can also execute switching logic; after the upgrade is completed, it can also trigger the first chip to restart to start the new application, etc.
[0055] The second chip 120 can provide power to the first chip 110, and can also monitor the running status of the updated application when the first chip 110 runs the updated application. When a problem occurs during the operation, the second chip 120 stops supplying power to the first chip 110, so that the first chip 110 executes the fallback logic and switches back to the partition where the application runs normally.
[0056] In some embodiments, the memory 130 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drive, optical disk drive, etc. The memory 130 may optionally include one or more storage devices physically away from the first chip 110. The memory 130 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 130 described in the embodiments of the present application is intended to include any suitable type of memory. In some embodiments, the memory 130 is capable of storing data to support various operations.
[0057] In some embodiments, the memory 130 may include at least two storage partitions, such as a first partition 1301 and a second partition 1302, one of which is an activation area, the activation area includes a new application and a new boot program, and the other is a non-activation area, the non-activation area includes an old version of an application and a boot program that can run stably. The activation area may contain the currently running application, firmware, or operating system. When the electronic device starts, the bootloader loads the application or firmware from the activation area into the memory and starts executing. The non-activation area is used to store new application, firmware, or operating system updates. During the update process, the upgrade files of the new application and firmware will be downloaded and written to the non-activation area, but may not be executed immediately (that is, they may not be updated immediately after downloading). The non-activation area is writable during the update process of the new application and firmware, but is usually read-only during normal operation to prevent accidental modification or damage.
[0058] Here, once the new application or firmware is successfully written into the non-activated area and verified, the first chip can switch the activated area through a zone switching instruction or a restart. After the switch, the non-activated area becomes the new activated area, and the original activated area becomes the non-activated area. After switching to the new activated area, the updated application in the activated area is run. If there is a problem with the operation of the new application or firmware, the system can roll back to the original activated area, that is, the current non-activated area, to ensure that the electronic device can start and run normally.
[0059] In some embodiments, when the second chip 120 is used to execute executable instructions stored in the memory, it is implemented to generate exception information in response to not receiving a program running signal sent by the first program in the first partition within a first preset time period, and send a reset signal to the first chip 110; when the first chip 110 is used to execute executable instructions stored in the memory, it is implemented to respond to the reset signal, reset, and read the exception information of the second chip 120; in response to the exception information indicating that the first program is running abnormally, run the second program in the second partition; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program.
[0060] Below, taking the above-mentioned electronic device as the execution subject as an example, the technical method in the embodiment of the present application will be clearly and completely described in combination with the drawings in the embodiment of the present application.
[0061] See also Figure 2 , Figure 2 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 1 The program upgrade method can be implemented through steps S201 to S203:
[0062] Step S201: In response to not receiving a program running signal sent by a first program in a first partition within a first preset time period, the second chip generates abnormal information and sends a reset signal to the first chip; wherein the first program is run by the first chip.
[0063] In an embodiment of the present application, the memory of the electronic device may have dual storage partitions (i.e., a first partition and a second partition, or may have multiple partitions. The embodiment of the present application is explained by taking two partitions as an example). Each storage partition has files of the same application. When the electronic device is running, it runs the program in the storage partition with the latest version of the file. This partition is the current activation area, and the other partitions are inactive areas. When a new version of the application exists, the new version of the file is downloaded to the inactive area and upgraded in the inactive area, while the current application may continue to run in the active area, so that the electronic device can still work normally during the application update process. After the application or firmware in the inactive area is updated, the area can be cut, the inactive area can be switched to the active area, and the updated application or firmware can be run. Here, if the updated application or firmware runs without abnormality, the application in the inactive area can be deleted to reduce memory usage.
[0064] Here, the first partition may be the current active area, and the first program is the application program with the latest version after the update. After the application program is updated, the first chip may perform a partition switch (here, before the update is completed, the electronic program runs the second program in the second partition, and the second partition is the active area at this time), switch the first partition (the previous inactive area) to the active area, and run the updated first program.
[0065] In the embodiment of the present application, after the first program is run, a program run signal can be periodically sent to the second chip to inform the second chip whether it is running stably. Here, the program run signal can be a dog feed signal or any feasible signal, so that the second chip can determine that the first program is running normally.
[0066] In some embodiments, after the first program is run, a program run signal indicating that the first program is running normally may be sent to the second chip every 100 milliseconds (ms). The second chip may confirm whether the program run signal sent by the first program is received every first preset time period. Here, the first preset time period may be greater than or equal to 100ms, for example, 150ms. If the second chip does not receive the program run signal sent by the first program in the first partition within 150ms, it may indicate that there is a problem with the operation of the first program.
[0067] The problem with the first program may be that there may be errors in the running logic of the application, such as conditional judgment errors, loop logic errors, etc., which result in the failure to send the dog feeding signal; it may also be that there is a problem with the timer of the first program, resulting in the first program being unable to send the program running signal to the second chip on a regular basis; it may also be that the first program is stuck or there is a problem with periodic task inaccuracy.
[0068] Here, the second chip not receiving the program running signal within the first preset time period may mean that no program running signal is received within the first preset time period since the first program is run; or it may mean that from any moment after the first program is run, no program running signal is received within the first preset time period, which may indicate a problem with the running of the first program, for example, the first program is stuck, unresponsive, or crashes.
[0069] In an embodiment of the present application, when the second chip does not receive a program running signal within a first preset time period, it considers that an error has occurred in the running of the first program and generates exception information. The exception information can be written into a register corresponding to the second chip, and a reset signal can be sent to the first chip to reset and restart the first chip.
[0070] In some embodiments, the second chip may be an SBC, and when no program running signal is received within a first preset time period, power supply to the first chip may be stopped, and then power may be supplied again to reset the first chip.
[0071] In the embodiment of the present application, the second chip will record all abnormal information that occurs during the process of the second chip monitoring the first chip and the first program. Therefore, the second chip may generate abnormal information not only because the first program runs incorrectly. For example, when the temperature of the first chip is monitored to be too high, the SBC can also stop supplying power to the first chip. At this time, the SBC will also record that the reason for stopping the power supply to the first chip is that the first chip is overheated. Therefore, after the first chip is reset, it is necessary to determine whether the reason why the second chip resets the first chip is because the first program has an error. If it is not because of an error in the first program, the first program will continue to run.
[0072] In the embodiment of the present application, both the first program and the second program are executed by the first chip.
[0073] Step S202: In response to the reset signal, the first chip is reset and abnormal information of the second chip is read.
[0074] In an embodiment of the present application, the reset signal may be a signal sent by the second chip to the first chip instructing the first chip to restart. At this time, the first chip is reset and the first chip may be restarted in response to the reset signal of the second chip; the reset signal may also be that the second chip stops supplying power to the first chip. At this time, the first chip is reset because the second chip stops supplying power to the first chip and the first chip performs a power-on reset.
[0075] In the embodiment of the present application, after the first chip is reset, the first partition is the active partition, and the first chip will still run the first partition first. At this time, the first chip will read the abnormal information of the second chip to determine whether the reset is caused by an error in the first program. If it is because of an error in the first program, the first chip confirms that the first program cannot run normally, and the first chip will call the partition cut instruction to run the second program in the second partition that has not been updated but can run normally; if the abnormal information indicates that the reset is not caused by an error in the first program, but because the temperature of the electronic device is too high, the power circuit fails, or the SBC fails, the first chip will continue to run the first program in the first partition.
[0076] Step S203: in response to the abnormality information indicating that the first program runs abnormally, the first chip runs the second program in the second partition; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program.
[0077] In the embodiment of the present application, the first partition is the current activation area, the first program is the updated application program, the second partition is the current inactivation area, and the second program is the application program that can run stably but has not been updated.
[0078] The embodiment of the present application provides an automatic partition switching mechanism. If the first chip determines that the reset is caused by an error in the operation of the first program, it means that the first program cannot run normally. The first chip will run the second program in the second partition to maintain the stable operation of the application in the electronic device.
[0079] The embodiment of the present application can monitor the running status of the first program in real time through the second chip to ensure the stable operation of the first program. Once a problem with the operation of the first program is detected, the first chip can be notified to quickly switch back to the second partition that is running stably. The automated monitoring and switching process of the program running process reduces the possibility of human operation errors and improves the accuracy of the upgrade process. The user does not need to intervene in the upgrade process, and the upgrade and switching can be automatically completed without disturbing the user. At the same time, through automated monitoring and rapid rollback when an error occurs during the operation of the upgraded program, there is no need for technical personnel to constantly control the electronic equipment, which reduces the need for electronic equipment maintenance and reduces maintenance costs.
[0080] In some embodiments, after the application is updated, the first chip can jump from the first boot program corresponding to the first program to the first program and start running the first program. Figure 3 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 2 The program upgrade method can also be implemented through steps S301 to S303:
[0081] Step S301: In response to the completion of updating the first program in the first partition, the first boot program in the first partition verifies the first program to obtain a verification result.
[0082] In some embodiments, the first boot program is the code that runs first when the first program starts, and is responsible for initializing hardware and loading the first program.
[0083] In some embodiments, when the program is not updated, the second partition is the active area. When the upgrade file of the application appears in the cloud or server, the first chip performs read and write operations on the upgrade data. The upgrade data can be written to the current inactive area (ie, the first partition), and the application is upgraded to obtain the first program.
[0084] After the first program of the first partition is updated, the first program can be verified through the first boot program (Boot) of the first partition, such as verification of the operating environment, version check, memory test and security verification of the first program (for example, verification of the digital signature of the first program, etc.), to obtain a verification result.
[0085] Step S302: In response to the verification result indicating that the first program meets the running condition, the first chip runs the first program.
[0086] In some embodiments, if the verification result of the first boot program indicates that the operating environment meets the operating requirements or the security verification of the first program passes, it means that the first program meets the operating conditions, and the first chip runs the first program.
[0087] Step S303: Starting from the start of the first program, the first program sends a program running signal to the second chip every second preset time period; wherein the second preset time period is less than or equal to the first preset time period.
[0088] In the embodiment of the present application, the first program may send a program running signal to the second chip every second preset time period (which may be 100 ms) from the time it is started, to indicate that the first program is running normally.
[0089] In some embodiments, the second preset time period can be less than or equal to the first preset time period, so that the second chip can accept a slight error when receiving the program running signal sent by the first program, thereby reducing the problem of powering off the first chip when there is no error in the first program running, but the program running signal is delayed because the hardware resources of the first program are occupied, or a high-priority task occupies the CPU, which may cause a delay in sending the program running signal, thereby improving the running smoothness of the electronic device.
[0090] After the first program is updated, the embodiment of the present application verifies the first program through the first boot program, ensuring that the first program is in good condition and that the operating environment is safe and reliable, which helps to reduce the risks during the operation of the first program and reduce potential problems and anomalies of the first program, and can also improve the security and reliability of starting the first program.
[0091] In some embodiments, after the first chip is restarted, the first boot program of the first partition will be re-run. The first boot program reads the exception information of the second chip to obtain the reason for the last reset. Based on the reason, the partition switching command can be called to run the second program of the second partition, or continue to run the first program. Figure 4 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 3 , step S102 can be implemented by steps S401 and S402, and step S103 can be implemented by steps S403 and S404:
[0092] Step S401: The first chip is reset in response to a reset signal, and runs a first boot program of a first partition.
[0093] In some embodiments, after the first chip is reset in response to the reset signal, the first boot program of the first partition is executed.
[0094] Step S402: In response to the first boot program running, the first boot program reads abnormal information.
[0095] After the first boot program is executed, the first boot program reads the abnormal information stored in the second chip.
[0096] Step S403: In response to the abnormal information indicating that the first program runs abnormally, the first boot program generates a partition switching instruction and sends the partition switching instruction to the first chip.
[0097] If the exception information indicates that the reset of the first chip is due to abnormal operation of the first program, at this time, the first boot program generates a partition switching instruction, which is used to instruct to switch the first partition as the current active area to the inactive area, and switch the second partition to the active area, so that the first chip can continue to run the second program running normally in the second partition.
[0098] Step S404: The first chip runs the second program in the second partition in response to the partition cutting instruction.
[0099] In an embodiment of the present application, the first chip responds to the partition switching instruction sent by the first boot program in the first partition, switches the first partition to an inactive area and switches the second partition to an active area, so that the first chip can continue to run the second program running normally in the second partition.
[0100] The embodiment of the present application can implement an application's fallback strategy through the first boot program, which can ensure that there is always one version of the application in the electronic device that can run. Any problems that occur during the update process will not cause the application to be unusable, thereby ensuring smooth use of the electronic device and preventing interruptions in use or loss of functions due to errors in the updated application.
[0101] In some embodiments, the program upgrade method may further include step S1:
[0102] Step S1: In response to the abnormality information indicating that the first program has no abnormality, the first chip runs the first program.
[0103] In some embodiments, if the exception information indicates that the reset of the first chip is not caused by abnormal operation of the first program but by other reasons, it means that there is no problem with the operation of the first program. After the first chip is reset, the partition cutting instruction is not called and the first program of the first partition continues to run.
[0104] In the embodiment of the present application, if there is no problem with the first program, the first program continues to run after the chip is reset, thereby reducing the probability that the electronic device fails to use a new version of the application that is running normally due to errors in other hardware. The electronic device can always use the new version of the application if there is no abnormality in the updated application, ensuring that the user can continue to use the latest functions, providing the user with a faster and smoother application experience.
[0105] In some embodiments, because Boot is the first code that runs when the program starts, it is responsible for initializing the hardware and loading the main application. If there is a problem with Boot, the entire program may not start. Therefore, when upgrading the program, you need to first update the boot program (Boot) corresponding to the program, and then update the application (APP). And the update of some APPs may require a new version of Boot to support new functions or improvements. In this case, updating Boot first can ensure that the APP can run normally after the update.
[0106] In some embodiments, Figure 5 This is a schematic diagram of an optional program upgrade method provided in an embodiment of the present application. Figure 4 After the first boot program is updated, the first chip determines whether the first boot program can run normally, and runs the application program if the first boot program can run normally.
[0107] In the embodiment of the present application, identifying whether the first boot program can be run can be achieved through steps S501 to S504:
[0108] Step S501: In response to the existence of upgrade data of an application, the first chip saves the upgrade data to a first partition, and updates the application based on the upgrade data to obtain a first program.
[0109] In some embodiments, when upgrade data for the application program exists on a cloud server, a local network, or a website of an electronic device manufacturer, the first chip may save the upgrade data to a first partition (a currently inactive area) and update the application program based on the upgrade data to obtain a first program.
[0110] Step S502: In response to the completion of updating the first program in the first partition, the first chip sends an initialization instruction to the first boot program in the first partition.
[0111] In the embodiment of the present application, after the first program is updated, it is necessary to run the first program. At this time, the first boot program will be run first. If there is no problem running the first boot program, the first program will be run.
[0112] In some embodiments, the initialization instruction is used to instruct the first boot program to initialize the clock and the controller area network (CAN) register, wherein the initialization of the CAN register may be to configure the relevant registers of the CAN controller to ensure that the CAN controller can correctly transmit and receive data, for example, to configure the working mode of the CAN controller, such as starting or stopping CAN bus communication. When the electronic device is a complete vehicle, the first boot program may be to update the first program through the CAN bus; it may also be to set the communication rate of the CAN bus, etc. Initializing the clock may be to initialize and set the clock of the first program to ensure that the clock of the first program is consistent with the actual time, so as to facilitate the subsequent startup and operation of the first program.
[0113] Therefore, when the first boot program is running, the clock and CAN registers are initialized to ensure that the hardware components of the electronic device can be correctly configured and work synchronously. Therefore, after the first program is updated, the first chip can send an initialization instruction to the first boot program to instruct the first boot program to initialize the clock and CAN registers.
[0114] In the embodiment of the present application, after step S502, the program upgrade method further includes step S10:
[0115] Step S10: The first chip obtains the initialization result of the first boot program after a third preset time period after sending the initialization instruction.
[0116] In some embodiments, after sending the initialization instruction, the first chip may set a clock for itself to obtain the initialization result of the first boot program after a third preset time period to determine whether the program initialization setting of the first boot program is successful.
[0117] Step S503: The first boot program responds to the initialization instruction, performs program initialization settings, and obtains an initialization result.
[0118] In the embodiment of the present application, the first boot program can respond to the initialization instruction issued by the first chip to perform program initialization settings, that is, initialize the clock and CAN register to obtain an initialization result.
[0119] In some embodiments, the initialization result may include initialization success and initialization failure. In the case of initialization success, the first boot program verifies the first program, and after the verification succeeds, runs the first program. In the case of initialization failure, the first chip calls the partition cut command to run the second program of the second partition.
[0120] Step S504: The first chip runs the first program or the second program based on the initialization result.
[0121] In the embodiment of the present application, if the initialization is successful, the first boot program verifies the first program, and after the verification is successful, runs the first program; if the initialization fails, the first chip calls the partition cutting command to run the second program of the second partition.
[0122] Before running the application, the embodiment of the present application will first initialize the first boot program, so that the first boot program is in a stable and available state, providing necessary hardware support for the subsequent operation of the application, which not only provides a basic guarantee for the stable operation of the application, but also can improve the security and reliability of the application operation.
[0123] In some embodiments, step S504 may be implemented by steps S5041 and S5042:
[0124] Step S5041: In response to the initialization result indicating that the initialization setting of the program is unsuccessful or the initialization result is not obtained after a third preset time period, the first chip performs a reset operation and runs the second program in the second partition.
[0125] In some embodiments, if the initialization result obtained by the first chip indicates that the program initialization setting is unsuccessful, or the first chip does not obtain the initialization result after the third preset time period, the first chip can perform a reset operation or call a partition cutting command to run the second program in the second partition.
[0126] Step S5042: In response to the initialization result indicating that the program initialization is successful, the first chip runs the first program.
[0127] In some embodiments, if the initialization result obtained by the first chip indicates that the program initialization setting is successful, it means that the first boot program runs successfully, and the first chip can run the first program at this time.
[0128] In an embodiment of the present application, the first chip monitors the initialization result of the first boot program. If the first boot program fails to initialize successfully, it means that an error has occurred in the operation of the first program, and the chip will switch to the second program which runs stably, thereby ensuring that there is always a version of the application in the electronic device that can run. Any problems during the update process will not cause the application to be unusable, thereby ensuring the smooth use of the electronic device.
[0129] Next, an application of a program upgrade method in a practical scenario is provided.
[0130] In order to solve the problem that partition switching in a dual-partition system in the related art needs to be performed based on external instructions, an embodiment of the present application provides a method for automatically switching partitions under a dual-partition architecture to avoid the situation where applications cannot run.
[0131] The embodiment of the present application provides a dual-partition automatic switching method. Under the AB zone architecture (i.e., dual storage partitions) of the device (i.e., electronic device), there is always an executable Boot (i.e., boot program) and APP (i.e., application program). After the program is updated, Boot can identify situations where the APP cannot operate normally (for example, it is stuck or reset, etc.). At this time, Boot can determine that the APP was in an abnormal operating state before by reading the mode of SBC (i.e., the second chip). The main chip of the device (i.e., the first chip) automatically switches partitions and executes the version running before the update program, thereby improving the reliability of the overall system.
[0132] Figure 6 This is a dual-partition operation architecture diagram provided by an embodiment of the present application, such as Figure 6 As shown, the storage area of the electronic device (such as a flash memory block or a random access memory (RAM)) can be divided into an A area 601 and a B area 602, wherein both the A area 601 and the B area 602 are divided into a Bootloader area (such as Figure 6 Boot) and application areas (such as Figure 6 APP in the area), area A 601 can be a running area (Activate, i.e., an activated area), that is, the APP in area A 601 is the currently running APP; area B 602 can be a backup area (NoActive, i.e., a non-activated area), that is, area B 602 is used to store update files of the APP and update the APP.
[0133] Here, after the APP in zone B 602 is updated, the main chip switches the partition and switches the running area to zone B 602. If the APP in zone B runs abnormally, for example, there is a freeze, the program is unresponsive, or the program crashes, the embodiment of the present application can automatically switch back to zone A 601 to continue running the normal program without the need for additional instructions to switch. This ensures the smooth use of the application on devices such as smart cockpits, automotive ECUs, and single-chip microcomputers that require frequent firmware updates, and does not cause the situation in the related technology where the application crashes and cannot be used, but cannot automatically switch back to another normally running program.
[0134] Figure 7 is a flow chart of a dual-zone automatic switching method provided in an embodiment of the present application, such as Figure 7 As shown, the dual-zone automatic switching method provided in the embodiment of the present application can be implemented through steps S701 to S705:
[0135] Step S701: The chip runs the activation area program.
[0136] In the embodiment of the present application, after the APP in area B is updated, the activation area (i.e., the running area) of the APP is switched to area B, and the chip runs the updated program in area B. Here, the chip is the main chip of the electronic device.
[0137] Step S702: Boot jumps to APP, and APP periodically feeds the external SBC.
[0138] In some embodiments, after area B becomes the active area, Boot jumps to APP (i.e., the program is executed from the Bootloader area of area B, Boot runs without exception, and continues to execute APP). After APP runs, it interacts with the external SBC periodically, and can periodically send dog feeding data so that SBC can periodically receive the dog feeding data to power the chip normally.
[0139] Step S703: If the SBC does not receive the APP dog feeding instruction for a period of time, it records the abnormality and stops supplying power.
[0140] In the embodiment of the present application, when the APP is stuck or the periodic task is inaccurate, the SBC cannot send and receive dog feeding data normally. The SBC believes that the application has an error and will stop powering the chip. The SBC will save the abnormal situation to the corresponding register of the SBC.
[0141] Step S704: The chip is reset to execute the activation area Boot, read the SBC abnormal state, execute the area cut instruction and reset.
[0142] In the embodiment of the present application, after the chip is powered off, a power-off reset will be triggered. After the chip is reset, the activation area Boot is executed. The Boot reads the abnormal status of the SBC. If the chip stops supplying power due to a problem with the application, the chip automatically executes the area switch, switches the activation area to area A, and continues to run the running program in area A.
[0143] Step S705: The chip starts and runs the partitioning program before the update program.
[0144] In the embodiment of the present application, after area B becomes the active area, it is necessary to run Boot first, and if there is no abnormality in Boot, run APP.
[0145] Figure 8 is an interactive schematic diagram of the dual-zone automatic switching method provided in the embodiment of the present application, such as Figure 8 As shown, the interaction of the dual partition automatic switching method is performed between the chip 801 (ie, the first chip), the activation area Boot 802 , the activation area APP 803 , and the original running area APP 804 of the electronic device.
[0146] In the embodiment of the present application, after the power of chip 801 is started, the activation area in area A and area B is detected, and the activation area Boot802 is jumped to. At the same time, the chip's own clock starts timing. If the activation area Boot does not initialize the clock and CAN register of the activation area Boot within a period of time (for example, 500ms), it is considered that the activation area Boot is running abnormally or the jump Boot is abnormal. At this time, chip 801 automatically executes the call zone switching command, switches back to the original running area (that is, runs APP804), and performs a chip reset; if the activation area Boot initializes the clock and CAN register of the activation area Boot within a period of time, it is detected whether the update of the activation area APP803 is valid. If valid, jump to the activation area APP803. At this time, the clock and CAN register of the activation area APP803 can be initialized. If the clock and CAN register of the activation area APP803 are successfully initialized within a period of time, the activation area APP803 is run.
[0147] In some embodiments, when the activation area Boot runs abnormally, the chip restarts and runs the partition that was running before the update program, that is, the original running area APP804.
[0148] Based on the foregoing embodiments, the embodiments of the present application provide an electronic device, which includes a first chip and a second chip. In the implementation process, the first chip can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Microprocessor Unit), a digital signal processor (DSP, Digital Signal Processor) or a field programmable gate array (FPGA, Field Programmable Gate Array), etc. It can also be a processor in the form of a hardware decoding processor, which is programmed to execute the program update method provided in the embodiment of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASIC, Application Specific Integrated Circuit), DSP, programmable logic device (PLD, Programmable Logic Device), complex programmable logic device (CPLD, Complex Programmable Logic Device), field programmable gate array (FPGA, Field-Programmable Gate Array) or other electronic components. The second chip can be an SBC chip.
[0149] In some embodiments, the second chip generates exception information and sends a reset signal to the first chip in response to not receiving a program running signal sent by the first program in the first partition within a first preset time period; wherein the first program is run by the first chip; the first chip resets in response to the reset signal and reads the exception information of the second chip; the first chip runs the second program in the second partition in response to the exception information indicating that the first program is running abnormally; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program.
[0150] In some embodiments, the first boot program of the first partition verifies the first program in response to the completion of the update of the first program in the first partition to obtain a verification result; the first chip runs the first program in response to the verification result indicating that the first program meets the running conditions; from the start of the running of the first program, the first program sends a program running signal to the second chip every second preset time period; wherein the second preset time period is less than or equal to the first preset time period.
[0151] In some embodiments, the first chip is reset in response to a reset signal and runs a first boot program in the first partition; the first boot program reads exception information in response to the running of the first boot program; correspondingly, the first boot program generates a partition cutting instruction in response to the exception information characterizing that the first program is running abnormally, and sends the partition cutting instruction to the first chip; the first chip runs the second program in the second partition in response to the partition cutting instruction.
[0152] In some embodiments, the first chip runs the first program in response to the exception information indicating that the first program has no exception.
[0153] In some embodiments, the first chip saves the upgrade data to the first partition in response to the existence of upgrade data of the application, and updates the application based on the upgrade data to obtain the first program; the first chip sends an initialization instruction to the first boot program of the first partition in response to the completion of the update of the first program in the first partition; the first boot program performs program initialization settings in response to the initialization instruction to obtain an initialization result; the first chip runs the first program or the second program based on the initialization result.
[0154] In some embodiments, the first chip obtains the initialization result of the first boot program after a third preset time period from the time the initialization instruction is sent.
[0155] In some embodiments, the first chip performs a reset operation and runs the second program in the second partition in response to the initialization result indicating that the initialization setting of the program is unsuccessful or the initialization result is not obtained after a third preset time period; the first chip runs the first program in response to the initialization result indicating that the initialization setting of the program is successful.
[0156] The description of the above electronic device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the electronic device provided in the embodiment of the present application can be used to execute the method described in the above method embodiment. For technical details not disclosed in the electronic device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0157] It should be noted that in the embodiments of the present application, if the above-mentioned program upgrade method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the relevant technology. The software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific hardware, software or firmware, or any combination of hardware, software, and firmware.
[0158] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
[0159] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes some or all of the steps for implementing the above method.
[0160] The embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be implemented in hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK, Software Development Kit), etc.
[0161] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
[0162] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0163] The present application uses descriptions such as "upper", "lower", "top", "bottom", "front", "back", "inside" and "outside" to indicate directions or positional relationships. This is only for the convenience of describing the present application, and does not indicate or imply that the device referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, it should not be understood as limiting the scope of protection of the present application.
[0164] In the description of this application, it should also be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to the specific circumstances.
[0165] It should be noted that, in this application, the terms "include", "comprises" 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, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0166] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0167] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, the functional units in the embodiments of the present application may be all integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0168] The above are only implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed in the present application should be covered within the protection scope of the present application.
Claims
1. A program upgrade method, characterized in that: Applicable to an electronic device including a first chip and a second chip; the program upgrade method includes: In response to not receiving a program running signal sent by a first program in a first partition during a first preset time period, the second chip generates abnormal information and sends a reset signal to the first chip; wherein the first program is run by the first chip; and the second chip is at least used to record abnormal information during the running of the first chip and the first program; In response to the reset signal, the first chip is reset and abnormal information of the second chip is read; In response to the abnormal information indicating that the first program runs abnormally, the first chip runs a second program in the second partition; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program; In response to the exception information indicating that no exception occurs in the first program, the first chip runs the first program.
2. The program upgrade method according to claim 1, characterized in that: The program upgrade method also includes: In response to the completion of updating the first program in the first partition, the first boot program of the first partition verifies the first program to obtain a verification result; In response to the verification result indicating that the first program meets the running condition, the first chip runs the first program; The first program sends a program running signal to the second chip every second preset time period from the time the first program is running; wherein the second preset time period is less than or equal to the first preset time period.
3. The program upgrade method according to claim 2, characterized in that: In response to the reset signal, the first chip is reset, and abnormal information of the second chip is read, including: The first chip is reset in response to the reset signal, and runs a first boot program of the first partition; In response to the first boot program running, the first boot program reads the abnormal information; Correspondingly, in response to the abnormal information indicating that the first program is running abnormally, the first chip runs the second program in the second partition, including: In response to the abnormal information indicating that the first program runs abnormally, the first boot program generates a partition switching instruction and sends the partition switching instruction to the first chip; The first chip runs the second program in the second partition in response to the partition cutting instruction.
4. The program upgrade method according to any one of claims 1 to 3, characterized in that: The program upgrade method also includes: In response to the existence of upgrade data of the application, the first chip saves the upgrade data to the first partition, and updates the application based on the upgrade data to obtain the first program; In response to completion of updating the first program in the first partition, the first chip sends an initialization instruction to the first boot program of the first partition; The first boot program performs program initialization settings in response to the initialization instruction to obtain an initialization result; The first chip runs the first program or the second program based on the initialization result.
5. The program upgrade method according to claim 4, characterized in that: The program upgrade method also includes: The first chip obtains the initialization result of the first boot program after a third preset time period from sending the initialization instruction.
6. The program upgrade method according to claim 5, characterized in that: The running the first program or the second program based on the initialization result includes: In response to the initialization result indicating that the initialization setting of the program is unsuccessful or the initialization result is not obtained after the third preset time period, the first chip performs a reset operation and runs the second program in the second partition; In response to the initialization result indicating that the program initialization setting is successful, the first chip runs the first program.
7. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable instructions; The second chip is used to generate abnormal information and send a reset signal to the first chip in response to not receiving a program running signal sent by the first program in the first partition within a first preset time period when executing the executable instructions stored in the memory; wherein the first program is run by the first chip; and the second chip is at least used to record abnormal information during the running of the first chip and the first program; The first chip is used to execute the executable instructions stored in the memory, and is used to respond to the reset signal, perform a reset, and read the exception information of the second chip; in response to the exception information indicating that the first program is running abnormally, run the second program in the second partition; the second program and the first program are different versions of the same application program, and the version number of the first program is higher than that of the second program; in response to the exception information indicating that the first program has no exception, run the first program.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the program upgrading method according to any one of claims 1 to 6 are implemented.
9. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps in the program upgrade method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Program upgrading method and device, electronic equipment and storage medium
CN114035828A
Upgrading method and device and electronic equipment
CN114546456A
Electronic system, exception handling method and device thereof and electronic equipment
CN117234764A
Embedded system restarting method and device, electronic equipment and readable storage medium
CN117667258A
Program running detection method and device, equipment and storage medium
CN118012764A