Application program upgrading method and device, electronic equipment and storage medium

By determining two program partitions in the ECU and upgrading the application self-flashing in the second program partition, the problem of unavailability of functions during the upgrade process in the prior art is solved, and the effect of users being able to use vehicle functions normally during the upgrade process is achieved.

CN120066541APending Publication Date: 2025-05-30CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510035126.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, the application upgrade process of ECU is carried out in the bootloader, and the functions in the APP cannot be used, resulting in some functions of the vehicle being unable to be used during the upgrade process, affecting the user's car use experience.

Method used

Two program partitions are determined in the electronic control unit, and the second program partition is used to perform self-flashing upgrade of the target application, and after completing the upgrade, the start address of the second program partition is mapped to the start address of the first program partition to realize the update of the upgraded application.

Benefits of technology

During the application upgrade process, users can use all the functions of the electronic control unit normally, which improves the user's car use experience and improves the efficiency of the upgrade process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066541A_ABST
    Figure CN120066541A_ABST
Patent Text Reader

Abstract

The invention provides an application program upgrading method and device, electronic equipment and a storage medium. The method comprises the steps that a first program partition of a current running application program and a second program partition used for program flashing and upgrading are determined in an electronic control unit; determining a target upgrade installation package corresponding to a target application program in the electronic control unit according to the second program partition; and flashing the target upgrade installation package to the second program partition so as to realize self-flashing upgrade of the target application program in the second program partition, and after the self-flashing upgrading of the target application program is completed, mapping the initial address of the second program partition to the initial address of the first program partition so as to realize the updating of the upgraded target application program. In this way, in the application program upgrading process, a user can normally use all functions of the electronic control unit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automotive electronics technology, and particularly to an application program upgrade method, device, electronic device, and storage medium. Background Art

[0002] With the development of automotive electronics and intelligence, the upgrade of application programs of commonly used in-vehicle ECUs (Electric Control Units) has become increasingly important. Currently, the mainstream upgrade solution for commonly used ECUs is single-partition upgrade. That is, if the Application program (application program) needs to be upgraded, it is necessary to use the UDS (Unified Diagnostic Services) protocol to switch the APP to the bootloader program (the bootloader of the embedded system), then flash the new version of the APP program to the APP partition, reset after completion, and finally jump from the bootloader to the APP to run the new version of the program.

[0003] However, the process of upgrading the ECU using the above method is carried out in the bootloader, and the functions in the APP cannot be used. For vehicle users, some functions of the vehicle cannot be used during the upgrade process, which will affect the user's vehicle use experience. Summary of the Invention

[0004] This application provides an application program upgrade method, device, electronic device, and storage medium to solve the problem that in the prior art, the process of upgrading the ECU is carried out in the bootloader, and the functions in the APP cannot be used. For vehicle users, some functions of the vehicle cannot be used during the upgrade process, which will affect the user's vehicle use experience.

[0005] In a first aspect, this application provides an application program upgrade method, including:

[0006] Determine a first program partition of the currently running application program and a second program partition for program flashing and upgrading in the electronic control unit;

[0007] Determine a target upgrade installation package corresponding to the target application program in the electronic control unit according to the second program partition;

[0008] Flash the target upgrade installation package to the second program partition to achieve self-flashing upgrade of the target application program in the second program partition;

[0009] After completing the self-flashing upgrade of the target application, map the starting address of the second program partition to the starting address of the first program partition to update the upgraded target application.

[0010] In a possible implementation manner, the flashing of the target upgrade installation package to the second program partition includes:

[0011] Obtain the installation package size of the target upgrade installation package and the partition address of the second program partition;

[0012] Determine the single-transmission and reception data volume corresponding to the electronic control unit;

[0013] According to the installation package size and the single-transmission and reception data volume, determine the transmission times corresponding to the target upgrade installation package;

[0014] Transmit the target upgrade installation package to the partition address according to the single-transmission and reception data volume and the transmission times, so as to flash the target upgrade installation package to the second program partition.

[0015] In a possible implementation manner, the determination of the single-transmission and reception data volume corresponding to the electronic control unit includes:

[0016] Obtain the communication rate and communication delay duration corresponding to the electronic control unit;

[0017] According to the communication rate and the communication delay duration, determine the maximum value of the single-transmission and reception data;

[0018] Determine the single-transmission and reception data volume according to the maximum value of the single-transmission and reception data, where the single-transmission and reception data volume is less than the maximum value of the single-transmission and reception data.

[0019] In a possible implementation manner, the determination of the target upgrade installation package corresponding to the target application program in the electronic control unit according to the second program partition includes:

[0020] Obtain multiple program upgrade installation packages corresponding to the target application program, where the sizes of each program upgrade installation package are different;

[0021] Determine the memory size corresponding to the second program partition;

[0022] Among the multiple program upgrade installation packages, determine the target upgrade installation package corresponding to the target application program in the electronic control unit according to the memory size.

[0023] In a possible implementation manner, before flashing the target upgrade installation package to the second program partition, it further includes:

[0024] Obtain a first vehicle state of the vehicle where the electronic control unit is located, where the first vehicle state includes the vehicle speed, vehicle fault condition, and communication condition of the vehicle;

[0025] Determine whether the vehicle meets the upgrade condition according to the first vehicle state, where the upgrade condition includes that the vehicle speed is less than a preset vehicle speed threshold, and the vehicle has no fault, and the communication is normal;

[0026] When the vehicle meets the upgrade condition, perform the step of flashing the target upgrade installation package to the second program partition.

[0027] In a possible implementation manner, before mapping the starting address of the second program partition to the starting address of the first program partition, it further includes:

[0028] Perform integrity verification and correctness verification on the target upgrade installation package flashed to the second program partition;

[0029] When the integrity verification passes and the correctness verification passes, perform the step of mapping the starting address of the second program partition to the starting address of the first program partition;

[0030] When the integrity verification fails or the correctness verification fails, re-perform the step of flashing the target upgrade installation package to the second program partition.

[0031] In a possible implementation manner, before mapping the starting address of the second program partition to the starting address of the first program partition, it further includes:

[0032] Obtain a second vehicle state of the vehicle where the electronic control unit is located;

[0033] Determine whether the vehicle meets the installation condition according to the second vehicle state, where the installation condition includes that the vehicle is in a parked state;

[0034] When the vehicle meets the installation condition, perform the step of mapping the starting address of the second program partition to the starting address of the first program partition.

[0035] In a second aspect, the present application provides an application program upgrade device, including:

[0036] A partition determination module, configured to determine a first program partition of the currently running application program in the electronic control unit, and a second program partition for program flashing and upgrading;

[0037] An installation package determination module, configured to determine a target upgrade installation package corresponding to a target application program in the electronic control unit according to the second program partition;

[0038] A flashing module, configured to flash the target upgrade installation package to the second program partition, so as to implement self-flashing upgrade of the target application program in the second program partition;

[0039] A mapping module, configured to map the starting address of the second program partition to the starting address of the first program partition after completing the self-flashing upgrade of the target application program, so as to implement the update of the upgraded target application program.

[0040] In a possible implementation manner, the flashing module includes:

[0041] A first sub-acquisition module, configured to acquire the installation package size of the target upgrade installation package and the partition address of the second program partition;

[0042] A first sub-determination module, configured to determine the single-transmission and reception data volume corresponding to the electronic control unit;

[0043] A second sub-determination module, configured to determine the number of transmissions corresponding to the target upgrade installation package according to the installation package size and the single-transmission and reception data volume;

[0044] A sub-transmission module, configured to transmit the target upgrade installation package to the partition address according to the single-transmission and reception data volume and the number of transmissions, so as to implement flashing the target upgrade installation package to the second program partition.

[0045] In a possible implementation manner, the first sub-determination module includes:

[0046] A first acquisition unit, configured to acquire the communication rate and communication delay duration corresponding to the electronic control unit;

[0047] A first determination unit, configured to determine the maximum value of the single-transmission and reception data corresponding thereto according to the communication rate and the communication delay duration;

[0048] A second determination unit, configured to determine the single-transmission and reception data volume according to the maximum value of the single-transmission and reception data, wherein the single-transmission and reception data volume is less than the maximum value of the single-transmission and reception data.

[0049] In a possible implementation manner, the installation package determination module includes:

[0050] A second sub-acquisition module, configured to acquire multiple program upgrade installation packages corresponding to the target application program, wherein the sizes of each program upgrade installation package are different;

[0051] A third sub-determination module, configured to determine the memory size corresponding to the second program partition;

[0052] A fourth sub-determination module, configured to determine a target upgrade installation package corresponding to a target application program in the electronic control unit according to the memory size among a plurality of the program upgrade installation packages.

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

[0054] A first status acquisition module, configured to acquire a first vehicle status of a vehicle where the electronic control unit is located, where the first vehicle status includes a vehicle speed, a vehicle fault condition, and a communication condition of the vehicle;

