Application program data updating method and device

By performing partitioning operations and data redundancy verification on the storage modules in the microcontroller, rapid switching of application data updates is achieved, and the problems of MCU hardware dependence and high cost in the existing technology are solved, product costs are reduced and program versions are achieved.

CN119847552APending Publication Date: 2025-04-18SHANGHAI LEEKR TECHNOLOGY CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311339524.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-16
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The prior art relies on the MCU's own design to have physically isolated A/B partition FLASH, and the operation and switching of applications depends on MCU hardware, resulting in high product costs and inconvenient program version switching.

Method used

By partitioning the storage modules in the microcontroller, the boot loading area, the data verification area, the first application partition and the second application partition are obtained, and the application program is to be run using data redundancy verification. On this basis, the Flash area to be updated is determined, and the target area program data is adaptively updated, without any operations are performed on the application area that needs to be run.

Benefits of technology

It effectively reduces product costs and realizes fast switching of program versions, without the need for the MCU to have physically isolated A/B partition FLASH.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847552A_ABST
    Figure CN119847552A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of microcontrollers, and discloses an application program data updating method, which comprises the following steps of: performing partition operation on a storage module in a microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition; electrifying the system, and running a boot loader; receiving an updating request sent by an upper computer, and determining a current running partition and a target application partition in the first application partition and the second application partition; if the program updating command does not exist, skipping to the specified application program from the boot loader to run; if an application program updating command is monitored in the boot loader or the application program of the current running partition, program updating operation is conducted on the target application partition. According to the application program data updating method provided by the embodiment of the invention, the application program to be operated is determined by performing data redundancy check on the application operation check area, and the Flash area to be updated is determined on the basis of the application program to be operated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of microcontrollers, and in particular to a method and device for updating application data. Background Art

[0002] At present, different applications are flashed using the A / B partitions of the MCU's internal FLASH. A / B can run independently and can update programs independently. However, the prior art still has the following problems: First, it depends on the MCU's own design, requiring the MCU itself to have physically isolated A / B partition FLASH; second, the running switch of the application depends on the MCU hardware, and the MCU needs to switch the FLASH running start address, that is, the MCU is required to have a SWAP function to switch the FLASH. Therefore, designing a solution that can reduce product costs and facilitate program version switching has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0003] In view of the above defects, an embodiment of the present invention discloses a method for updating application data, which can effectively reduce product costs and realize rapid switching of program versions.

[0004] A first aspect of an embodiment of the present invention discloses a method for updating application data, comprising:

[0005] Partitioning a storage module in the microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition, wherein the first application partition and the second application partition are used to store application program data of the vehicle;

[0006] The system is powered on, a boot loader is run, and a currently running partition among the first application partition and the second application partition is determined, and a target application partition is determined upon receiving an update request sent by a host computer; wherein the target application partition is another partition among the first application partition and the second application partition except the currently running partition;

[0007] Obtaining application identity information, application activation status, and application verification code in the current running partition, and verifying the current running partition according to the application identity information, application activation status, and application verification code to determine the current running partition position and the target application partition position;

[0008] If there is no program update command, the boot loader jumps to the specified application to run; if an application update command is detected in the boot loader or the application of the currently running partition, the program update operation is performed on the target application partition.

[0009] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after performing the program update operation on the target application partition, the method further includes:

[0010] If an update error occurs during the program update, a program update failure flag is set in the target application partition, and the boot loader jumps to the application running in the current running partition determined when the system is powered on. At the same time, the application is prohibited from switching the running partition until the next program update is successful, and the application jump prohibition is lifted.

[0011] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after performing the program update operation on the target application partition, the method further includes:

[0012] If the program update is completed, a first redundancy check value of the target application partition is calculated, and the first redundancy check value is written into a corresponding data check area;

[0013] The second redundant check value of the application identity information, the application activation state and the first redundant check value is calculated, and the second redundant check value is written into the corresponding data check area.

[0014] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after writing the second redundancy check value into the data check area, the method further includes:

[0015] When receiving the application switching instruction sent by the host computer, modify the corresponding application activation state in the data verification area;

[0016] Calculate a third redundant check value according to the modified application activation state, the application identity information and the first redundant check value, and write the third redundant check value into the corresponding data check area;

[0017] Reset the microcontroller unit and complete the corresponding application switching after restarting.

[0018] As an optional implementation, in the first aspect of the embodiment of the present invention, the data verification area includes a first application verification area and a second application verification area; wherein the first application verification area includes verification data corresponding to the first application partition and the second application partition, and the second application verification area includes verification data corresponding to the first application partition and the second application partition; the obtaining of application identity information, application activation status and application verification code in the current running partition, and verifying the current running partition according to the application identity information, application activation status and application verification code to determine the current running partition position and the target application partition position, includes:

[0019] Obtaining application identity information, application activation status, and application verification code in the first application verification area in the boot loader;

[0020] Perform data matching with preset identity information according to the application identity information, if the match is successful, execute the next step, if the match is not successful, switch to use the data in the second application verification area for verification;

[0021] Calculate the fourth redundant check value of the application identity information, application activation status and application verification code in the first application verification area, and compare the fourth redundant check value with the pre-stored application redundant check value. If the match is successful, execute the next step; if the match is not successful, switch to using the data in the second application verification area for verification;

[0022] Calculate the fifth redundant check value of the data in the application area indicating the application activation status, and compare it with the pre-stored application redundant check value. If the match succeeds, determine the storage location of the current application and set the application running flag. If the match fails, switch to using the data in the second application check area for verification.

[0023] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after the switching to use the data of the second application verification area for verification, the method further includes:

[0024] If the verification succeeds, the corresponding application is run normally, and the data in the second application verification area is copied to the first application verification area. If the verification fails again, it is determined that the current application data is abnormal.

[0025] As an optional implementation manner, in the first aspect of the embodiment of the present invention, the performing a program update operation on the target application partition includes:

[0026] Load the target upgrade file;

[0027] Determine the partition where the currently running application is located. If the currently running application is in the first application partition, skip erasing the data of the first application partition and erase the data of the second application partition according to the target upgrade file.

[0028] If the currently running application is in the second application partition, data erasure of the second application partition is skipped, and data erasure of the first partition is performed according to the target upgrade file.

[0029] A second aspect of an embodiment of the present invention discloses an application data updating device, comprising:

[0030] Partition module: used for performing partition operation on the storage module in the microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition, wherein the first application partition and the second application partition are used to store application program data of the vehicle;

[0031] Receiving module: used for powering on the system, running the boot loader and determining the currently running partition in the first application partition and the second application partition, and determining the target application partition upon receiving the update request sent by the host computer; wherein the target application partition is another partition in the first application partition and the second application partition except the currently running partition;

[0032] The acquisition module is used to acquire the application identity information, application activation status and application verification code in the current running partition, and verify the current running partition according to the application identity information, application activation status and application verification code to determine the location of the current running partition and the location of the target application partition;

[0033] Update module: used to jump from the boot loader to the specified application if there is no program update command; if an application update command is detected in the boot loader or the application of the currently running partition, perform a program update operation on the target application partition.

[0034] The third aspect of an embodiment of the present invention discloses an electronic device, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the application data update method disclosed in the first aspect of the embodiment of the present invention.

[0035] A fourth aspect of an embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the application data updating method disclosed in the first aspect of an embodiment of the present invention.

[0036] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0037] The application data updating method in the embodiment of the present invention determines the application to be run by performing data redundancy check on the application running check area, and determines the Flash area to be updated on this basis; when updating the program, the program data in the target area is adaptively updated, and no operation is performed on the application area that currently needs to be run. After the program update is completed, the application can be switched to run according to user needs. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0039] Figure 1 It is a flowchart of the application data updating method disclosed in the embodiment of the present invention;

[0040] Figure 2 It is a specific flow chart of the application data updating method disclosed in the embodiment of the present invention;

