Application program upgrading method and device, equipment and medium

By dividing and managing the storage areas of the target electronic devices, the reliability problem during partitionless system upgrade is solved, and the effect of reducing memory chip wear and recording upgrade failure information is achieved.

CN119718380APending Publication Date: 2025-03-28IMOTION AUTOMOTIVE TECH (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411885843.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When upgrading using a partitionless system, how to ensure the normal operation of the system to improve the reliability of the upgrade, especially after the upgrade failed, you can try to upgrade again based on the cause of the failure and version information.

Method used

By dividing the storage area of ​​the target electronic device, the first type of storage area is used to store data related to the current operating state, and the second type of storage area is used to store data related to the operation state of the previous flashing time. When obtaining the flash write request sent by the upper computer, the first and second types of data are written to the cache area respectively to determine whether the data in the cache area is the same. If the same, it will remain unchanged. Update the reprogramming flag bit and power up again to start, and execute the boot loader for upgrade; if the upgrade fails, record the current version information and log files.

Benefits of technology

It reduces the number of erasing and writing times of the memory chip, extends the service life of the memory chip, and ensures that the information data and the reasons for the old version after the upgrade failure can be recorded, thus helping to analyze the subsequent re-upgrade and the problem of upgrade failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718380A_ABST
    Figure CN119718380A_ABST
Patent Text Reader

Abstract

The invention discloses an application program upgrading method and device, equipment and a medium, and relates to the technical field of computers.The application program upgrading method comprises the steps that when a flash request sent by an upper computer is obtained, data which are stored in a first-class storage area and related to the current running state of a target application program are written into a first cache area, writing data which is stored in the second type of storage area and is related to the running state of the target application program at the last flashing moment into a second cache area; judging whether the data stored in the first cache region and the data stored in the second cache region are the same or not, if yes, keeping the data in the second type of storage region unchanged, updating the reprogramming flag bit, electrifying and starting again, and then executing the boot loader to upgrade the target application program based on the software upgrade package by utilizing the boot loader; and detecting whether the target application program is successfully upgraded or not, and if the target application program fails to be upgraded, recording the current version information of the target application program and the log file of the upgrading to the second type of storage area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an application program upgrading method, device, equipment and medium. Background Art

[0002] As electronicization becomes more and more popular in daily life, software updates and iterations of electronic devices are also frequently carried out. At present, electronic device upgrades are mainly divided into two systems, namely, the AB partition system and the non-partition system. In the AB partition system, since both partitions need to be stored and run, more storage space and processor resources are required, and the AB partition system is more complex in design, resulting in higher development and maintenance costs.

[0003] In contrast, a partitionless system does not require redundant storage space and processor resources because it only has one system partition and resources can be used more efficiently. However, when a software failure occurs in a partitionless system, the system may fail completely due to the lack of redundant backup, affecting the normal operation of the system. Therefore, for a partitionless system, it is necessary to ensure that when the current upgrade fails, the upgrade can be attempted again based on the failure reason and version information, so as to ensure the normal operation of the system.

[0004] In summary, when using a partition-free system for upgrading, how to ensure the normal operation of the system to improve the reliability of the upgrade is a problem that needs to be solved. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide an application upgrade method, device, equipment and medium, which can ensure the normal operation of the system when upgrading using a partition-free system to improve the reliability of the upgrade. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses an application program upgrade method, which is applied to a target electronic device, comprising:

[0007] When a flashing request sent by the host computer is obtained, the first data stored in the first type of storage area is written into the first cache area, and the second data stored in the second type of storage area is written into the second cache area; wherein the first data is data related to the current running state of the target application, and the second data is data related to the running state of the target application at the last flashing moment;

[0008] Determine whether the data stored in the first cache area and the second cache area are the same, if they are the same, keep the data in the second storage area unchanged, update the reprogramming flag and restart the power, and then execute the boot loader to upgrade the target application based on the software upgrade package using the boot loader;

[0009] Detect whether the target application is successfully upgraded. If the upgrade fails, record the current version information of the target application and the log file of this upgrade into the second type of storage area.

[0010] Optionally, the first type of storage area includes a random access memory, a read-only memory and a first non-volatile memory, and the second type of storage area is a second non-volatile memory; wherein the random access memory is used to store data and instructions required for the operation of the operating system and the target application, the read-only memory is used to store the version number and integration packaging time of the target application, the first non-volatile memory is used to store data in the target application that needs to be saved after power-off, and the second non-volatile memory is used to store data in the boot loader that needs to be saved after power-off.

[0011] Optionally, before obtaining the flash request sent by the host computer, it also includes:

[0012] Detecting corresponding parameters based on preset detection items, and judging whether the upgrade conditions are currently met based on the detection results; wherein the preset detection items are detection items based on any one or more of voltage detection, vehicle speed detection, gear position detection and engine speed detection;

[0013] If the upgrade condition is not met currently, a message indicating that the upgrade condition is not met currently is sent to the host computer; if the upgrade condition is met currently, the flashing request sent by the host computer is responded to.

[0014] Optionally, the detecting corresponding parameters based on preset detection items, and judging whether the upgrade condition is currently met based on the detection result, includes:

[0015] Detect whether the current voltage value is within the preset range, if so, determine that the voltage detection is passed;

[0016] and / or, detecting whether the current vehicle speed is zero, and if so, determining that the vehicle speed detection passes;

[0017] and / or, detecting whether the current gear is in the parking gear, and if so, determining that the gear detection is passed;

[0018] and / or, detecting whether the current engine speed is zero, and if so, determining that the engine speed detection passes;

[0019] If the detection results of all preset detection items are passed, it is determined that the current upgrade conditions are met.

[0020] Optionally, after determining whether the data stored in the first cache area and the data stored in the second cache area are the same, the method further includes:

[0021] If the data stored in the first cache area is different from the data stored in the second cache area, the second type of storage area is updated using the data stored in the first cache area, and the second type of storage area is powered on again after the update is completed;

[0022] Correspondingly, after the second type of storage area is updated using the data stored in the first cache area, the method further includes:

[0023] detecting whether the second-type storage area is updated successfully;

[0024] If the update of the second type of storage area fails, the upgrade operation is terminated;

[0025] If the second type of storage area is updated successfully, power on again to start.

[0026] Optionally, the restarting the power supply after the update of the second-type storage area is completed includes:

[0027] After the update of the second type storage area is completed, the reprogramming flag is set to a target value, and the power is turned on again;

[0028] Accordingly, the step of upgrading the target application program based on the software upgrade package by using the boot loader includes:

[0029] When the boot loader detects that the reprogramming flag is the target value, the target application is upgraded based on a software upgrade package.

[0030] Optionally, after recording the current version information of the target application and the log file of this upgrade to the second type of storage area, the method further includes:

[0031] Analyzing the current version information and the log file in the second storage area by the host computer using a diagnostic tool to obtain the cause of the upgrade failure;

[0032] After performing a corresponding upgrade failure processing flow based on the upgrade failure reason, the host computer resends the flash write request.

[0033] In a second aspect, the present application discloses an application program upgrade device, which is applied to a target electronic device, comprising:

[0034] A data writing module is used to write the data related to the current running state of the target application stored in the first storage area into the first cache area when a flashing request sent by the host computer is obtained, and write the data related to the running state of the target application at the last flashing moment stored in the second storage area into the second cache area;

[0035] a judgment module, used for judging whether the data stored in the first cache area and the second cache area are the same, and if they are the same, keeping the data in the second type of storage area unchanged, updating the reprogramming flag bit and restarting the power supply, and then executing the boot loader to upgrade the target application based on the software upgrade package by using the boot loader;

[0036] The information recording module is used to detect whether the target application is successfully upgraded. If the upgrade fails, the current version information of the target application and the log file of this upgrade are recorded in the second type of storage area.

[0037] In a third aspect, the present application discloses an electronic device, including:

[0038] Memory, used to store computer programs;

[0039] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed application program upgrade method.

[0040] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed application program upgrade method are implemented.

[0041] It can be seen that in the present application, when the target electronic device obtains the flash request sent by the host computer, the first data stored in the first type of storage area is written into the first cache area, and the second data stored in the second type of storage area is written into the second cache area; wherein, the first data is data related to the current running state of the target application, and the second data is data related to the running state of the target application at the last flashing moment; it is determined whether the data stored in the first cache area and the second cache area are the same, if they are the same, the data in the second type of storage area is kept unchanged, the reprogramming flag is updated and the power is restarted, and then the boot loader is executed to use the boot loader to upgrade the target application based on the software upgrade package; it is detected whether the target application is upgraded successfully. If the upgrade fails, the current version information of the target application and the log file of this upgrade are recorded in the second type of storage area.

[0042] Beneficial effect: The present application first divides the storage area inside the target electronic device, the first type of storage area is used to store the first data related to the current running state of the target application, and the second type of storage area is used to store the second data related to the running state of the target application at the last flashing moment. Therefore, when the flashing request sent by the host computer is obtained, it is first necessary to write the first data stored in the first type of storage area into the first cache area, and write the second data stored in the second type of storage area into the second cache area, and then determine whether the data stored in the first cache area and the second cache area are the same. If they are the same, it means that the current running state has not changed in data compared to the running state at the last flashing moment. Therefore, the data in the second type of storage area is kept unchanged, and there is no need to use the data stored in the first cache area to update the second type of storage area, thereby reducing the number of erase and write of the storage chip and extending the service life of the storage chip. Furthermore, when the data stored in the first cache area and the second cache area are the same, the reprogramming flag is updated and the power is restarted, and then the boot loader is executed to upgrade the target application based on the software upgrade package using the boot loader. If the target application fails to be upgraded, the current version information of the target application and the log file of this upgrade are recorded in the second storage area to ensure that the information data of the old version and the reason for the failure can be recorded after the upgrade fails, thereby facilitating subsequent re-upgrades and analysis of upgrade failures. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0044] Figure 1 A flow chart of an application program upgrade method disclosed in this application;