[0055] A first judgment module, configured to determine whether the vehicle meets an upgrade condition according to the first vehicle status, where the upgrade condition includes that the vehicle speed is less than a preset vehicle speed threshold, and the vehicle has no fault, and the communication is normal;

[0056] A first execution module, configured to execute a step of flashing the target upgrade installation package to the second program partition when the vehicle meets the upgrade condition.

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

[0058] A verification module, configured to perform integrity verification and correctness verification on the target upgrade installation package flashed to the second program partition;

[0059] A second execution module, configured to execute a step of mapping a start address of the second program partition to a start address of the first program partition when the integrity verification passes and the correctness verification passes;

[0060] A third execution module, configured to re-execute a step of flashing the target upgrade installation package to the second program partition when the integrity verification fails or the correctness verification fails.

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

[0062] A second status acquisition module, configured to acquire a second vehicle status of a vehicle where the electronic control unit is located;

[0063] A second judgment module, configured to determine whether the vehicle meets an installation condition according to the second vehicle status, where the installation condition includes that the vehicle is in a parked state;

[0064] A fourth execution module, configured to, when the vehicle meets the installation condition, execute the step of mapping the start address of the second program partition to the start address of the first program partition.

[0065] In a third aspect, the present application provides a device, including: a processor and a memory, where the processor is configured to execute an application program upgrade program stored in the memory to implement the application program upgrade method according to any one of the first aspects.

[0066] In a fourth aspect, the present application provides a storage medium, where the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the application program upgrade method according to any one of the first aspects.

[0067] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: In the method provided by the embodiments of the present application, first, a first program partition in which the currently running application program is located and a second program partition for program flashing and upgrading are determined in an electronic control unit. Then, a target upgrade installation package corresponding to the target application program in the electronic control unit is determined according to the second program partition, and the target upgrade installation package is flashed to the second program partition to implement self-flashing upgrade of the target application program in the second program partition. Finally, after the self-flashing upgrade of the target application program is completed, the start address of the second program partition is mapped to the start address of the first program partition to implement the update of the upgraded target application program. In the solution of the present application, there are two program partitions in the electronic control unit. During the process of self-flashing upgrade of the target application program in the second program partition, the original target application program can run normally in the first program partition. Thus, during the application program upgrade process, the user can normally use all functions of the electronic control unit. Description of the Drawings

[0068] The drawings here are incorporated into the description and form a part of this description, showing embodiments consistent with the present application and used together with the description to explain the principles of the present application.

[0069] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0070] One or more embodiments are exemplarily illustrated by the pictures in the corresponding drawings. These exemplary illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated. The drawings in the figures do not constitute a scale limitation.

[0071] Figure 1 It is a flowchart of an embodiment of an application program upgrade method provided by an embodiment of the present application;

[0072] Figure 2 It is an example of an application program running in partition A provided by an embodiment of the present application;

[0073] Figure 3 It is an example of switching from partition A to partition B provided by an embodiment of the present application;

[0074] Figure 4 It is a flowchart of an embodiment of writing the target upgrade installation package to the second program partition provided by an embodiment of the present application;

[0075] Figure 5 It is a block diagram of an embodiment of an application program upgrade device provided by an embodiment of the present application;

[0076] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0077] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0078] The following disclosure provides many different embodiments or examples for implementing different structures of the present application. To simplify the disclosure of the present application, components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present application. In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between various embodiments and / or settings discussed.

[0079] To solve the technical problem that in the prior art, the process of upgrading the ECU is carried out in the bootloader and the functions in the APP cannot be used. For users of vehicles, some functions of the vehicle cannot be used during the upgrade process, which will affect the user experience of using the vehicle. The present application provides an application program upgrade method. The electronic control unit contains two program partitions. During the self-flashing upgrade process of the target application program in the second program partition, the original target application program can run normally in the first program partition. Thus, during the application program upgrade process, users can normally use all the functions of the electronic control unit.

[0080] Figure 1 The flowchart of an embodiment of an application program upgrade method provided by an embodiment of the present application. In one embodiment, the method is applied to a host computer, for example, an external diagnostic instrument. As Figure 1 shown, the method includes the following steps:

[0081] Step 101, determine the first program partition where the currently running application program is located in the electronic control unit, and the second program partition for program flashing upgrade.

[0082] An application program upgrade method provided by an embodiment of the present application is implemented based on AUTOSAR (Automotive Open System Architecture) and is used to upgrade the application program in the ECU (Electronic Control Unit). In the application, the ECU is generally an ECU chip that can be partitioned (by controlling the registers of the chip to switch the memory area mapped to the CPU execution space). The host computer and the ECU implement data interaction through the UDS (Unified Diagnostic Services) protocol to complete the upgrade process of the application program in the ECU.