[0041] Figure 3 It is a schematic diagram of the process of checking the application running area disclosed in an embodiment of the present invention;

[0042] Figure 4 It is a schematic diagram of a specific process of checking the application running area disclosed in an embodiment of the present invention;

[0043] Figure 5 It is a schematic diagram of the process of program erasing disclosed in an embodiment of the present invention;

[0044] Figure 6 It is a schematic diagram of a specific process of program erasing disclosed in an embodiment of the present invention;

[0045] Figure 7 It is a structural diagram of an application data updating device provided by an embodiment of the present invention;

[0046] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present 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 creative work are within the scope of protection of the present invention.

[0048] It should be noted that the terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of the present invention and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0049] At present, the A / B partitions of the MCU's internal FLASH are used to flash different applications respectively. A / B can run independently and can update programs independently. However, the prior art still has the following problems: First, it depends on the design of the MCU itself, requiring the MCU itself to have physically isolated A / B partition FLASH; second, the operation switching of the application depends on the MCU hardware, and the MCU needs to switch the FLASH operation start address, that is, the MCU is required to have a SWAP function to switch the FLASH. Based on this, the embodiment of the present invention discloses an application data update method, device, electronic device and storage medium, which determines the application to be run by performing a data redundancy check on the application operation check area, and determines the Flash area to be updated on this basis; when updating the program, the program data in the target area is adaptively updated, and no operation is performed on the application area that currently needs to be run. After the program update is completed, the application operation can be switched according to user needs.

[0050] Embodiment 1

[0051] See also Figure 1 , Figure 1 It is a flow chart of the application data update method disclosed in the embodiment of the present invention. Among them, the execution subject of the method described in the embodiment of the present invention is an execution subject composed of software and / or hardware, and the execution subject can receive relevant information by wired or / and wireless means, and can send certain instructions. Of course, it can also have certain processing functions and storage functions. The execution subject can control multiple devices, such as a remote physical server or cloud server and related software, or it can be a local host or server and related software that performs related operations on a device placed somewhere. In some scenarios, multiple storage devices can also be controlled, and the storage devices can be placed in the same place or different places as the devices. For example Figure 1 and Figure 2 As shown, the application data updating method includes the following steps:

[0052] S101: performing a partition operation on a storage module in a microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition, wherein the first application partition and the second application partition are used to store application program data of the vehicle;

[0053] S102: The system is powered on, the bootloader is run and the currently running partition among the first application partition and the second application partition is determined, and the target application partition is determined after receiving the update request sent by the host computer; wherein the target application partition is another partition among the first application partition and the second application partition except the currently running partition; each time the system is powered on, the bootloader is first run, the application partition to be run is determined in the bootloader, and after receiving the update request sent by the host computer, the target application partition to be updated is determined according to the determined currently running application partition;

[0054] S103: Obtain application identity information, application activation status and application verification code in the current running partition, and verify the current running partition according to the application identity information, application activation status and application verification code to determine the current running partition position and the target application partition position; obtain the application identity information, application activation status and verification code in the verification area, which are used to determine the application partition to be run in the bootloader, and the target application partition to be updated when receiving the application update instruction. The application update command is only requested by the host computer (external device), and only the application partition is determined in the bootloader;

[0055] S104: If there is no program update command, jump from the boot loader to the designated application for execution; if an application update command is detected in the boot loader or the application of the currently running partition, perform a program update operation on the target application partition.

[0056] The existing solution is physical partitioning, for example, the physical address of area A is 0x10000 to 0x1FFFF; the physical address of area B is 0x20000 to 0x2FFFF; when it is implemented, the corresponding application is switched by modifying and adjusting the physical address. And its requirements for MCU are more stringent, and it requires the MCU itself to have certain physical partitions; while the solution of this application does not need to have physical partitions itself, it sets virtual partitions in the internal storage module of MCU, and in order to reduce the error rate; when it is implemented, redundant checks are also set for further identity verification.

[0057] The solution of the embodiment of the present invention uses a complete FLASH to store two applications at the same time, so the FLASH needs to be divided, which specifically includes:

[0058] BOOTLAODER (boot loader): used to update the APP in the corresponding area, including PBL for updating SBL, and SBL for updating APP;

[0059] Data verification area: It is divided into APP operation verification area I and APP operation verification area II. In the embodiment of the present invention, APP operation verification area I refers to the first application verification area, and APP operation verification area II refers to the second application verification area. Each APP operation verification area includes a verification ID (verification area code), APP activation status (indicating whether the current APP is running in Flash area I or Flash area II), APP CRC (Flash area data CRC indicated by the APP activation status), and APP verification area CRC (the verification ID in the current APP operation verification area, the APP activation status, and the CRC value calculated by the APP CRC);

[0060] APP I area, APP II area (first application partition and second application partition): used to store application programs. When the program is flashed for the first time, the application programs in APP I area and APP II area are the same. The above two application partitions are located in the same Flash, but they are virtual partitions.

[0061] Compared with the prior art solutions, the solution of the embodiment of the present invention does not require that the MCU must have two physical partitions Flash A / B, which can effectively reduce product costs. At the same time, this solution has a wider scope of application. When the Flash memory area is sufficient, it can be adapted to most MCUs to achieve fast switching of program versions.

[0062] More preferably, after performing the program update operation on the target application partition, the method further includes:

[0063] If an update error occurs during the program update, a program update failure flag is set in the target application partition, and the boot loader jumps to the application running in the current running partition determined when the system is powered on. At the same time, the application is prohibited from switching the running partition until the next program update is successful, and the application jump prohibition is lifted.

[0064] During the specific implementation, after the system is powered on, BOOTLOADER is run to verify the partition where the current APP should be run. After the verification is completed, if there is no program update command, it jumps from BOOTLOADER to the specified APP to run; if an application update command is detected in BOOTLOADER, it immediately starts to update the PFlash data in another APP partition. If a program update command is detected in APP, it jumps from APP to BOOTLOADER and starts to update the PFlash data in another APP partition.

[0065] If an update error occurs during program update, the program update failure flag is set, and BOOTLOADER jumps to the APP partition determined when the system is powered on to run the APP, and at the same time prohibits the APP program from switching to the running partition until the next program update is successful and the APP jump prohibition is lifted. By setting the update failure flag when a program update error occurs, the status is determined, which can prevent errors from occurring during program operation.

[0066] More preferably, after performing the program update operation on the target application partition, the method further includes:

[0067] If the program update is completed, a first redundancy check value of the target application partition is calculated, and the first redundancy check value is written into a corresponding data check area;

[0068] The second redundant check value of the application identity information, the application activation state and the first redundant check value is calculated, and the second redundant check value is written into the corresponding data check area.

[0069] More preferably, after writing the second redundancy check value into the data check area, the method further includes:

[0070] When receiving the application switching instruction sent by the host computer, modify the corresponding application activation state in the data verification area;

[0071] Calculate a third redundant check value according to the modified application activation state, the application identity information and the first redundant check value, and write the third redundant check value into the corresponding data check area;

[0072] Reset the microcontroller unit and complete the corresponding application switching after restarting.

[0073] In an embodiment of the present invention, after the program update is completed, the CRC value of the data in the updated area is calculated, and this CRC value is written into the operation verification area. Then, the CRC of the verification ID, APP activation status, and APP CRC is calculated, and this CRC value is written into the APP operation verification areas I and II. The next information comparison and verification is realized by entering the above information.

[0074] When receiving the APP switching instruction from the host computer, modify the APP activation status in the APP operation verification area I and II, calculate the CRC value and write it into the APP operation verification area I and II, then reset the MCU, and complete the APP switching after the system restarts.

[0075] More preferably, the data verification area includes a first application verification area and a second application verification area; wherein the first application verification area includes verification data corresponding to the first application partition and the second application partition, and the second application verification area includes verification data corresponding to the first application partition and the second application partition; the reason why the two application verification areas in the embodiment of the present invention include the same data is for vehicle safety considerations, and the purpose is to make data redundancy backup; Figure 3 and Figure 4 As shown, the obtaining of the application identity information, the application activation status, and the application verification code in the current running partition, and verifying the current running partition according to the application identity information, the application activation status, and the application verification code to determine the current running partition position and the target application partition position, includes:

[0076] S1031: Obtain application identity information, application activation status, and application verification code in the first application verification area in the boot loader;

[0077] S1032: performing data matching with preset identity information according to the application identity information, and if the matching is successful, executing the next step; if the matching is unsuccessful, switching to use the data in the second application verification area for verification;

[0078] S1033: Calculate the fourth redundant check value of the application identity information, application activation status and application verification code in the first application verification area, and compare the fourth redundant check value with the pre-stored application redundant check value. If the match is successful, execute the next step; if the match is unsuccessful, switch to use the data in the second application verification area for verification;

[0079] S1034: Calculate the fifth redundant check value of the data in the application area indicating the application activation status, and compare it with the pre-stored redundant check value of the application. If the match succeeds, determine the storage location of the current application and set the application running flag. If the match fails, switch to using the data in the second application check area for verification.

[0080] In the specific implementation, the current APP running area needs to be checked when the system is powered on, so as to accurately jump from the BOOTLOADER to the APP to run the APP program, and adaptively flash the PFlash area that needs to be updated when updating the program.

[0081] When the system is powered on, the ID, APP activation status, and APP CRC of the APP operation verification area I are obtained in the BOOTLOADER, and then it is determined whether the verification ID just obtained is the ID of the preset APP operation verification area I. After the verification ID detection passes, the CRC value of the ID, APP activation status, and APP CRC in the APP operation verification area is calculated and compared with the CRC in the APP operation verification area. After the comparison passes, the data CRC in the APP area indicating the APP activation status is calculated and compared with the APP CRC in the APP operation verification area. After the comparison passes, the PFlash area where the current APP is located is determined, the APP operation flag is set, and the system program switches from the BOOTLOADER to the target APP to run.

[0082] In the above process, three comparisons will be performed. If any comparison fails, it is considered that the Flash in the APP operation verification area I is abnormal, and the data in the APP operation verification area II is immediately switched for verification. After the verification is successful, the APP will run normally, and the data in the APP operation verification area II will be copied to the APP operation verification area I. If the verification fails again, it is considered that the current APP data is abnormal, and the program resides in the BOOTLOADER, waiting for the program to be updated.

[0083] More preferably, after the switching to use the data in the second application verification area for verification, the method further includes:

[0084] If the verification succeeds, the corresponding application is run normally, and the data in the second application verification area is copied to the first application verification area. If the verification fails again, it is determined that the current application data is abnormal.

[0085] More preferably, Figure 5 and Figure 6 As shown, the program update operation on the target application partition includes:

[0086] S1041: Load the target upgrade file;

[0087] S1042: Determine the partition where the currently running application is located. If the currently running application is in the first application partition, skip erasing the data of the first application partition and erase the data of the second application partition according to the target upgrade file.

[0088] S1043: If the currently running application is in the second application partition, skip erasing the data of the second application partition, and erase the data of the first partition according to the target upgrade file.

[0089] According to the solution of the embodiment of the present invention, when flashing a HEX file, in order to simplify the flashing process, the HEX file to be flashed contains the same code data in the corresponding Flash areas I and II. Before flashing, the current running area is compared. If it is in area I, the flash data erasure of area I is skipped, and only the data of area II is erased; if the currently running APP is in area II, only the data of area I is erased, and the data erasure of area II is skipped.

[0090] In the embodiment of the present invention, redundant verification of the data in the APP running verification area is used to accurately determine the APP program to be run; when the program is erased, the corresponding I partition and II partition in the HEX file contain the same program, and the Flash space to be updated is adaptively determined when writing to Flash. The scheme of the embodiment of the present invention is mainly based on the data redundant verification of the APP running verification area to determine the APP program to be run, and on this basis, determine the Flash area to be updated. When updating the program, the program data in the target area is adaptively updated, and no operation is performed on the APP area that currently needs to be run. After the program update is completed, the APP program can be switched to run according to user needs.