[0045] Figure 2 A schematic diagram of a regional division disclosed in this application;

[0046] Figure 3 A flowchart of a specific application program upgrade method disclosed in this application;

[0047] Figure 4 A flowchart of an application upgrade disclosed in this application;

[0048] Figure 5 A schematic diagram of the structure of an application program upgrade device disclosed in this application;

[0049] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0051] At present, electronic equipment upgrades are mainly divided into two systems, namely the AB partition system and the non-partition system. In the AB partition system, since both partitions need to be stored and run, more storage space and processor resources are required, and the AB partition system is more complex in design, resulting in higher development and maintenance costs. In contrast, the non-partition system does not require redundant storage space and processor resources, because it has only one system partition, and resources can be used more efficiently.

[0052] Therefore, if the system has higher requirements for resource efficiency and simplicity, and can accept a certain risk of failure, then it is more appropriate to adopt a partitionless system. However, when a software failure occurs in a partitionless system, due to the lack of redundant backup, the system may fail completely, affecting the normal operation of the system. Therefore, for a partitionless system, it is necessary to ensure that when the current upgrade fails, the subsequent upgrade can be attempted again based on the failure cause and version information, so as to ensure the normal operation of the system.

[0053] To this end, the embodiments of the present application disclose an application upgrade method, apparatus, device and medium, which can ensure the normal operation of the system when upgrading using a partition-free system to improve the reliability of the upgrade.