[0083] In an embodiment of the present application, the ECU contains two partitions. When it is necessary to upgrade the application program in the ECU, the host computer can send an upgrade instruction to the ECU. After receiving the upgrade instruction, the ECU calls the 0x10 switch session service to enter the programming session mode and reports the partition of the currently running application program and the partition of the non-running application program to the host computer. Based on the information reported by the ECU, the host computer determines the partition of the currently running application program as the first program partition and the partition of the currently non-running application program as the second program partition.

[0084] It should be noted that for the application program upgrade method provided in the embodiments of the present application, an APP (Application) performs self-flashing and does not need to enter the bootloader. Therefore, when switching to the programming session, there is no need to enter the bootloader mode, and it can be directly switched to the programming session in the APP mode.

[0085] Step 102: Determine the target upgrade installation package corresponding to the target application program in the electronic control unit according to the second program partition.

[0086] In the embodiments of the present application, step 102 may include the following steps: obtain multiple program upgrade installation packages corresponding to the target application program, where the sizes of each program upgrade installation package are different, determine the memory size corresponding to the second program partition, and in the multiple program upgrade installation packages, determine the target upgrade installation package corresponding to the target application program in the electronic control unit according to the memory size.

[0087] In the application, the target application program corresponds to multiple program upgrade installation packages of different sizes for different download addresses. Generally, larger program upgrade installation packages are used for downloading and installing corresponding to download addresses with larger memory, and smaller program upgrade installation packages are used for downloading and installing corresponding to download addresses with smaller memory.

[0088] Based on this, after the host computer determines the second program partition according to step 101, it can understand the memory size of the second program partition according to the information reported by the ECU, and determine the target upgrade installation package corresponding to the target application program according to the memory size of the second program partition. Thus, the size of the target upgrade installation package can be matched with the memory size of the second program partition to ensure that the subsequent upgrade installation process can be successfully completed.

[0089] Step 103: Flash the target upgrade installation package to the second program partition to realize the self-flashing upgrade of the target application program in the second program partition.

[0090] In the embodiments of the present application, to complete the flashing, services 0x34 (file download), 0x36 (data transfer), and 0x37 (transfer exit) in the diagnostic service are required.

[0091] Specifically, first, relevant information required for flashing is sent through the 0x34 service callback function. For example, the download address of the flashing partition (i.e., the partition address of the second program partition), the size of the target upgrade installation package, and the length of the data downloaded in a single time by the 0x36 service subsequently. After the 0x34 service is completed, data (i.e., the target upgrade installation package) is transmitted through the 0x36 service. After the 0x36 transmission is completed, the process exits through the 0x37 service (transmission exit). Thus, the self-flashing upgrade of the target application program in the second program partition is realized.

[0092] It should be noted that in the prior art, the 0x34 service, 0x36 service, and 0x37 service are configured under the bootloader. In this application, to achieve the self-flashing of the APP, these services need to be configured in the APP program. In addition, the implementation of these services is achieved by calling the corresponding callback functions in the task.

[0093] In the application, since the flashing task will occupy some threads, to ensure the normal operation of the current APP (i.e., the target application program), it is necessary to first ensure that the current device conditions are sufficient to support the completion of self-flashing and the task before starting the flashing process. Therefore, in another embodiment of this application, before step 103, the following steps may further be included:

[0094] Step A1: Obtain the first vehicle state of the vehicle where the electronic control unit is located, where the first vehicle state includes the vehicle speed, vehicle fault condition, and communication condition of the vehicle;

[0095] Step A2: Determine whether the vehicle meets the upgrade conditions according to the first vehicle state, where the upgrade conditions include that the vehicle speed is less than a preset vehicle speed threshold, and the vehicle has no faults, and the communication is normal;

[0096] Step A3: When the vehicle meets the upgrade conditions, execute the step of flashing the target upgrade installation package to the second program partition.

[0097] The vehicle speed is used to represent the current running speed of the vehicle; the vehicle fault condition is used to represent whether there are current faults in the vehicle; the communication condition is used to represent whether the current communication of the vehicle is normal.

[0098] In the application, during the operation of the device, the sensors of the ECU will collect the state data of the device by themselves. For example, the speed sensor will collect the speed of the current device. If there are device faults or state changes, the sensors communicate with the ECU through internal serial ports and other means to transmit the corresponding state information, thereby writing the corresponding device state into the DID (Data Identifier).