[0091] The application data updating method in the embodiment of the present invention determines the application to be run by performing data redundancy check on the application running check area, and determines the Flash area to be updated on this basis; when updating the program, the program data in the target area is adaptively updated, and no operation is performed on the application area that currently needs to be run. After the program update is completed, the application can be switched to run according to user needs.

[0092] Embodiment 2

[0093] See also Figure 7 , Figure 7 Schematic diagram of the structure of the application data updating device disclosed in the embodiment of the present invention. Figure 7 As shown, the application data updating device may include:

[0094] Partition module 11: used for performing partition operation on the storage module in the microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition, wherein the first application partition and the second application partition are used to store application data of the vehicle;

[0095] Receiving module 12: used for powering on the system, running the boot loader and determining the currently running partition in the first application partition and the second application partition, and determining the target application partition upon receiving the update request sent by the host computer; wherein the target application partition is another partition in the first application partition and the second application partition except the currently running partition;

[0096] Acquisition module 13: used to acquire application identity information, application activation status and application verification code in the current running partition, and verify the current running partition according to the application identity information, application activation status and application verification code to determine the current running partition position and the target application partition position;

[0097] Update module 14: used to jump from the boot loader to the designated application program if there is no program update command; if an application update command is detected in the boot loader or the application of the currently running partition, perform a program update operation on the target application partition.

[0098] The application data updating method in the embodiment of the present invention determines the application to be run by performing data redundancy check on the application running check area, and determines the Flash area to be updated on this basis; when updating the program, the program data in the target area is adaptively updated, and no operation is performed on the application area that currently needs to be run. After the program update is completed, the application can be switched to run according to user needs.

[0099] Embodiment 3

[0100] See also Figure 8 , Figure 8 Schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. The electronic device may be a computer, a server, etc. Of course, in certain circumstances, it may also be a smart device such as a mobile phone, a tablet computer, a monitoring terminal, and an image acquisition device with processing functions. Figure 8 As shown, the electronic device may include:

[0101] A memory 510 storing executable program codes;

[0102] a processor 520 coupled to the memory 510;

[0103] The processor 520 calls the executable program code stored in the memory 510 to execute part or all of the steps in the application data updating method in the first embodiment.

[0104] An embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute part or all of the steps in the application data updating method in the first embodiment.

[0105] The embodiment of the present invention further discloses a computer program product, wherein when the computer program product is run on a computer, the computer is enabled to execute part or all of the steps in the application data updating method in the first embodiment.

[0106] An embodiment of the present invention further discloses an application publishing platform, wherein the application publishing platform is used to publish a computer program product, wherein when the computer program product runs on a computer, the computer executes part or all of the steps in the application data updating method in embodiment one.

[0107] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0108] 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, i.e., they may be located in one place or distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0109] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0110] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the method described in each embodiment of the present invention.

[0111] In the embodiments provided by the present invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0112] A person of ordinary skill in the art can understand that some or all of the steps in the various methods of the embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0113] The application data updating method, device, electronic device and storage medium disclosed in the embodiments of the present invention are introduced in detail above. 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 updating application data, characterized in that: include: Partitioning a storage module in the microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition, wherein the first application partition and the second application partition are used to store application program data of the vehicle; The system is powered on, a boot loader is run, and a currently running partition among the first application partition and the second application partition is determined, and a target application partition is determined upon receiving an update request sent by a host computer; wherein the target application partition is another partition among the first application partition and the second application partition except the currently running partition; Obtaining application identity information, application activation status, and application verification code in the current running partition, and verifying the current running partition according to the application identity information, application activation status, and application verification code to determine the location of the current running partition and the location of the target application partition; If there is no program update command, the boot loader jumps to the specified application to run; if an application update command is detected in the boot loader or the application of the currently running partition, the program update operation is performed on the target application partition.