[0054] See also Figure 1 As shown, the embodiment of the present application discloses an application program upgrade method, which is applied to a target electronic device, and the method includes:

[0055] Step S11: When a flash request sent by the upper computer is obtained, the first data stored in the first storage area is written into the first cache area, and the second data stored in the second storage area is written into the second cache area; wherein the first data is data related to the current running status of the target application, and the second data is data related to the running status of the target application at the last flash moment.

[0056] This application requires that the storage area inside the target electronic device be divided in advance, and the first data related to the current running state of the target application (i.e., APP) be stored in the first storage area, and the second data related to the running state of the target application at the last flashing moment be stored in the second storage area. In addition, this application also applies for two cache spaces, i.e., the first cache area and the second cache area, and initializes the two cache areas.

[0057] In a specific implementation, the first type of storage area includes a random access memory, a read-only memory and a first non-volatile memory, and the second type of storage area is a second non-volatile memory; wherein the random access memory is used to store data and instructions required for the operation of the operating system and the target application, the read-only memory is used to store the version number and integration packaging time of the target application, the first non-volatile memory is used to store data in the target application that needs to be saved after power-off, and the second non-volatile memory is used to store data in the boot loader that needs to be saved after power-off.

[0058] It can be understood that random access memory (RAM) is a volatile memory, which means that when the power is turned off, the data stored in it will be lost. Therefore, in this embodiment, it is used to temporarily store the data and instructions required for the operation of the operating system and the target application, that is, RAM is used for temporary storage and quick access, and saves the current software operation status; read-only memory (ROM) is a non-volatile memory. Even if the power is off, the data stored in it will not be lost and usually cannot be changed. Therefore, in this embodiment, it is used to store fixed data, usually the version number and integration packaging time of the target application, as well as to store running files, quasi-constant parameters and other data; the first non-volatile memory mainly refers to NvM (Non-volatile Memory). After the power is off, the stored data of NvM will not be lost. It supports data writing and erasing operations, so that it can store information that needs to be updated. Therefore, in this embodiment, it is used to store data that needs to be saved after power off in the target application. Among them, the first cache area and the second cache area are part of RAM. In addition, the second non-volatile memory refers to ABCM (Application Bootloader Calibration Memory) defined in this application, that is, a memory that can be read and written by applications, boot loaders, and calibration programs. The main difference between NvM and ABCM is that the update and write algorithm modes are different. The NVM algorithm is complex and the initialization is time-consuming, but it can reduce the wear and tear of the storage chip caused by data updates; while the ABCM algorithm is simple and the initialization is relatively fast, but each data update requires the operation of the entire ABCM area, which will increase the number of chip wear times. ABCM is often used to store updated data that needs to be saved after power-off in the boot loader (i.e., Boot program), because the software must first start from Boot and check whether the application is complete and valid. The startup process needs to be fast, and Boot does not need to update non-volatile data frequently. Therefore, the storage characteristics of ABCM are most suitable for data that Boot needs to read and write and store after power-off. For details, see Figure 2 As shown, Figure 2 This is a schematic diagram of a regional division disclosed in this application.