[0099] Based on this, in this embodiment, the host computer can understand the vehicle status by reading the information in the DID, and determine whether the flashing process can be started currently by judging whether the vehicle status meets the upgrade conditions. Specifically, when the vehicle speed is less than the preset vehicle speed threshold (such as 60 km / h), and the vehicle has no faults, and the communication is normal, it is determined to execute the flashing process of step 103. In this way, it can be ensured that the current vehicle conditions are sufficient to support the completion of self-flashing and tasks before starting the flashing process, avoiding process interruption.

[0100] Step 104: After completing the self-flashing upgrade of the target application program, map the starting address of the second program partition to the starting address of the first program partition to update the upgraded target application program.

[0101] In the embodiment of the present application, after completing the self-flashing upgrade of the target application program, through the partition switching operation, the starting address of the second program partition is mapped to the starting address of the first program partition. Then, the application program runs the target application program in the second program partition after the boot ends, thereby realizing the update and installation of the upgraded target application program.

[0102] Among them, the partition switching operation refers to switching the running area of the APP. By changing the value of the ECU register, the mapping relationship between the logical address and the physical address is changed, so that it runs the application programs stored in different areas of the device to achieve the effect of partition switching.

[0103] Figure 2 The following shows an example of running the application program in partition A, such as Figure 2 As shown, the program starts running from the boot program until it runs the application program in partition A.

[0104] Figure 3 The following shows an example of switching from partition A to partition B, such as Figure 3 As shown, through the partition switching operation, the starting address 0x02080000 of partition B is mapped to the starting address 0x80000 of partition A. Then, the program runs the application program in partition B after the boot ends. Thus, the partition exchange and the update and installation of the application program are completed.

[0105] In the application, there may be situations where the installation package is incomplete or incorrect. For this reason, in another embodiment of the present application, before step 104, the following steps may further be included:

[0106] Perform integrity verification and correctness verification on the target upgrade installation package flashed to the second program partition; in the case where the integrity verification passes and the correctness verification passes, execute the step of mapping the start address of the second program partition to the start address of the first program partition; in the case where the integrity verification fails or the correctness verification fails, re-execute the step of flashing the target upgrade installation package to the second program partition.

[0107] In the application, after the flashing is completed, the target application will write and save the version information related to the upgrade (such as version number, vendor code, factory time, component code, etc.) into the corresponding DID. This function is implemented through the 2E (WriteDataByIdentifier, write data by identifier) service.

[0108] It should be noted that in the prior art, generally, the 2E service and the permission to write the version information related to the upgrade are only available in the bootloader mode. In this application, the APP performs self-flashing, and the upgrade process is completed in the programming session mode of the APP. Therefore, it is necessary to configure the 2E service and the write data permission related to the upgrade to be available in the programming session mode.

[0109] Based on this, the host computer can understand the version information of the target application by reading the information in the DID, and perform verification on the integrity (such as whether the installation package size is correct) and correctness (such as whether the installation package version is correct) of the program flashed by the APP through CRC verification or security signature verification. If the verification passes, set a flag bit in the D-FLASH to indicate successful flashing. If the verification fails, set a flag bit in the D-FLASH to indicate failed flashing. In this way, the subsequent ECU can obtain the value of this flag bit through the absolute address and determine whether to perform a partition switching operation or re-perform the flashing according to the value of this flag bit. That is, in the case where the verification passes, execute the partition switching operation in step 104, and in the case where the verification fails, re-execute the flashing process in step 103.

[0110] Through this solution, it can be ensured that the partition switching operation is only performed when the target upgrade installation package in the second program partition is complete and correct, so that it can be ensured that the target application can be successfully updated and installed during the partition switching operation.

[0111] In addition, since the device will restart after the program update and installation, in order to prevent sudden shutdown and restart during the user's driving, which may affect the user experience, in another embodiment of the present application, before step 104, the following steps may further be included: obtaining the second vehicle state of the vehicle where the electronic control unit is located; determining whether the vehicle meets the installation conditions according to the second vehicle state, where the installation conditions include that the vehicle is in a parked state; and performing the step of mapping the start address of the second program partition to the start address of the first program partition when the vehicle meets the installation conditions.

[0112] As can be seen from the above description, in this embodiment, the update and installation process of step 104 is only executed when the vehicle is in a parked state. In this way, sudden shutdown and restart during the user's driving can be avoided, thereby improving the user experience.