2. The application data updating method according to claim 1, characterized in that: After performing a program update operation on the target application partition, the method further includes: If an update error occurs during the program update, a program update failure flag is set in the target application partition, and the boot loader jumps to the application running in the current running partition determined when the system is powered on. At the same time, the application is prohibited from switching the running partition until the next program update is successful, and the application jump prohibition is lifted.

3. The application data updating method according to claim 1, characterized in that: After performing a program update operation on the target application partition, the method further includes: If the program update is completed, a first redundancy check value of the target application partition is calculated, and the first redundancy check value is written into a corresponding data check area; The second redundant check value of the application identity information, the application activation state and the first redundant check value is calculated, and the second redundant check value is written into the corresponding data check area.

4. The application data updating method according to claim 3, characterized in that: After writing the second redundancy check value into the data check area, the method further includes: When receiving the application switching instruction sent by the host computer, modify the corresponding application activation state in the data verification area; Calculate a third redundant check value according to the modified application activation state, the application identity information and the first redundant check value, and write the third redundant check value into the corresponding data check area; Reset the microcontroller unit and complete the corresponding application switching after restarting.

5. The application data updating method according to claim 1, characterized in that: The data verification area includes a first application verification area and a second application verification area; wherein the first application verification area includes verification data corresponding to the first application partition and the second application partition, and the second application verification area includes verification data corresponding to the first application partition and the second application partition; the obtaining of application identity information, application activation status and application verification code in the current running partition, and verifying the current running partition according to the application identity information, application activation status and application verification code to determine the current running partition position and the target application partition position, includes: Obtaining application identity information, application activation status, and application verification code in the first application verification area in the boot loader; Perform data matching with preset identity information according to the application identity information, if the match is successful, execute the next step, if the match is not successful, switch to use the data in the second application verification area for verification; Calculate the fourth redundant check value of the application identity information, application activation status and application verification code in the first application verification area, and compare the fourth redundant check value with the pre-stored application redundant check value. If the match is successful, execute the next step; if the match is not successful, switch to using the data in the second application verification area for verification; Calculate the fifth redundant check value of the data in the application area indicating the application activation status, and compare it with the pre-stored application redundant check value. If the match succeeds, determine the storage location of the current application and set the application running flag. If the match fails, switch to using the data in the second application check area for verification.

6. The application data updating method according to claim 5, characterized in that: After the switching to use the data in the second application verification area for verification, the method further includes: If the verification succeeds, the corresponding application is run normally, and the data in the second application verification area is copied to the first application verification area. If the verification fails again, it is determined that the current application data is abnormal.

7. The application data updating method according to claim 1, characterized in that: The performing a program update operation on the target application partition includes: Load the target upgrade file; Determine the partition where the currently running application is located. If the currently running application is in the first application partition, skip erasing the data of the first application partition and erase the data of the second application partition according to the target upgrade file. If the currently running application is in the second application partition, data erasure of the second application partition is skipped, and data erasure of the first partition is performed according to the target upgrade file.

8. An application data updating device, characterized in that: include: Partition module: used for performing partition operation on the storage module in the microcontroller to obtain a boot loading area, a data verification area, a first application partition and a second application partition, wherein the first application partition and the second application partition are used to store application program data of the vehicle; Receiving module: used for powering on the system, running the boot loader and determining the currently running partition in the first application partition and the second application partition, and determining the target application partition upon receiving the update request sent by the host computer; wherein the target application partition is another partition in the first application partition and the second application partition except the currently running partition; The acquisition module is used to acquire the application identity information, application activation status and application verification code in the current running partition, and verify the current running partition according to the application identity information, application activation status and application verification code to determine the current running partition position and the target application partition position; Update module: used to jump from the boot loader to the specified application if there is no program update command; if an application update command is detected in the boot loader or the application of the currently running partition, perform a program update operation on the target application partition.

9. An electronic device, characterized in that: include: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the application data updating method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program enables a computer to execute the application data updating method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Buoy equipment for software redundancy upgrading and storage method

    CN121349499A