[0059] In this way, the above solution can effectively allocate the location for storing data, and effectively improve the service life of the storage chip.

[0060] It should be pointed out that every time the App switches programming sessions, the software of the partition-free system generally needs to be restarted before it can enter Boot. Some running states in the App are in RAM, which will cause them to disappear; some version number information was originally stored in ROM, and the ROM area will be erased when the software is upgraded, which will cause the version number information stored in ROM to be lost; there are also some information stored in NvM, which may also be expected to be read in Boot after the flashing fails, so it is necessary to back up the data in RAM, ROM and NvM to ABCM. The second cache area is a temporary storage of the last saved data read from ABCM, and the first cache area is a temporary storage of data to be updated to ABCM. Therefore, when the flashing request sent by the upper computer is obtained, the currently executing task will be suspended, and some key running status information will be saved. Specifically, the first data stored in the first storage area needs to be written into the first cache area, and the second data stored in the second storage area needs to be written into the second cache area. It will be determined later whether the data in the first storage area needs to be backed up to the second cache area.

[0061] Step S12: Determine whether the data stored in the first cache area and the second cache area are the same. If they are the same, keep the data in the second storage area unchanged, update the reprogramming flag and restart the power, and then execute the boot loader to use the boot loader to upgrade the target application based on the software upgrade package.