[0113] The technical solution provided by the embodiment of the present application is as follows: First, in the electronic control unit, determine the first program partition of the currently running application program and the second program partition for program flashing and upgrading. Then, according to the second program partition, determine the target upgrade installation package corresponding to the target application program in the electronic control unit, and flash the target upgrade installation package to the second program partition to achieve self-flashing upgrade of the target application program in the second program partition. Finally, after completing the self-flashing upgrade of the target application program, map the start address of the second program partition to the start address of the first program partition to update the upgraded target application program. In the solution of the present application, there are two program partitions in the electronic control unit. During the process of self-flashing upgrade of the target application program in the second program partition, the original target application program can run normally in the first program partition. In this way, during the application program upgrade process, the user can normally use all functions of the electronic control unit.

[0114] Figure 4 This is a flowchart of an embodiment for flashing the target upgrade installation package to the second program partition provided by the embodiment of the present application. Figure 4 The shown process is Figure 1 Based on the shown process, it includes the following steps:

[0115] Step 401: Obtain the installation package size of the target upgrade installation package and the partition address of the second program partition.

[0116] In the embodiment of the present application, the host computer can obtain the installation package size of the target upgrade installation package and the partition address of the second program partition, and send the partition address and the installation package size simultaneously when sending the 0x34 service to the ECU, so as to facilitate the subsequent flashing process according to the partition address and the installation package size.

[0117] Step 402: Determine the amount of data transmitted and received in a single time corresponding to the electronic control unit.

[0118] The amount of data transmitted and received in a single time refers to the amount of data transmitted to the second program partition in a single time.

[0119] In the embodiment of the present application, step 402 may specifically include the following steps:

[0120] Obtain the communication rate and communication delay duration corresponding to the electronic control unit; determine the maximum value of the data transmitted and received in a single time according to the communication rate and the communication delay duration; determine the amount of data transmitted and received in a single time according to the maximum value of the data transmitted and received in a single time, where the amount of data transmitted and received in a single time is less than the maximum value of the data transmitted and received in a single time.

[0121] In this implementation manner, the maximum value of the data transmitted and received in a single time (i.e., the maximum amount of data that can be transmitted and received in a single time) can be obtained by calculating the product of the communication rate and the communication delay duration. Then, according to the actual situation, a value less than the maximum value of the data transmitted and received in a single time is determined as the value of the data carried and downloaded in a single time (i.e., the amount of data transmitted and received in a single time). In this way, it is possible to avoid the amount of data transmitted and received in a single time exceeding the maximum amount of data that can be transmitted and received in a single time, and ensure smooth communication.

[0122] For example, when the current device uses CANFD communication and the communication rate is selected as 2 Mbps, the number of bytes transmitted per second is 2000 * 1000 / 8 = 250000 bytes, that is, 250 kb / s = 0.25 kb / ms. Assuming the communication delay is 10 ms, the maximum value of the data transmitted and received in a single time is: 0.25 kb / ms × 10 ms = 2.5 kb = 2500 bytes. Then, a value less than 2500 (such as 2k, that is, 2048) can be selected as the amount of data transmitted and received in a single time.

[0123] Step 403: Determine the number of transmissions corresponding to the target upgrade installation package according to the size of the installation package and the amount of data transmitted and received in a single time.

[0124] In the embodiment of the present application, after obtaining the size of the installation package and the amount of data transmitted and received in a single time, the ratio of the size of the installation package to the amount of data transmitted and received in a single time can be calculated, so as to obtain the number of transmissions required to completely transmit the target upgrade installation package to the second program partition.

[0125] Step 404: Transmit the target upgrade installation package to the partition address according to the amount of data transmitted and received in a single time and the number of transmissions, so as to implement flashing the target upgrade installation package to the second program partition.

[0126] In the embodiment of the present application, after obtaining the single - transceiver data volume and the number of transmissions, the 0x36 service is used to transmit the single - transceiver data volume each time for the above - mentioned number of transmissions, so as to implement the transmission of the target upgrade installation package to the partition address of the second program partition. After the transmission is completed, the 0x37 service (transmission exit) is used to exit.

[0127] Through Figure 4 The process shown can, according to the installation package size of the target upgrade installation package, the partition address of the second program partition, and the single - transceiver data volume corresponding to the electronic control unit, implement flashing the target upgrade installation package to the second program partition. Through the automated and intelligent upgrade process, manual intervention is reduced, and the development and maintenance efficiency are improved.

[0128] Figure 5 It is a block diagram of an embodiment of an application program upgrade device provided by an embodiment of the present application. As Figure 5 shown, the device includes:

[0129] A partition determination module 51, configured to determine a first program partition where the currently running application program is located in the electronic control unit, and a second program partition for program flashing and upgrading;

