Software updating method
By using the first version alignment component and software sharing area in the control element, the problem of time and manpower of software version update and alignment in dual application ECU is solved, and fast and efficient software update and alignment is achieved, improving the user experience.
Patent Information
- Application Number
- CN202411125356.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-26
AI Technical Summary
The existing software update method requires a lot of time and manpower to update and align the software versions of two backup applications in dual-application ECUs, affecting efficiency and user experience.
By introducing the first version alignment component into the control element, using the software shared area to achieve software version alignment between the two applications, first determine whether there is a target update software in the software shared area, and if so, modify the operating address of the second application. If not, the software file of the first application is stored in the shared area and the running address of the second application is modified to achieve the alignment of the software version.
It realizes the rapid completion of software version updates and alignment of two mutual backup applications in the control element, reducing software update time and manpower consumption, and improving software update efficiency and user experience.
Smart Images

Figure CN119025140A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software updating, and in particular to a software updating method. Background Art
[0002] With the development of electronic devices such as vehicles, electronic devices include more and more control components, and the hardware capabilities of control components are getting stronger and stronger. With the improvement of the hardware capabilities of control components, some control components include more and more applications and become more and more complex, so the update frequency of applications also increases. As a result, users have higher requirements for application update efficiency and update experience.
[0003] Taking the Electronic Control Unit (ECU) as an example of a control element, some ECUs currently contain two applications that are backup applications for each other, and the software versions of these two applications are the same, so this type of ECU is usually called a dual-application ECU. Taking the application upgrade scenario as an example, the current process of performing a software upgrade during the operation of an application for a dual-application ECU that supports backup upgrades is: first upgrade the non-running application once according to the upgrade software, then run the upgraded application, stop the original running application, and then upgrade the other application that has not been upgraded again according to the upgrade software. In this way, the application software versions of the two backup applications in the dual-application ECU are aligned, and the application upgrade is completed. However, this application upgrade method requires independent upgrade processing of the two backup applications to complete the application upgrade of the two backup applications, which consumes a lot of time and manpower, affecting the upgrade efficiency and user experience.
[0004] In addition, the same problem also exists in the scenarios of software updates such as software upgrades of other types of control components. Therefore, there are technical problems in the current software update process that software version updates and alignments consume a lot of time and manpower, affecting software update efficiency and user experience. Summary of the invention
[0005] The purpose of the present invention is to solve the technical problem that the software version update and alignment in the existing software update process consumes a lot of time and manpower, affecting the software update efficiency and user experience. The present invention provides a software update method, which can more conveniently and quickly realize the update and alignment of application software versions of two mutually backed-up applications in a control element, thereby reducing software update time, reducing manpower consumption, and improving software update efficiency and user experience.
[0006] To solve the above technical problems, in a first aspect, an embodiment of the present invention discloses a software upgrade method, which is applied to a control element, wherein the control element includes a software sharing area, a first application and a second application, the first application and the second application are backup applications for each other, and the first application includes a first version alignment component. The method includes: when the first application is in a startup state, if the first version alignment component determines that the software version update function startup condition is met, the software version update function is started to determine whether there is a target update software with a software version consistent with the software version of the first application in the software sharing area; when it is determined that the target update software exists in the software sharing area, the first version alignment component modifies the running address of the second application to the address of the target update software in the software sharing area, and completes the software update processing for the second application; when it is determined that the target update software does not exist in the software sharing area, the first version alignment component stores the software file corresponding to the first application as the target update software in the software sharing area, and modifies the running address of the second application to the address of the target update software in the software sharing area, and completes the software update processing for the second application.
[0007] By adopting the above technical scheme, the software version update function is started when the startup conditions are met. The first version alignment component first determines whether there is a target update software in the software sharing area. If so, the first version alignment component modifies the running address of the second application to the address of the target update software in the software sharing area, and completes the software update processing for the second application, so that when the second application is running, the target update software in the software sharing area is actually running, so that when the second application is running, the same software version as the first application is actually running, and the version alignment of the first application and the second application is completed; if not, the first version alignment component stores the software file corresponding to the first application as the target update software in the software sharing area, and then modifies the running address of the second application to the address of the upgrade software in the sharing area, and completes the software update processing for the second application, so that when the second application is running, the target update software in the software sharing area is actually running, so that when the second application is running, the same software version as the first application is actually running, and the version alignment of the first application and the second application is completed. This makes it possible to conveniently and quickly implement software update processing for the second application, and to achieve software version update and alignment between the first application and the second application, which are backup applications of each other in the control element, thereby reducing software update time, reducing manpower consumption, and improving software update efficiency and user experience.
[0008] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method for determining whether a software version update function startup condition is met, including: if it is determined that the software version of the first application and the software version of the second application are inconsistent, then determining that the software version update function startup condition is met.
[0009] By adopting the above technical solution, when the software versions of the first application and the second application are inconsistent, the version update function can be started to perform software update processing on the second application, and the software version alignment of the first application and the second application can be completed, so that the application software version update and alignment of the two backup applications in the control element can be realized more conveniently and quickly, thereby reducing software update time, reducing manpower consumption, and improving software update efficiency and user experience.
[0010] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein the control element also includes starting a boot loader, and the method also includes starting a first application in the following manner: when the control element is started, if the boot loader determines that the application to be started is the first application based on the application activation flag information, then starting the first application.
[0011] By adopting the above technical solution, when the control element is started, the first application can be started by the boot loader in the control element, so that the first application can perform subsequent processing.
[0012] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein the second application includes a second version alignment component and a second software upgrade component, and before the first application is started, the method further includes: the second software upgrade component performs software update processing on the first application according to the software update instruction and update software received from the external device when the second application is started, and modifies the application activation flag information to indicate the state of starting and running the first application when the software update for the first application is completed, so as to restart the control element, and start the first application after the control element is restarted; or, the second software upgrade component stores the update software as the target update software in the software sharing area according to the software update instruction and update software received from the external device when the second application is in the started state, and sends an instruction to the second version alignment component to start the software version update function, so that the second version alignment component modifies the running address of the first application to the address of the target update software in the software sharing area, and modifies the application activation flag information to indicate the state of starting and running the first application, so as to restart the control element, and start the first application after the control element is restarted.
[0013] By adopting the above technical solution, before the first application is started, when the second application is started, the first application can be updated through the second software upgrade component in the second application, and the application activation flag information can be modified to indicate the state of starting and running the first application, so that the first application can be run after the control element is restarted; or, when the second application is started, the update software can be stored as the target update software in the software sharing area through the second software upgrade component in the second application, and an instruction can be sent to the second version alignment component to start the software version update function, so that the second version alignment component can modify the running address of the first application to the address of the target update software in the software sharing area, so that when the first application is running, the target update software in the software sharing area is actually running, and the application activation flag information can be modified to indicate the state of starting and running the first application, so that the first application can be run after the control element is restarted, thereby performing a software update on the control element through an external device.
[0014] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, which also includes: a second software upgrade component determines, based on the software update instruction and update software received from an external device, whether to perform a software update on the first application or to store the update software as the target update software in a software sharing area in the following manner: the second software upgrade component determines, based on the software update instruction and update software received from an external device, software flash address information preset in the update software; if the software flash address information is the address information of the first application, software update processing is performed on the first application; if the software flash address information is the address information of the software sharing area, the update software is stored as the target update software in the software sharing area.
[0015] By adopting the above technical solution, the second software upgrade component determines whether to store the updated software as the target updated software directly in the software sharing area according to the software update instructions and updated software received from the external device and the software flash address information preset in the updated software, so as to clarify the location where the updated software is to be stored, and then determine the corresponding processing.
[0016] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software updating method, in which software flashing address information in the updated software is obtained in the following manner: when the data volume of the updated software is greater than or equal to a preset threshold, the address information of the first application is set as the software flashing address information; when the data volume of the updated software is less than the preset threshold, the address information of the software shared area is set as the software flashing address information.
[0017] By adopting the above technical solution, when the amount of data in the update software is large, the update software can be directly stored in the software sharing area as the target update software, thereby avoiding copying data and taking up more time.
[0018] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein the first application also includes a first software upgrade component. In the event that the software update for the second application fails, the method further includes: the first software upgrade component performs software update processing on the second application according to the software update instruction and update software received from an external device, and after completing the software update processing for the second application, modifies the application activation flag information to indicate a state of starting and running the second application, so as to restart the control element, and start the second application after the control element restarts.
[0019] By adopting the above technical solution, when the software update for the second application fails, the first software upgrade component in the first application can perform software update processing on the second application, so that when the software update for the second application fails, the software update processing for the second application can be completed by a backup method.
[0020] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method. If the software update process is a software version upgrade process, then when it is necessary to perform software version rollback processing on the second application, the method also includes: the first version alignment component modifies the running address of the second application back to the running address of the second application before the software update process is performed.
[0021] By adopting the above technical solution, the running address of the second application can be modified back to the running address of the second application before the software update, without the need for additional erasing and flashing processing, and the software version of the second application can be rolled back to the version before the second application was updated, thereby saving the steps involved in the update and speeding up the software update efficiency.
[0022] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software updating method, wherein the external device includes an external diagnostic device or a cloud server.
[0023] By adopting the above technical solution, the software upgrade control of the control element can be carried out through an external diagnostic device or a cloud server.
[0024] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software updating method, wherein the control element is an electronic control unit.
[0025] By adopting the above technical solution, the electronic control unit can more conveniently and quickly implement software update and alignment processing such as software upgrade between two applications that serve as backup applications for each other based on the software update method disclosed in the embodiment of the present invention.
[0026] According to another specific implementation of the present invention, the software update process may be a software upgrade process, or a software version rollback process or other processes related to software update.
[0027] In a second aspect, an embodiment of the present invention discloses an electronic device, comprising the control element in the method described in the first aspect.
[0028] It can be understood that the beneficial effects of the second aspect mentioned above can also be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of the architecture of a single-application ECU provided by an embodiment of the present invention is shown;
[0030] Figure 2 A schematic diagram of the architecture of a dual-application ECU provided by an embodiment of the present invention is shown;
[0031] Figure 3 A schematic flow chart of a method for updating software of an ECU provided by an embodiment of the present invention is shown;
[0032] Figure 4 A schematic diagram of the architecture of a control element provided by an embodiment of the present invention is shown;
[0033] Figure 5 A schematic diagram of a software upgrade method provided by an embodiment of the present invention is shown;
[0034] Figure 6 A schematic diagram of the architecture of another control element provided by an embodiment of the present invention is shown;
[0035] Figure 7 A schematic diagram showing a flow chart of another software upgrade method provided by an embodiment of the present invention;
[0036] Figure 8 A schematic diagram of storage area division of a control element provided by an embodiment of the present invention is shown;
[0037] Fig. 9 A schematic diagram of the architecture of a multi-core ECU provided by an embodiment of the present invention is shown;
[0038] Fig.10 A schematic diagram showing a flow chart of another software upgrade method provided by an embodiment of the present invention;
[0039] Fig.11 A schematic diagram of the architecture of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0040] As mentioned above, with the rapid development of automobile technology, the number of control components in automobiles is increasing, the software of automobile control components is becoming more complex and important, and the frequency of software updates such as software upgrades of control component software is also increasing. Users have higher technical requirements for the update efficiency of control components and the refresh experience of control component software.
[0041] Taking ECU as an example of a control element and software upgrade as an example of a software update scenario, most ECUs currently contain only one application (i.e., application program), which is called a single-application ECU. Figure 1 The single-application ECU shown includes an application and a bootloader. The application includes N application functional components, and the bootloader includes a software refresh program and a startup management program. The single-application ECU does not support backup upgrades, and the software of the application in the ECU can only be upgraded through the software refresh program in the bootloader.
[0042] As ECU hardware capabilities improve, some ECUs currently contain two applications that back up each other (such as application A and application B). The software versions of these two applications are the same, so this type of ECU is usually called a dual-application ECU. Figure 2 The dual-application ECU shown includes applications A and B, and a boot loader. Applications A and B include multiple application function components (such as application function component 1 and application function component 2), respectively. Application function components are software components that can implement some simple functions. The boot loader includes a software refresh program and a startup management program. The software refresh program is used to refresh the software in the ECU, and the startup management program is used to start the application in the ECU when the ECU starts. Taking the application upgrade scenario as an example, the current software upgrade process for the dual-application ECU that supports backup upgrades is performed during the running of an application (such as application A), as shown in FIG. Figure 3 As shown, specifically including:
[0043] S1: The ECU starts and runs the boot loader. The boot manager in the boot loader starts and runs the application (such as application A).
[0044] S2: The software refresh program in the boot loader first upgrades the non-running application (such as application B) according to the upgrade software.
[0045] S3: ECU restarts.
[0046] S4: The boot loader is run, and the startup management program in the boot loader starts running application B.
[0047] S5: The software refresh program in the boot loader upgrades the application A again according to the upgrade software.
[0048] In this way, the application software versions of the two backup applications in the dual-application ECU are aligned to complete the application upgrade. However, this application upgrade method requires independent upgrade processing of the two applications to complete the upgrade of the two applications, which consumes a lot of time and manpower, affecting the upgrade efficiency and user experience. In addition, when the software in the ECU needs to be rolled back to the old software version, the software in the ECU needs to be erased and rewritten to the old software version, which also consumes a lot of time and manpower, affecting the upgrade efficiency and user experience. When the software of a large number of ECUs is upgraded in the factory or after-sales by using the existing technology, the time and manpower consumed are multiplied. Therefore, there is an urgent need for a solution that can improve the ECU upgrade efficiency and take into account the advantages of the existing technology.
[0049] In addition, in other software update scenarios such as software rollback, there are also type issues.
[0050] In order to solve the above technical problems, an embodiment of the present invention discloses a software update method. The software update method disclosed in the embodiment of the present invention is described below using ECU as an example of a control element and in conjunction with the accompanying drawings.
[0051] refer to Figure 4 , Figure 4 The ECU shown is an example of a control element in the software update method disclosed in the embodiment of the present invention. The ECU includes a software sharing area, application A (as an example of a first application) and application B (as an example of a second application). Application A includes a first version alignment component. It can be understood that application A and application B also include other component application function components, which are not shown in the figure.
[0052] like Figure 5 As shown, the method includes:
[0053] S100: When the first application (i.e., application A) is in the startup state, if the first version alignment component determines that the software version update function startup condition is met, it starts the software version update function to determine whether there is a target update software with a software version consistent with the software version of the first application in the software sharing area.
[0054] S210: When it is determined that the target update software exists in the software sharing area, the first version alignment component modifies the running address of the second application (ie, application B) to the address of the target update software in the software sharing area, and completes the software update process for the second application.
[0055] S220: When it is determined that the target update software does not exist in the software sharing area, the first version alignment component stores the software file corresponding to the first application as the target update software in the software sharing area, and modifies the running address of the second application to the address of the target update software in the software sharing area, thereby completing the software update processing for the second application.
[0056] By adopting the above technical solution, the software version update function is started when the start condition is met. The first version alignment component first determines whether there is a target update software in the software sharing area. If so, the first version alignment component modifies the running address of application B to the address of the target update software in the software sharing area, and completes the software update processing for application B, so that when running application B, the target update software in the software sharing area is actually run, so that when running application B, the same software version as application A is actually run, and the version alignment of application A and application B is completed; if not, the first version alignment component stores the software file corresponding to application A as the target update software in the software sharing area, and then modifies the running address of application B to the address of the upgrade software in the sharing area, and completes the software update processing for application B, so that when running application B, the target update software in the software sharing area is actually run, so that when running application B, the same software version as application A is actually run, and the version alignment of application A and application B is completed. In this way, the application software version update and alignment of two mutually backed-up applications in the control element can be conveniently and quickly realized, thereby reducing software update time, reducing manpower consumption, and improving software update efficiency and user experience.
[0057] In one implementation of the present invention, the first application is an application that has completed the upgrade among the two applications that are backup applications of each other, and the second application is an application to be upgraded. Therefore, the software update method disclosed in the embodiment of the present invention is applied to the software upgrade scenario. Only one software upgrade is required to complete the upgrade of the first application, and the software version of the second application that is the backup application of the first application can be easily and quickly aligned with the software version of the first application to complete the upgrade of the second application, thereby reducing the application upgrade time of the two backup applications, reducing manpower consumption, and improving upgrade efficiency and user experience.
[0058] It is understandable that for steps S100 to S220, application A can also be used as a reference application for software updates. In the application upgrade scenario, it can be an application that has completed the upgrade, and application B is an application to be upgraded to the same software version as application A.
[0059] Reference Figure 6 According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein application B includes a second version alignment component and a second software upgrade component, and before application A is started, the method further includes: when application B is started, the second software upgrade component performs software update processing on application A according to the software update instruction and update software received from an external device, and when the software update for application A is completed, the application activation flag information is modified to indicate the state of starting and running application A, so as to restart the control element, and start application A after the control element is restarted; or, when application B is in the startup state, the second software upgrade component stores the update software as the target update software in the software sharing area according to the software update instruction and update software received from the external device, and sends an instruction to the second version alignment component to start the software version update function, so that the second version alignment component modifies the running address of application A to the address of the target update software in the software sharing area, and modifies the application activation flag information to indicate the state of starting and running application A, so as to restart the control element, and start application A after the control element is restarted.
[0060] By adopting the above technical scheme, before application A is started, when application B is in the process of starting up, the second software upgrade component in application B can be used to perform software update processing on application A, and the application activation flag information can be modified to indicate the state of starting and running application A, so that application A can be run after the control element is restarted; or, when application B is in the process of starting up, the updated software can be stored as the target updated software in the software sharing area through the second software upgrade component in application B, and an instruction can be sent to the second version alignment component to start the software version update function, so that the second version alignment component can modify the running address of application A to the address of the target updated software in the software sharing area, so that when application A is running, the target updated software in the software sharing area is actually running, and the application activation flag information can be modified to indicate the state of starting and running application A, so that application A can be run after the control element is restarted.
[0061] It should be noted that in the implementation of the present invention, the transmission of data files and the updating of software are realized by interacting with external tools or the cloud through the software upgrade component. When the software upgrade component is executed, it does not affect the normal operation of other functional components, and can realize the senseless update during the driving process of the vehicle. At the same time, when there is a problem in the upgrade process that needs to be repaired, the software upgrade component can be updated by updating the application software to achieve rapid repair iteration.
[0062] It is understandable that application A and application B also include other component application function components, which are not shown in the figure.
[0063] In the embodiment of the present invention, by setting the application activation flag, when the control element is started, the application A or application B is indicated to be started and run according to the state of the application activation flag information. Generally, the application that has completed the software update in application A and application B is indicated to be started and run according to the state of the application activation flag information. The application activation flag is widely used in the prior art. Generally, an application activation flag can be set for each application A and application B, and the corresponding state is indicated by a preset value. For example, if the application activation flag of application A is "1" and the application activation flag of application B is "0", it indicates that application A is started and run; if the application activation flag of application A is "0" and the application activation flag of application B is "1", it indicates that application B is started and run. In addition, only one application activation flag can be set for application A and application B to indicate the start and run of application A or application B according to the state of the application activation flag information. For example, if the application activation flag is "1", it indicates that application A is started and run; if the application activation flag is "2", it indicates that application B is started and run. There is no limitation on the specific setting method of the application activation flag bit, and an appropriate method can be selected for setting according to actual needs.
[0064] It is understandable that in the implementation of the present invention, the software update process is performed on the non-running application (i.e., application A) through the software upgrade component (i.e., the second software upgrade component) in the running application (i.e., application B). During the software update process, application B can run normally, realizing the non-perceived software update process of application A. Since application A and application B are backup applications for each other, according to actual needs, when application A is running, the software upgrade component (i.e., the first software upgrade component) in application A can be used to perform software update processing on the non-running application B.
[0065] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, which also includes: a second software upgrade component determines, based on the software update instruction and update software received from an external device, whether to perform software update processing on application A or to store the update software as target update software in a software sharing area in the following manner: the second software upgrade component determines, based on the software update instruction and update software received from an external device, software flash address information preset in the update software; if the software flash address information is the address information of application A, software update processing is performed on application A; if the software flash address information is the address information of the software sharing area, the update software is stored as target update software in the software sharing area.
[0066] Using the above technical solution, the second software upgrade component determines whether to store the updated software as the target updated software directly in the software sharing area based on the software update instructions and updated software received from the external device and the software flash address information preset in the updated software, so as to clarify the location where the updated software is to be stored.
[0067] For the software flashing address information preset in the update software, the software flashing address information can be preset according to actual needs, for example: the software flashing address information of all updated software is uniformly preset as the address information of the software sharing area, or when the preset conditions are met, the software flashing address information of the updated software is preset as the address information of the software sharing area.
[0068] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software updating method, in which software flashing address information in the updated software is obtained in the following manner: when the data volume of the updated software is greater than or equal to a preset threshold, the address information of the software shared area is set as the software flashing address information; when the data volume of the updated software is less than the preset threshold, the address information of application A is set as the software flashing address information.
[0069] By adopting the above technical solution, it is possible to determine whether to store the updated software as the target updated software in the software sharing area according to the amount of data in the updated software. Exemplarily, the preset threshold is 1MB, and when the amount of data in the updated software is greater than or equal to 1MB, the address information of the software sharing area is set as the software flashing address information, and when the amount of data in the updated software is less than 1MB, the address information of application A is set as the software flashing address information, so that when the amount of data in the updated software is large, the updated software can be directly stored as the target updated software in the software sharing area, avoiding copying data and taking up more time.
[0070] In addition to the above method of presetting the address information of the update software according to the size of the data in the update software and then determining the location where the update software is to be stored, the size of the data in the update software can also be confirmed by a second software upgrade component, and the second software upgrade component determines the location where the update software is to be stored based on the confirmation result.
[0071] Methods for presetting the address information of the update software include but are not limited to the above two methods.
[0072] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein the external device includes an external diagnostic device or a cloud server. That is, an instruction can be sent to the ECU through the external diagnostic device or the cloud server to perform software updates on the applications in the ECU, or the updated software can be stored in the software sharing area as the target update software. The method in which the cloud server sends instructions to the ECU to perform software updates on the ECU is an OTA (Over the Air) upgrade.
[0073] After the target update software exists in the software sharing area, step S100 may be executed.
[0074] Regarding the startup method of application A in step S100, according to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein the control element also includes starting a boot loader, and the method also includes starting application A in the following manner: when the control element is started, if the boot loader determines that the application to be started is application A based on the application activation flag information, then starting application A.
[0075] By adopting the above technical solution, when the control element is started, the boot loader in the control element can determine the application to be started according to the application activation flag information. If the boot loader determines that the application to be started is application A according to the application activation flag information, then application A is started so that application A can perform subsequent processing.
[0076] For step S100, the first version alignment component in application A will start the software version update function only when the version update function start condition is met.
[0077] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method for determining that a software version update function startup condition is met, comprising: if it is determined that the software version of application A is inconsistent with the software version of application B, then determining that the software version update function startup condition is met.
[0078] By adopting the above technical solution, when the software versions of application A and application B are inconsistent, the software version update function can be started to complete the software update for application B and complete the version alignment of application A and application B, so that only one software update process can be performed to achieve the software version update and alignment of the two applications in the control element, thereby reducing the upgrade time, reducing manpower consumption, and improving the upgrade efficiency and user experience.
[0079] It should be noted that, in determining that the software version of application A is inconsistent with the software version of application B, it does not mean that the software version of application A is inconsistent with the real software version of application B, but that the software version of the application to be run when application A is started is inconsistent with the software version of the application to be run when application B is currently started. Exemplarily, in step S100, when application A is in the startup state and it is determined that there is no target update software in the software sharing area, the running application A is actually application A itself, and since the subsequent steps have not been executed, if application B is running at this time, it is actually application B itself that is running. Therefore, it is necessary to compare the real software versions of application A with application B, so as to confirm that the software versions of application A and application B are inconsistent; when application A is in the startup state and it is determined that there is a target update software in the software sharing area, the running application A is actually the target update software, and since the subsequent steps have not been executed, if application B is running at this time, it is actually application B itself that is running. Therefore, it is necessary to compare the software version of the target update software with the real software version of application B, so as to confirm that the software versions of application A and application B are inconsistent.
[0080] If the software version update function has been executed on application B before, when executing step S100, it will be determined that the software version of application A is consistent with the software version of application B. The principle of determining that the software version of application A is consistent with the software version of application B is the same as the above content. Exemplarily, when application A is in the startup state, and when it is determined that the target update software does not exist in the software sharing area, the running application A is actually application A itself. Since the software version update function has been executed, if the running application B is actually running the target update software. Therefore, it is necessary to compare the software version of application A with the software version of the target update software to confirm that the software version of application A is consistent with that of application B; when application A is in the startup state, and when it is determined that the target update software exists in the software sharing area, the running application A is actually the target update software. Since the software version update function has been executed, if the running application B is actually running the target update software. Therefore, it is necessary to compare the software version of the target update software with the software version of the target update software to confirm that the software version of application A is consistent with that of application B.
[0081] It is understandable that the software version information can be obtained from the running application. Exemplarily, if the application to be run when application B is started is application B itself, the real software version information of application B is stored as the software version information of application B. If the application to be run when application B is started is the target update application, the software version information of the target update software is stored as the software version information of application B, so as to determine whether the software version of application A is inconsistent with the software version of application B.
[0082] In addition, the method of starting the software version update function includes but is not limited to the above-mentioned starting when the starting conditions are met, and can also be started by other starting methods, such as directly controlling the start of the software version update function through external instructions (such as external diagnostic equipment sending instructions to the ECU).
[0083] In step S210, when it is determined that the target update software exists in the software sharing area, that is, when the update software is stored as the target update software in the software sharing area, the running address of application A has been modified to the address of the target update software in the software sharing area. At this time, the first version alignment component modifies the running address of application B to the address of the target update software in the software sharing area, and completes the software update for application B, so that the running addresses of application A and application B have been modified to the address of the target update software in the software sharing area. Therefore, no matter whether application A or application B is running, the target update software in the software sharing area is actually running, so that when application A and application B are running, the same software version is running, and the software version alignment of application A and application B is achieved.
[0084] In step S220, when it is determined that the target update software does not exist in the software sharing area, that is, when the application A is updated according to the update software, the first version alignment component stores the software file corresponding to the application A as the target update software in the software sharing area, so that the application in the software sharing area (that is, the target update software) is the same as the application A, and then the running address of the application B is modified to the address of the target update software in the software sharing area, and the software update for the application B is completed, so that when the application B is running, the target update software in the software sharing area is actually running, and then when the application A and the application B are running, the same software version is running, thereby achieving the software version alignment of the application A and the application B.
[0085] Since in actual applications there may be a situation where the software version needs to be rolled back, in this case, the software version can be rolled back simply by modifying the running address of the software.
[0086] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method. If the software update process is a software version upgrade process, then when it is necessary to perform software version rollback processing on application B, the method also includes: a first version alignment component modifies the running address of application B back to the running address of application B before the software update processing is performed.
[0087] By adopting the above technical solution, the running address of application B can be modified back to the running address of application B before the software update, without the need for additional erasing and flashing processing, and the software version of application B can be rolled back to the version before the software update of application B.
[0088] Since the software update for application B may fail in actual applications, in order to ensure that the software update for application B is completed and the software versions of application A and application B are aligned, other backup methods are needed to update the software of the application.
[0089] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, wherein application A also includes a first software upgrade component. In the event that the software update for application B fails, the method further includes: the first software upgrade component performs software update processing on application B according to the software update instruction and update software received from an external device, and after completing the software update processing for application B, modifies the application activation flag information to indicate the state of starting and running application B, so as to restart the control element, and start application B after the control element is restarted.
[0090] For example, Figure 7 As shown, the specific process includes:
[0091] S300: The ECU starts or restarts, and runs the startup management program in the boot loader in the ECU.
[0092] S400: Start the management program to determine activation flag information (ie, application activation flag information).
[0093] S500: If the current activation flag information indicates the state of starting and running application A, the startup management program starts and runs application A, and a jump time window is reserved, and the boot loader can be forced to stay in operation through instructions. At this time, all functions of application A run normally.
[0094] S600: The Update function software component of application A (ie, the first software upgrade component) receives a designated signal (ie, a software update instruction sent by an external device) to implement wired or wireless data interaction with an external diagnostic tool or a cloud server.
[0095] S700: The Update function software component of application A executes to update all or a single function component of the inactive application B. If the upgrade is successful, the activation flag information is modified to indicate startup operation. If application A also needs to perform software update through the software upgrade component, the ECU is restarted, the startup management program in the boot loader is run, and the startup management program determines the activation flag information. The Update function software component of application A receives the switching signal, determines the activation bit information, and jumps to run the corresponding application B according to the activation bit. Then, the software of application A can be updated through the Update function software of application B.
[0096] S800: When both application A and application B cannot be started normally, the software refresh program in the boot loader can replace the Update function software component to perform software update on application A or application B.
[0097] By adopting the above technical solution, when the software update for the second application fails, the first software upgrade component in application A can perform software update processing on application B, thereby completing the software update processing for application B.
[0098] It can be understood that the method of performing software update on the application in the ECU through the real boot loader can be used as a backup software update method of the software update method disclosed in the embodiment of the present invention to ensure that the software in the ECU can be updated.
[0099] The following describes a software update method disclosed in an embodiment of the present invention in combination with practical applications. Figure 8 As shown, the ECU non-volatile memory (Flash) space is divided into the Data Flash area and the Program Flash area. The Data Flash area is used to store software logistics data and related flag information. The flag information includes application activation flag information. The Program Flash area includes an application area, a software sharing area, and a boot loader area. The application area includes application software A (i.e., application A) and application software B (i.e., application B), and application software A and application software B each include N software functional components. The boot loader area includes a boot loader.
[0100] It should be noted that in the embodiments of the present invention, the ECU may be a single-core ECU or a multi-core ECU. In the case of a multi-core ECU, the architecture of the ECU is as follows: Fig. 9 As shown in the figure, the ECU includes two cores, namely Core1 and Core2, application A includes multiple software components (i.e., software component 1 to software component n in application A), and application B includes multiple software components (i.e., software component 1 to software component n in application B). Considering factors such as running load and functional coupling, the application components are arranged on the same or different cores, such as Fig. 9 As shown in , the application components are arranged on Core 1 and Core 2 respectively. The boot loader is shared by Core 1 and Core 2. Application A and Application B also include other basic software modules respectively.
[0101] It is understandable that the architecture of this multi-core ECU does not conflict with the aforementioned ECU Flash space partitioning method, and the architecture of the multi-core ECU does not affect the implementation of a software update method disclosed in the embodiment of the present invention. Through this multi-core architecture, different functional components (such as the first software upgrade component and the first version alignment component) in the same application (such as the first application) can be run on different cores, thereby improving the running speed.
[0102] The following describes a software update method disclosed in an embodiment of the present invention for a multi-core ECU. Fig.10 As shown, the specific process includes:
[0103] S10: After the ECU is started, the bootloader is run, and a certain application is started normally, for example, application A at this time. That is, application A is in the startup state.
[0104] S20: Application A is provided with a software component for automatic version alignment function (i.e., the first version alignment component), which is running. It has an automatic detection strategy, automatically checks related external refresh events and version differences, and triggers its function (i.e., software version update function) after comprehensive judgment. That is, when application A is in the startup state, if the first version alignment component determines that the software version update function startup conditions are met, the software version update function is started. Its function can also be directly forced to be triggered by artificial external instructions.
[0105] In the case where the update software (i.e., the target update software) is directly stored in the software sharing area, executing step S30 to implement the running address switching of the application B specifically includes:
[0106] S31: The version automatic alignment function software component starts to execute the software version update function.
[0107] S32: The software component of the automatic version alignment function will point the running address of application B to the address of the software sharing area (i.e., modify the running address of application B to the address of the target update software in the software sharing area) to achieve address switching, that is, when it is determined that the target update software exists in the software sharing area, the first version alignment component will modify the running address of application B to the address of the target update software in the software sharing area to complete the software update process for application B. There is no need to erase the current memory area software, and the software version alignment can be quickly achieved, which is suitable for updates with large amounts of software update data.
[0108] In the case where the update software is not stored in the shared memory area, executing step S30' to implement the running address switching of the application B specifically includes:
[0109] S33: The version automatic alignment function software component starts to execute the software version update function.
[0110] S34: The version automatic alignment function software component calls the mirror function to obtain application A data from application A.
[0111] S35: Application A synchronizes and images (i.e., copies) application A data (i.e., software files corresponding to application A) to the software sharing area. That is, when it is determined that the target update software does not exist in the software sharing area, the first version alignment component stores the software files corresponding to application A as the target update software in the software sharing area.
[0112] S36: The version automatic alignment function software component then points the running address of application B to the software sharing area address (i.e., modifies the running address of application B to the address of the target updated software in the software sharing area), implements address switching, and completes version synchronization. That is, the version automatic alignment function software component modifies the running address of application B to the address of the target updated software in the software sharing area, and completes the software update process for application B.
[0113] Because there is a software data imaging operation, it takes a certain amount of time and is suitable for updating software with small data. The above two methods both retain the previous data of application B. First, it can save the time of software erasing, and second, it can support the software to return to the previous version.
[0114] S40: After the version automatic alignment function software component is executed, a synchronization result is returned.
[0115] In practical applications, in some scenarios, a complete set of software update processing procedures needs to be implemented for application A and application B. According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software update method, the method comprising:
[0116] First, the second software upgrade component performs software update processing on application A according to the received software update instruction and update software sent by the external device when application B is in the startup state, and when the software update for application A is completed, the application activation flag information is modified to indicate the state of starting and running application A, so as to restart the control element, and start application A after the control element is restarted; or, when application B is in the startup state, the second software upgrade component stores the update software as the target update software in the software sharing area according to the received software update instruction and update software sent by the external device, and sends an instruction to the second version alignment component to start the software version update function, so that the second version alignment component modifies the running address of application A to the address of the target update software in the software sharing area, and modifies the application activation flag information to indicate the state of starting and running application A, so as to restart the control element, and start application A after the control element is restarted. When application A is in the startup state, if it is determined that the software version update function startup condition is met, the first version alignment component starts the software version update function, determines whether there is the target update software in the software sharing area, and the software version of the target update software is consistent with the software version of application A. When it is determined that the target update software exists in the software sharing area, the first version alignment component modifies the running address of application B to the address of the target update software in the software sharing area, and completes the software update processing for application B; when it is determined that the target update software does not exist in the software sharing area, the first version alignment component stores the software file corresponding to application A as the target update software in the software sharing area, and modifies the running address of application B to the address of the target update software in the software sharing area, and completes the software update processing for application B.
[0117] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a software updating method, wherein the control element is an electronic control unit, namely, ECU.
[0118] The control element in the embodiment of the present invention includes but is not limited to ECU, and may also be CPU (Central Processing Unit), GPU (graphics processing unit), NPU (Neural Network Processing Unit), etc.
[0119] A software update method disclosed by the embodiment of the present invention is adopted. When the start condition is met, the software version update function is started. The first version alignment component first determines whether there is a target update software in the software sharing area. If there is, the first version alignment component modifies the running address of the second application to the address of the target update software in the software sharing area, and completes the software update for the second application, so that when the second application is running, the target update software in the software sharing area is actually running, so that when the second application is running, the software version actually running is the same as the first application, and the version alignment of the first application and the second application is completed; if there is no, the first version alignment component stores the software file corresponding to the first application as the target update software in the software sharing area, and then modifies the running address of the second application to the address of the upgrade software in the sharing area, and completes the software update for the second application, so that when the second application is running, the target update software in the software sharing area is actually running, so that when the second application is running, the software version actually running is the same as the first application, and the version alignment of the first application and the second application is completed. In this way, the application software version update and alignment of two mutually standby applications in the control element can be conveniently and quickly realized, thereby reducing the software update time, reducing manpower consumption, and improving the software update efficiency and user experience.
[0120] See also Fig.11 , Fig.11 The figure shows a structural block diagram of an electronic device provided by an implementation of the present invention. In one implementation of the present invention, the electronic device may be a vehicle. The electronic device may include one or more processors 1002, a system control logic 1008 connected to at least one of the processors 1002, a system memory 1004 connected to the system control logic 1008, and a non-volatile memory (NVM) connected to the system control logic 1008.
[0121] 1006 , and a network interface 1010 connected to the system control logic 1008 .
[0122] The processor 1002 may include one or more single-core or multi-core processors. The processor 1002 may include any combination of general-purpose processors and special-purpose processors (eg, graphics processors, application processors, baseband processors, etc.).
[0123] In some implementations, the system control logic 1008 may include any suitable interface controller to provide any suitable interface to at least one of the processors 1002 and / or any suitable device or component in communication with the system control logic 1008 .
[0124] In some implementations, the system control logic 1008 may include one or more memory controllers to provide an interface to the system memory 1004. The system memory 1004 may be used to load and store data and / or instructions. In some implementations, the system memory 1004 of the electronic device may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).
[0125] NVM / memory 1006 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some implementations, NVM / memory 1006 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as a hard disk drive (HDD), a compact disc (CD) drive, and a digital versatile disc (DVD) drive.
[0126] NVM / storage 1006 may include a portion of storage resources installed on a device of an electronic device, or it may be accessible by the device but not necessarily a portion of the device. For example, NVM / storage 1006 may be accessed over a network via network interface 1010 .
[0127] In one implementation, at least one of the processors 1002 may be packaged with logic for one or more controllers of the system control logic 1008 to form a system in a package (SiP). In one implementation, at least one of the processors 1002 may be integrated with logic for one or more controllers of the system control logic 1008 on the same die to form a system on chip (SoC).
[0128] The electronic device may further include an input / output (I / O) device 1012 .
[0129] Of course, the electronic device may further include other components to cooperate with the aforementioned components to execute the aforementioned image generation method.
[0130] In one implementation of the present invention, a computer-readable storage medium is also provided, in which computer instructions are stored. When the computer instructions are executed on a processor of an electronic device, the processor of the electronic device executes the technical solution of the software update method described in the above embodiment.
[0131] In some possible implementations, various aspects of the method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on a processor of an electronic device, the program code is used to enable the processor of the electronic device to execute the steps of the method according to various exemplary implementations of the present application described above in this specification. For example, the electronic device may execute the software update method described in the embodiments of the present application.
[0132] The program product may employ any combination of one or more readable media. The readable medium may be a readable data medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0133] In one implementation of the present invention, a computer-readable storage medium is also provided, in which computer instructions are stored. When the computer instructions are executed on a processor of an electronic device, the processor of the electronic device executes the technical solution of the software update method described in the above embodiment.
[0134] In some possible implementations, various aspects of the method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on a processor of an electronic device, the program code is used to enable the processor of the electronic device to execute the steps of the method according to various exemplary implementations of the present application described above in this specification. For example, the electronic device may execute the software update method described in the embodiments of the present application.
[0135] The program product may employ any combination of one or more readable media. The readable medium may be a readable data medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0136] In one implementation of the present invention, a computer program product is also provided, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the software update method in the above embodiment can be implemented.
[0137] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable information processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable information processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0138] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0139] These computer program instructions can also be loaded onto a computer or other programmable information processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0140] It should be noted that, in addition to the implementation methods of the present invention described in the above-mentioned specific embodiments, those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Although the description of the present invention is introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this implementation method. On the contrary, the purpose of introducing the invention in conjunction with the implementation method is to cover other options or modifications that may be extended based on the claims of the present invention. In order to provide a deep understanding of the present invention, the above description contains many specific details, and the present invention can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present invention, some specific details will be omitted in the description. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0141] It should be noted that in this specification, similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0142] The terms “first”, “second”, etc. are only used for distinguishing descriptions and should not be understood as indicating or implying relative importance.
[0143] Although the present invention has been illustrated and described with reference to certain preferred embodiments of the present invention, it should be understood by those skilled in the art that the above is a further detailed description of the present invention in conjunction with specific embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. Those skilled in the art may make various changes in form and details, including making several simple deductions or substitutions, without departing from the spirit and scope of the present invention.
Claims
1. A software updating method, characterized in that: Applied to a control element, the control element includes a software sharing area, a first application and a second application, the first application and the second application are backup applications for each other, the first application includes a first version alignment component, and the method includes: When the first application is in the startup state, the first version alignment component starts the software version update function if it is determined that the software version update function startup condition is met, and determines whether there is a target update software with a software version consistent with the software version of the first application in the software sharing area; When it is determined that the target update software exists in the software sharing area, the first version alignment component modifies the running address of the second application to the address of the target update software in the software sharing area, and completes the software update process for the second application; When it is determined that the target update software does not exist in the software sharing area, the first version alignment component stores the software file corresponding to the first application as the target update software in the software sharing area, and modifies the running address of the second application to the address of the target update software in the software sharing area, thereby completing the software update processing for the second application.
2. The software updating method according to claim 1, characterized in that: Determine whether the software version update function startup conditions are met, including: If it is determined that the software version of the first application is inconsistent with the software version of the second application, it is determined that the software version update function startup condition is met.
3. The software updating method according to claim 1 or 2, characterized in that: The control element further includes starting a boot loader, and the method further includes starting the first application in the following manner: When the control element is started, if the boot loader determines that the application to be started is the first application according to the application activation flag information, then the first application is started.
4. The software updating method according to any one of claims 1 to 3, characterized in that: The second application includes a second version alignment component and a second software upgrade component. Before the first application is started, the method further includes: The second software upgrade component performs software update processing on the first application according to the received software update instruction and update software sent by the external device when the second application is in the startup state, and modifies the application activation flag information to a state indicating the startup and running of the first application when the software update processing for the first application is completed, so as to restart the control element, and start the first application after the control element is restarted; or, When the second application is in the startup state, the second software upgrade component stores the update software as the target update software in the software sharing area according to the software update instruction and update software received from the external device, and sends an instruction to the second version alignment component to start the software version update function, so that the second version alignment component modifies the running address of the first application to the address of the target update software in the software sharing area, and modifies the application activation flag information to indicate the state of starting to run the first application, so as to restart the control element and start the first application after the control element is restarted.
5. The software updating method according to claim 4, characterized in that: The method further includes, the second software upgrade component determining, according to the received software update instruction and the update software sent by the external device, to perform software update on the first application or to store the update software as the target update software in the software sharing area in the following manner: The second software upgrade component determines the software flashing address information preset in the update software according to the software update instruction and the update software received from the external device; If the software flashing address information is the address information of the first application, performing the software update process on the first application; If the software flashing address information is the address information of the software sharing area, the update software is stored in the software sharing area as the target update software.
6. The software updating method according to claim 5, characterized in that: The software flashing address information in the update software is obtained by: When the data volume of the updated software is greater than or equal to a preset threshold, setting the address information of the software sharing area as the software flashing address information; When the data volume of the updated software is less than the preset threshold, the address information of the first application is set as the software flashing address information.
7. The software updating method according to any one of claims 1 to 6, characterized in that: The first application further includes a first software upgrade component. In the case where the software update for the second application fails, the method further includes: The first software upgrade component performs software update processing on the second application according to the software update instruction and update software received from the external device, and after completing the software update processing for the second application, modifies the application activation flag information to indicate the state of starting and running the second application, so as to restart the control element, and start the second application after the control element is restarted.
8. The software updating method according to any one of claims 1 to 7, characterized in that: If the software update process is a software version upgrade process, then in the case where a software version rollback process is required for the second application, the method further includes: The first version alignment component modifies the running address of the second application back to the running address of the second application before the software update process is performed.
9. The software updating method according to any one of claims 4 to 6, characterized in that: The external device includes an external diagnostic device or a cloud server.
10. The software updating method according to any one of claims 1 to 9, characterized in that: The control element is an electronic control unit.