[0062] In this embodiment, it is necessary to determine whether the data stored in the first cache area and the second cache area are the same. If they are the same, it means that the current operating state has not changed in data compared to the operating state at the last flashing time. Therefore, the data in the second type of storage area is kept unchanged, and there is no need to back up the data, that is, there is no need to use the data stored in the first cache area to update the second type of storage area, thereby reducing the number of erase and write times of the storage chip and extending the service life of the storage chip. Furthermore, when the data stored in the first cache area and the second cache area are the same, the reprogramming flag is updated and the power is restarted, and the boot loader is executed to use the boot loader to upgrade the target application based on the software upgrade package.

[0063] Step S13: Detect whether the target application is successfully upgraded. If the upgrade fails, the current version information of the target application and the log file of this upgrade are recorded in the second type of storage area.

[0064] In this embodiment, it is detected whether the target application is successfully upgraded. If the target application is successfully upgraded, the upgraded target application is run after reset. If the target application fails to upgrade, the current version information of the target application and the log file of this upgrade are recorded in the second storage area to ensure that the information data of the old version and the reason for the failure can be recorded after the upgrade fails, so as to facilitate the subsequent upgrade and the analysis of the problem of the upgrade failure. For example, when the old version number is A100 and needs to be upgraded to the new version A300, if the upgrade fails and hangs in Boot at this time, the old version number A100 and the log file that caused the failure during the upgrade will be recorded, such as software integrity check or digital signature verification.

[0065] Furthermore, after recording the current version information of the target application and the log file of this upgrade to the second type of storage area, the method also includes: analyzing the current version information and the log file in the second type of storage area by the host computer using a diagnostic tool to obtain the reason for the upgrade failure; and resending the flash request by the host computer after performing a corresponding upgrade failure processing flow based on the reason for the upgrade failure.

[0066] That is, when the upgrade fails, the host computer can use diagnostic tools to analyze the current version information and log files stored in the second storage area (i.e., ABCM) to obtain the reason for the upgrade failure, and then resend the flash request through the host computer after performing the corresponding upgrade failure processing flow based on the reason for the upgrade failure.

[0067] It can be seen that the present application first divides the storage area inside the target electronic device, the first type of storage area is used to store the first data related to the current running state of the target application, and the second type of storage area is used to store the second data related to the running state of the target application at the last flashing moment. Therefore, when the flashing request sent by the upper computer is obtained, it is first necessary to write the first data stored in the first type of storage area into the first cache area, and write the second data stored in the second type of storage area into the second cache area, and then determine whether the data stored in the first cache area and the second cache area are the same. If they are the same, it means that the current running state has not changed in data compared to the running state at the last flashing moment. Therefore, the data in the second type of storage area is kept unchanged, and there is no need to use the data stored in the first cache area to update the second type of storage area, thereby reducing the number of erase and write of the storage chip and extending the service life of the storage chip. Furthermore, when the data stored in the first cache area and the second cache area are the same, the reprogramming flag is updated and the power is restarted, and then the boot loader is executed to upgrade the target application based on the software upgrade package using the boot loader. If the target application fails to be upgraded, the current version information of the target application and the log file of this upgrade are recorded in the second storage area to ensure that the information data of the old version and the reason for the failure can be recorded after the upgrade fails, thereby facilitating subsequent re-upgrades and analysis of upgrade failures.

[0068] See also Figure 3 As shown, the embodiment of the present application discloses a specific application upgrade method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes:

[0069] Step S21: When a flash request sent by the upper computer is obtained, the first data stored in the first storage area is written into the first cache area, and the second data stored in the second storage area is written into the second cache area; wherein the first data is data related to the current running status of the target application, and the second data is data related to the running status of the target application at the last flash moment.