[0130] An installation package determination module 52, configured to determine a target upgrade installation package corresponding to the target application program in the electronic control unit according to the second program partition;

[0131] A flashing module 53, configured to flash the target upgrade installation package to the second program partition to implement self - flashing and upgrading of the target application program in the second program partition;

[0132] A mapping module 54, configured to map the starting address of the second program partition to the starting address of the first program partition after completing the self - flashing and upgrading of the target application program, so as to implement the update of the upgraded target application program.

[0133] In a possible implementation manner, the flashing module includes:

[0134] A first sub - acquisition module, configured to acquire the installation package size of the target upgrade installation package and the partition address of the second program partition;

[0135] A first sub - determination module, configured to determine the single - transceiver data volume corresponding to the electronic control unit;

[0136] A second sub - determination module, configured to determine the number of transmissions corresponding to the target upgrade installation package according to the installation package size and the single - transceiver data volume;

[0137] A sub - transmission module, configured to transmit the target upgrade installation package to the partition address according to the single - time data transmission and reception volume and the number of transmission times, so as to implement flashing the target upgrade installation package to the second program partition.

[0138] In a possible implementation manner, the first sub - determination module includes:

[0139] A first acquisition unit, configured to acquire the communication rate and communication delay duration corresponding to the electronic control unit;

[0140] A first determination unit, configured to determine the maximum value of single - time data transmission and reception corresponding thereto according to the communication rate and the communication delay duration;

[0141] A second determination unit, configured to determine the single - time data transmission and reception volume according to the maximum value of single - time data transmission and reception, where the single - time data transmission and reception volume is less than the maximum value of single - time data transmission and reception.

[0142] In a possible implementation manner, the installation package determination module includes:

[0143] A second sub - acquisition module, configured to acquire multiple program upgrade installation packages corresponding to the target application program, where the sizes of each program upgrade installation package are different;

[0144] A third sub - determination module, configured to determine the memory size corresponding to the second program partition;

[0145] A fourth sub - determination module, configured to determine the target upgrade installation package corresponding to the target application program in the electronic control unit according to the memory size among the multiple program upgrade installation packages.

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

[0147] A first status acquisition module, configured to acquire the first vehicle status of the vehicle where the electronic control unit is located, where the first vehicle status includes the vehicle speed, vehicle fault condition, and communication condition of the vehicle;

[0148] A first judgment module, configured to determine whether the vehicle meets the upgrade condition according to the first vehicle status, where the upgrade condition includes that the vehicle speed is less than a preset vehicle speed threshold, and the vehicle has no fault, and the communication is normal;

[0149] A first execution module, configured to execute the step of flashing the target upgrade installation package to the second program partition when the vehicle meets the upgrade condition.

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

[0151] A verification module, configured to perform integrity verification and correctness verification on the target upgrade installation package flashed to the second program partition;

[0152] A second execution module, configured to perform the step of mapping the start address of the second program partition to the start address of the first program partition when the integrity verification passes and the correctness verification passes;

[0153] A third execution module, configured to re - execute the step of flashing the target upgrade installation package to the second program partition when the integrity verification fails or the correctness verification fails.

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

[0155] A second status acquisition module, configured to acquire a second vehicle status of the vehicle where the electronic control unit is located;

[0156] A second judgment module, configured to determine whether the vehicle meets the installation conditions according to the second vehicle status, where the installation conditions include that the vehicle is in a parked state;

[0157] A fourth execution module, configured to perform the step of mapping the start address of the second program partition to the start address of the first program partition when the vehicle meets the installation conditions.

[0158] As Figure 6 shown, an embodiment of the present application provides a device, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114. Among them, the processor 111, the communication interface 112, and the memory 113 complete mutual communication through the communication bus 114.

[0159] The memory 113 is configured to store a computer program;

[0160] In an embodiment of the present application, when the processor 111 is configured to execute the program stored on the memory 113, it implements the application program upgrade method provided by any one of the foregoing method embodiments, including:

[0161] Determine a first program partition of the currently running application program in the electronic control unit, and a second program partition for program flashing and upgrading;

[0162] Determine a target upgrade installation package corresponding to the target application program in the electronic control unit according to the second program partition;

[0163] Flash the target upgrade installation package to the second program partition to implement self - flashing and upgrading of the target application program in the second program partition;

[0164] After completing the self-flashing upgrade of the target application, map the starting address of the second program partition to the starting address of the first program partition to update the upgraded target application.

[0165] The embodiments of the present application also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the application program upgrade method provided in any one of the foregoing method embodiments are implemented.