[0070] In this embodiment, Figure 4 As shown, before obtaining the flashing request sent by the host computer, it also includes: detecting the corresponding parameters based on the preset detection items, and judging whether the upgrade conditions are currently met based on the detection results; wherein the preset detection items are detection items based on any one or more of voltage detection, vehicle speed detection, gear detection and engine speed detection; if the upgrade conditions are not currently met, a message is sent to the host computer to indicate that the upgrade conditions are not currently met; if the upgrade conditions are currently met, the flashing request sent by the host computer is responded to.

[0071] That is, before executing the flash, this embodiment needs to determine whether the upgrade conditions are currently met. The specific judgment method is to detect the corresponding parameters based on the preset detection items, and then determine whether the upgrade conditions are currently met based on the detection results. Among them, the preset detection items may include but are not limited to voltage detection, vehicle speed detection, gear detection and engine speed detection. In a specific implementation, the inspection can be based on one or more of them, or all four detection items can be checked. If the inspection passes, the flash request is responded to, so that the data in RAM, ROM, and NvM are read into the first cache area, and the data in ABCM is read into the second cache area.

[0072] Specifically, the above-mentioned detection of corresponding parameters based on preset detection items, and judging whether the current upgrade conditions are met based on the detection results, include: detecting whether the current voltage value is within the preset range, if so, determining that the voltage detection is passed; and / or, detecting whether the current vehicle speed is zero, if so, determining that the vehicle speed detection is passed; and / or, detecting whether the current gear is in the parking gear, if so, determining that the gear detection is passed; and / or, detecting whether the current engine speed is zero, if so, determining that the engine speed detection is passed; if the detection results of each preset detection item are all passed, it is determined that the current upgrade conditions are met. That is, the situation where each detection item passes the detection is that the current voltage value is normal, that is, it is within the preset range, the current vehicle speed is zero, the current gear is in the parking gear (i.e., P gear), and the current engine speed is zero.

[0073] Step S22: Determine whether the data stored in the first cache area is the same as the data stored in the second cache area. If the data stored in the first cache area is not the same as the data stored in the second cache area, update the second type of storage area using the data stored in the first cache area.

[0074] In this embodiment, if the data stored in the first cache area and the second cache area are different, it means that the current running state has undergone data changes compared to the previous running state, so the data of the current running state needs to be backed up. According to the above content, it is necessary to back up the data in the first storage area such as RAM, ROM and NvM to the second storage area ABCM. That is, the second storage area is updated with the data stored in the first cache area, so that the second storage area can store the latest running state data.

[0075] Furthermore, after the above-mentioned updating of the second type of storage area using the data stored in the first cache area, it also includes: detecting whether the second type of storage area is updated successfully; if the second type of storage area fails to update, then terminating the current upgrade operation; if the second type of storage area is updated successfully, then power on and restart. That is, this application needs to confirm whether the second type of storage area is updated successfully. If the second type of storage area fails to update, then the current upgrade operation is directly terminated. If the second type of storage area is updated successfully, it can be known that the target electronic device is powered on and restarted. In a specific embodiment, the target electronic device refers to an ECU (Electronic Control Unit).

[0076] Step S23: After the update of the second type storage area is completed, the reprogramming flag is set to a target value and the system is powered on again.

[0077] In this embodiment, after the second type storage area is updated, the reprogramming flag is set to a target value, and then the system is powered on again.

[0078] Step S24: executing a boot loader, and when the boot loader detects that the reprogramming flag is the target value, upgrading the target application based on a software upgrade package.

[0079] In this embodiment, the boot loader is executed to enter Boot and start software upgrade. If the boot loader detects that the preset flag is a target value, the target application is upgraded based on the software upgrade package.

[0080] Step S25: Detect whether the target application is successfully upgraded. If the upgrade fails, the current version information of the target application and the log file of this upgrade are recorded in the second type of storage area.

[0081] For more specific processing procedures of the above steps S21 and S25, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0082] It can be seen that in this application, before executing the flash write, it is necessary to determine whether the upgrade conditions are currently met. The specific judgment method is to detect the corresponding parameters based on the preset detection items, and then determine whether the upgrade conditions are currently met according to the detection results. When the data related to the current running state of the target application stored in the first storage area is written into the first cache area, and the data related to the previous running state of the target application stored in the second storage area is written into the second cache area, if the data stored in the first cache area and the second cache area are different, it means that the current running state has undergone data changes compared to the previous running state, so it is necessary to back up the data of the current running state so that the current latest running state data can be stored in the second storage area. It can be seen that this scheme provides an effective data storage management scheme for upgrading a partition-free system, which ensures the service life of the storage chip, shortens the software startup time, and also ensures that the information data and failure reasons of the old version can be recorded after the upgrade fails.

[0083] See also Figure 5 As shown, the embodiment of the present application discloses an application program upgrade device, which is applied to a target electronic device, and the device includes:

[0084] The data writing module 11 is used to write the first data stored in the first storage area into the first cache area and write the second data stored in the second storage area into the second cache area when obtaining the flashing request sent by the upper computer; wherein the first data is data related to the current running state of the target application, and the second data is data related to the running state of the target application at the last flashing moment;

[0085] A judging module 12, configured to judge whether the data stored in the first cache area and the second cache area are the same, and if they are the same, keep the data in the second type of storage area unchanged, update the reprogramming flag, restart the power supply, and then execute the boot loader to upgrade the target application based on the software upgrade package using the boot loader;

[0086] The information recording module 13 is used to detect whether the target application is successfully upgraded. If the upgrade fails, the current version information of the target application and the log file of this upgrade are recorded in the second type of storage area.

[0087] It can be seen that the present application first divides the storage area inside the target electronic device, the first type of storage area is used to store the first data related to the current running state of the target application, and the second type of storage area is used to store the second data related to the running state of the target application at the last flashing moment. Therefore, when the flashing request sent by the upper computer is obtained, it is first necessary to write the first data stored in the first type of storage area into the first cache area, and write the second data stored in the second type of storage area into the second cache area, and then determine whether the data stored in the first cache area and the second cache area are the same. If they are the same, it means that the current running state has not changed in data compared to the running state at the last flashing moment. Therefore, the data in the second type of storage area is kept unchanged, and there is no need to use the data stored in the first cache area to update the second type of storage area, thereby reducing the number of erase and write of the storage chip and extending the service life of the storage chip. Furthermore, when the data stored in the first cache area and the second cache area are the same, the reprogramming flag is updated and the power is restarted, and then the boot loader is executed to upgrade the target application based on the software upgrade package using the boot loader. If the target application fails to be upgraded, the current version information of the target application and the log file of this upgrade are recorded in the second storage area to ensure that the information data of the old version and the reason for the failure can be recorded after the upgrade fails, thereby facilitating subsequent re-upgrades and analysis of upgrade failures.

[0088] Since the embodiments of the device part and the embodiments of the method part correspond to each other, the embodiments of the device part refer to the description of the embodiments of the method part, which will not be described here. And, it has the same beneficial effects as the above-mentioned application program upgrade method.

[0089] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the application upgrade method performed by the electronic device disclosed in any of the aforementioned embodiments.

[0090] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0091] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0092] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0093] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the application upgrade method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.

[0094] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the application program upgrade method steps disclosed in any of the aforementioned embodiments are implemented.

[0095] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0096] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0097] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.

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

[0099] The above is a detailed introduction to an application upgrade method, device, equipment and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for upgrading an application, characterized in that: Applied to target electronic devices, including: When a flashing request sent by the host computer is obtained, the first data stored in the first type of storage area is written into the first cache area, and the second data stored in the second type of storage area is written into the second cache area; wherein the first data is data related to the current running state of the target application, and the second data is data related to the running state of the target application at the last flashing moment; Determine whether the data stored in the first cache area and the second cache area are the same, if they are the same, keep the data in the second storage area unchanged, update the reprogramming flag and restart the power, and then execute the boot loader to upgrade the target application based on the software upgrade package using the boot loader; Detect whether the target application is successfully upgraded. If the upgrade fails, record the current version information of the target application and the log file of this upgrade into the second type of storage area.