[0166] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0167] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the related technology, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0168] It should be understood that the terms used in this document are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless otherwise clearly specified in the context, the singular forms "a", "an", and "the" as used in this document may also represent the plural form. The terms "include", "comprise", "contain", and "have" are inclusive and thus specify the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described in this document are not to be construed as necessarily requiring them to be executed in the specific order described or illustrated, unless the execution order is clearly specified. It should also be understood that additional or alternative steps can be used.

[0169] The above description is only a specific embodiment of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for upgrading an application, characterized in that: The method comprises: Determine in the electronic control unit a first program partition for a currently running application program and a second program partition for program flash upgrade; Determining a target upgrade installation package corresponding to a target application program in the electronic control unit according to the second program partition; Flashing the target upgrade installation package to the second program partition to implement a self-flash upgrade of the target application program in the second program partition; After the self-flash upgrade of the target application is completed, the start address of the second program partition is mapped to the start address of the first program partition to implement the update of the upgraded target application.

2. The method according to claim 1, characterized in that: The step of flashing the target upgrade installation package to the second program partition includes: Obtaining the installation package size of the target upgrade installation package and the partition address of the second program partition; Determine the amount of data received and sent in a single time corresponding to the electronic control unit; Determine the number of transmissions corresponding to the target upgrade installation package according to the size of the installation package and the amount of data sent and received at a single time; According to the single data transmission and reception amount and the number of transmissions, the target upgrade installation package is transmitted to the partition address, so as to flash the target upgrade installation package to the second program partition.

3. The method according to claim 2, characterized in that The determining the single amount of data sent and received corresponding to the electronic control unit includes: Obtaining the communication rate and communication delay duration corresponding to the electronic control unit; Determine a corresponding maximum value of single received and sent data according to the communication rate and the communication delay duration; The single-time received and sent data amount is determined according to the single-time received and sent data maximum value, wherein the single-time received and sent data amount is less than the single-time received and sent data maximum value.

4. The method according to claim 1, characterized in that: The step of determining a target upgrade installation package corresponding to a target application program in the electronic control unit according to the second program partition includes: Acquire multiple program upgrade installation packages corresponding to the target application, wherein each program upgrade installation package has a different size; Determining a memory size corresponding to the second program partition; Among the multiple program upgrade installation packages, a target upgrade installation package corresponding to a target application program in the electronic control unit is determined according to the memory size.

5. The method according to claim 1, characterized in that Before flashing the target upgrade installation package to the second program partition, the method further includes: Acquire a first vehicle state of the vehicle where the electronic control unit is located, wherein the first vehicle state includes a speed, a vehicle fault condition, and a communication condition of the vehicle; Determining whether the vehicle meets an upgrade condition according to the first vehicle state, wherein the upgrade condition includes that the vehicle speed is less than a preset vehicle speed threshold, the vehicle has no faults, and the communication is normal; When the vehicle meets the upgrade condition, the step of flashing the target upgrade installation package to the second program partition is performed.

6. The method according to claim 1, characterized in that Before mapping the start address of the second program partition to the start address of the first program partition, the method further includes: Performing integrity check and correctness check on the target upgrade installation package flashed to the second program partition; When the integrity check passes and the correctness check passes, executing the step of mapping the start address of the second program partition to the start address of the first program partition; If the integrity check fails or the correctness check fails, the step of flashing the target upgrade installation package to the second program partition is performed again.

7. The method according to claim 1, characterized in that Before mapping the start address of the second program partition to the start address of the first program partition, the method further includes: Acquire a second vehicle state of the vehicle where the electronic control unit is located; determining whether the vehicle meets an installation condition according to the second vehicle state, wherein the installation condition includes that the vehicle is in a parking state; In a case where the vehicle meets the installation condition, a step of mapping the start address of the second program partition to the start address of the first program partition is performed.

8. An application program upgrade device, characterized in that: The device comprises: A partition determination module, used to determine a first program partition for a currently running application program in an electronic control unit, and a second program partition for program flash upgrade; An installation package determination module, used to determine a target upgrade installation package corresponding to a target application program in the electronic control unit according to the second program partition; A flashing module, used for flashing the target upgrade installation package to the second program partition, so as to realize a self-flash upgrade of the target application program in the second program partition; A mapping module is used to map the starting address of the second program partition to the starting address of the first program partition after completing the self-flash upgrade of the target application program, so as to implement the update of the upgraded target application program.

9. A device, characterized in that: include: A processor and a memory, wherein the processor is used to execute an application upgrade program stored in the memory to implement the application upgrade method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the application program upgrade method described in any one of claims 1-7.