2. The application program upgrade method according to claim 1, characterized in that: The first type of storage area includes a random access memory, a read-only memory and a first non-volatile memory, and the second type of storage area is a second non-volatile memory; wherein the random access memory is used to store data and instructions required for the operation of the operating system and the target application, the read-only memory is used to store the version number and integration packaging time of the target application, the first non-volatile memory is used to store data in the target application that needs to be saved after power-off, and the second non-volatile memory is used to store data in the boot loader that needs to be saved after power-off.

3. The application program upgrade method according to claim 1, characterized in that: Before getting the flash request sent by the host computer, it also includes: Detecting corresponding parameters based on preset detection items, and judging whether the upgrade conditions are currently met based on the detection results; wherein the preset detection items are detection items based on any one or more of voltage detection, vehicle speed detection, gear position detection and engine speed detection; If the upgrade condition is not met currently, a message indicating that the upgrade condition is not met currently is sent to the host computer; if the upgrade condition is met currently, the flashing request sent by the host computer is responded to.

4. The application program upgrade method according to claim 3, characterized in that: The detecting of corresponding parameters based on preset detection items and judging whether the upgrade conditions are currently met based on the detection results include: Detect whether the current voltage value is within the preset range, if so, determine that the voltage detection is passed; and / or, detecting whether the current vehicle speed is zero, and if so, determining that the vehicle speed detection passes; and / or, detecting whether the current gear is in the parking gear, and if so, determining that the gear detection is passed; and / or, detecting whether the current engine speed is zero, and if so, determining that the engine speed detection passes; If the detection results of all preset detection items are passed, it is determined that the current upgrade conditions are met.

5. The application program upgrade method according to claim 1, characterized in that: After determining whether the data stored in the first cache area and the second cache area are the same, the method further includes: If the data stored in the first cache area is different from the data stored in the second cache area, the second type of storage area is updated using the data stored in the first cache area, and the second type of storage area is powered on again after the update is completed; Correspondingly, after the second type of storage area is updated using the data stored in the first cache area, the method further includes: detecting whether the second-type storage area is updated successfully; If the update of the second type of storage area fails, the upgrade operation is terminated; If the second type of storage area is updated successfully, power on again to start.

6. The application program upgrade method according to claim 5, characterized in that: The step of restarting the system after the update of the second type storage area is completed comprises: After the update of the second type storage area is completed, the reprogramming flag is set to a target value, and the power is turned on again; Accordingly, the step of upgrading the target application program based on the software upgrade package by using the boot loader includes: When the boot loader detects that the reprogramming flag is the target value, the target application is upgraded based on a software upgrade package.

7. The application program upgrade method according to any one of claims 1 to 6, characterized in that: After recording the current version information of the target application and the log file of this upgrade to the second type of storage area, the method further includes: Analyzing the current version information and the log file in the second storage area by the host computer using a diagnostic tool to obtain the cause of the upgrade failure; After performing a corresponding upgrade failure processing flow based on the upgrade failure reason, the flashing request is resent through the host computer.

8. An application program upgrade device, characterized in that: Applied to target electronic devices, including: A data writing module, used for writing first data stored in the first type of storage area into the first cache area, and writing second data stored in the second type of storage area into the second cache area when a flashing request sent by the host computer is obtained; wherein the first data is data related to the current running state of the target application, and the second data is data related to the running state of the target application at the last flashing moment; a judgment module, used for judging whether the data stored in the first cache area and the second cache area are the same, and if they are the same, keeping the data in the second type of storage area unchanged, updating the reprogramming flag bit and restarting the power supply, and then executing the boot loader to upgrade the target application based on the software upgrade package by using the boot loader; The information recording module is used to detect whether the target application is successfully upgraded. If the upgrade fails, the current version information of the target application and the log file of this upgrade are recorded in the second type of storage area.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the application upgrade method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the application upgrade method as described in any one of claims 1 to 7 are implemented.