Program data flashing method and related device
By receiving and processing program data containing partition information, and directly matching and flushing the target partition, the problem of large platform load and traffic consumption in OAT upgrade is solved, and efficient partition flushing is achieved.
Patent Information
- Application Number
- CN202411157856.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-08
AI Technical Summary
During the vehicle OAT upgrade process, the existing technology requires repeated conversion and partition conversion of the platform, resulting in increased platform load and excessive traffic consumption.
The program data sent by the receiving platform includes information area and valid data area. The information area contains the partition type, partition address and data length of each partition of the controller. The valid data area contains the valid data to be written in response to remote brushing Write instructions, match the partition type to determine the target partition, and read and flush the target partition data from the valid data area according to the target data length.
No need for repeated conversions on the platform, reducing traffic consumption, improving remote write efficiency, and reducing platform load and transmission costs.
Smart Images

Figure CN118916059A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software technology, and in particular to a program data flashing method and related devices. Background Art
[0002] When the current vehicle is upgraded using OAT (Over-The-Air) technology, it is necessary to remotely download program data from the platform (website visual front-end page or server storage or return information, etc.) to the vehicle terminal via wireless transmission (such as remote 4G connection), and then the vehicle terminal will flash the program data to the controller via wired transmission (such as CAN line messages).
[0003] Due to the chip type and memory management requirements of the controller, different partitions are used when updating the controller, and different partitions store different information. The current OAT upgrade is based on the files issued by the platform. If different partitions need to be flashed, the platform needs to convert the program data according to the partitions, and then remotely download and flash it, which will obviously increase the platform load and greatly increase traffic consumption. Summary of the invention
[0004] In view of the above problems, the present application provides a method and related device for flashing program data to achieve the purpose of flashing partitions without repeated platform conversion. The specific scheme is as follows:
[0005] A first aspect of the present application provides a method for flashing program data, the method comprising:
[0006] Receive program data sent by the platform, the program data includes an information area and a valid data area, the information area includes the partition type, partition address and data length of each partition in the controller, and the valid data area includes the valid data to be flashed in each partition;
[0007] In response to the remote flashing instruction issued by the platform, the target partition to be flashed is determined by matching the partition types of the partitions in the information area, and the target partition address and target data length corresponding to the target partition are obtained;
[0008] The target valid data corresponding to the target partition is read from the valid data area according to the target data length, and the target valid data is flushed to the controller according to the target partition address.
[0009] In a possible implementation, the positions of the partitions in the controller in the valid data area have a sequential relationship;
[0010] The step of reading target valid data corresponding to the target partition from the valid data area according to the target data length includes:
[0011] Determine a preceding partition in the valid data area that precedes the target partition based on the sequential relationship;
[0012] Acquire the preamble data length corresponding to the preamble partition, and determine the starting position of the target partition in the valid data area according to the preamble data length;
[0013] Starting from the starting position, the target valid data is read from the valid data area according to the target data length.
[0014] In a possible implementation, determining the target partition to be flashed by matching the partition types of the partitions in the information area includes:
[0015] In the case where the remote flash instruction indicates non-single variable flash, the first software version issued by the platform and the second software version in the controller are obtained, and the first software version and the second software version are compared; if the first software version is the same as the second software version, the partition whose partition type is the data area in the information area is used as the target partition; if the first software version is different from the second software version, the partition whose partition type is the program area or the data area in the information area is used as the target partition;
[0016] In the case where the remote flash instruction indicates single variable flash, the partition in the information area whose partition type matches the single variable type indicated by the remote flash instruction is used as the target partition.
[0017] In a possible implementation, the information area further includes a data type; when the remote writing instruction indicates non-single variable writing, the data type is one of regular data, compressed data, and encrypted data; when the data type is compressed data, the data length includes a pre-compression data length and a post-compression data length; when the remote writing instruction indicates single variable writing, the data type is regular data;
[0018] The obtaining the target partition address and the target data length corresponding to the target partition includes:
[0019] When the remote flash instruction indicates version flashing and the data type is compressed data, obtaining the target partition address, target pre-compression data length, and target post-compression data length corresponding to the target partition;
[0020] Correspondingly, reading the target valid data corresponding to the target partition from the valid data area according to the target data length, and flashing the target valid data to the controller according to the target partition address, includes:
[0021] Reading the target valid data corresponding to the target partition from the valid data area according to the target compressed data length;
[0022] Decompressing the target valid data, wherein the data length of the decompressed result of the target valid data is the target compressed data length;
[0023] The decompression result of the target valid data is flashed to the controller according to the target partition address.
[0024] In a possible implementation, the information area further includes a file header, and the file header is used to indicate the size of the information area.
[0025] A second aspect of the present application provides a program data flashing device, the program data flashing device comprising:
[0026] A data receiving module is used to receive program data issued by the platform, wherein the program data includes an information area and a valid data area, wherein the information area includes the partition type, partition address and data length of each partition in the controller, and the valid data area includes the valid data to be flashed in each partition;
[0027] A flash response module is used to respond to the remote flash instruction issued by the platform, determine the target partition to be flashed by matching the partition type of each partition in the information area, and obtain the target partition address and target data length corresponding to the target partition; read the target valid data corresponding to the target partition from the valid data area according to the target data length, and flash the target valid data to the controller according to the target partition address.
[0028] In a possible implementation, the positions of the partitions in the controller in the valid data area have a sequential relationship;
[0029] The flash response module for reading the target valid data corresponding to the target partition from the valid data area according to the target data length is specifically used to:
[0030] Based on the sequential relationship, determine the preceding partition in the valid data area that is located before the target partition; obtain the preceding data length corresponding to the preceding partition, and determine the starting position of the target partition in the valid data area according to the preceding data length; starting from the starting position, read the target valid data from the valid data area according to the target data length.
[0031] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the program data flashing method of the first aspect or any implementation of the first aspect.
[0032] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0033] The memory is used to store computer programs;
[0034] The processor is used to execute the computer program so that the electronic device can implement the program data flashing method of the above-mentioned first aspect or any implementation manner of the first aspect.
[0035] The fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the program data flashing method of the above-mentioned first aspect or any implementation method of the first aspect.
[0036] By means of the above technical scheme, the present application provides a method and related device for flashing program data, which receives program data issued by the platform, wherein the program data includes an information area and a valid data area, wherein the information area contains the partition type, partition address and data length of each partition in the controller, and the valid data area contains the valid data to be flashed in each partition; in response to the remote flashing instruction issued by the platform, the target partition to be flashed is determined by matching the partition type of each partition in the information area, and the target partition address and target data length corresponding to the target partition are obtained; the target valid data corresponding to the target partition is read from the valid data area according to the target data length, and the target valid data is flashed to the controller according to the target partition address. In the present application, the program data can be downloaded and stored in the vehicle-mounted terminal, and remotely flashed in a partitioned manner according to the flashing requirements of the platform, which eliminates the need for repeated conversion of the platform, reduces traffic consumption, and improves the efficiency of remote flashing. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0038] Figure 1 Schematic diagram of the system structure for OAT upgrade;
[0039] Figure 2 A flowchart of a method for flashing program data provided in an embodiment of the present application;
[0040] Figure 3 A partial flow chart of a method for flashing program data provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of the structure of a program data flashing device provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0044] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0045] The terms "first", "second" etc. in the specification of the application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, and this is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0046] See also Figure 1 , Figure 1 This is a schematic diagram of the system structure for OAT upgrade. Figure 1 As shown in the figure, since the program data files are converted according to different requirements (for example, the controller manufacturer has a new software version of program data that needs to be updated), if the requirements are updated, platform A needs to re-convert it, and then remotely download it to the vehicle terminal B by wireless transmission, and the vehicle terminal B writes the program data to the controller C by wired transmission (such as CAN line message). This not only requires platform A to repeat processing and increase its load, but also requires remote transmission to consume traffic, increase traffic consumption, and increase costs.
[0047] In order to solve the above problems, the embodiment of the present application provides a method for flashing program data and a related device. The method for flashing program data of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0048] See also Figure 2 , Figure 2 A flowchart of a method for flashing program data provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, a program data flashing method provided in an embodiment of the present application may include steps S10 to S30, and these steps are described in detail below.
[0049] S10, receiving program data sent by the platform, the program data includes an information area and a valid data area, the information area includes the partition type, partition address and data length of each partition in the controller, and the valid data area includes the valid data to be flashed in each partition.
[0050] The program data flashing method provided in the embodiment of the present application can be applied to the vehicle terminal B, and the vehicle terminal B receives the program data sent by the platform A. In the present application, the platform A sends the program data to the vehicle terminal B according to a certain file format, and then the vehicle terminal B takes out the corresponding data from the file format to flash the controller C. It should be noted that for the platform A, the conversion process from the original data file of the program data to the data file following a certain file format can be realized by embedding code in its program.
[0051] In addition, the file format of the program data sent by platform A to the vehicle terminal B is defined as an information area and a valid data area, wherein the information area contains the partition type of any partition in the controller (such as program area, data area, address single variable and DID single variable, etc.), partition address (indicating the address of the partition in the controller, used to define the partition) and data length (indicating the length of the program data of the partition in the valid data area); the valid data area contains the valid data to be flashed of any partition in the controller.
[0052] In practical applications, the size of the information area can be defined, such as a 1K information area, and the vehicle terminal B can divide the information area and the valid data area from the program data based on the size of the information area. Of course, when the valid information in the 1K information area is less than 1K, 1K needs to be supplemented to facilitate data acquisition and processing.
[0053] In a possible implementation, the information area may also include a file header, which is used to indicate the size of the information area. Specifically, the file header may include a size identifier of the information area. For example, the file header occupies one byte, and 0x01 represents a 1k information area. Of course, other byte definitions may also be reserved, and this embodiment of the application does not limit this.
[0054] S20, responding to the remote flash command issued by the platform, determining the target partition to be flashed by matching the partition types of each partition in the information area, and obtaining the target partition address and target data length corresponding to the target partition.
[0055] In an embodiment of the present application, platform A sends a remote flash command to the vehicle terminal B according to actual needs. The vehicle terminal B responds to the remote flash command, determines the current partition to be flashed (i.e., the target partition) by matching the partition types of each partition in the information area, and obtains the partition address (i.e., the target partition address) and data length (i.e., the target data length) corresponding to the target partition.
[0056] Specifically, the remote flash command issued by platform A can indicate the flash of the entire area, or the flash of the data area, or the flash of a single variable. When the controller is flashed with the entire area of program data, the program area and the data area need to be flashed at the same time. Among them, the program area is the area necessary for the program to run and must be flashed, while the data area is the area that supports the program data to run. To ensure that the program file runs according to the normal path, the program area and the data area must be used together. Of course, only the program area and the data area can be used normally if they are the same software version. Therefore, when flashing, the software version of the program data can be judged. If it is not the same software version, the program area and the data area (usually referred to as the entire area) need to be updated at the same time. If it is the same software version, only the data area can be updated. The scenario of flashing a single variable is mainly used for certain configurations that have been replaced on the vehicle, such as changing from a three-speed fan to a silicone oil fan, or some parameters of the vehicle need to be reset after the configuration is updated, such as replacing a new injector and re-adjusting the oil volume compensation, etc. Therefore, based on the current software version of the controller, only a single variable needs to be flashed to update the remote configuration of the vehicle.
[0057] It should be noted that for different types of controllers, the program area and data area are also different. This is related to the main chip used by the controller. When platform A sends program data to vehicle terminal B, the type of controller and its program area and data area are determined. For example, controller 1 may have program area 1, program area 2, data area 1 and data area 2, while controller 2 has program area 3, program area 4, program area 5, data area 3 and data area 4, etc.
[0058] In a possible implementation, in step S20, "determining the target partition to be flashed by matching the partition types of each partition in the information area" may include the following steps:
[0059] In the case where the remote flash instruction indicates non-single variable flash, the first software version issued by the platform and the second software version in the controller are obtained, and the first software version and the second software version are compared; if the first software version is the same as the second software version, the partition whose partition type is the data area in the information area is used as the target partition; if the first software version is different from the second software version, the partition whose partition type is the program area or the data area in the information area is used as the target partition;
[0060] In the case where the remote flash instruction indicates single variable flash, the partition whose partition type in the information area matches the single variable type indicated by the remote flash instruction is used as the target partition.
[0061] In an embodiment of the present application, the remote flash instruction indicates a non-variable flash, that is, it involves a full-area flash or a data area flash. At this time, the vehicle-mounted terminal B can obtain the software version of the program data issued by the platform (that is, the first software version), and the software version of the program data currently loaded by the controller (that is, the second software version); and then compare whether the first software version is the same as the second software version; if the two are the same, only the data area is flashed, and at this time, at least one partition in the information area with a partition type of data area is used as the target partition; if the two are different, it is necessary to flash the program area and the data area at the same time (that is, full-area flash), and at this time, at least one partition in the information area with a partition type of program area and at least one partition with a partition type of data area are used as target partitions.
[0062] S30, reading target valid data corresponding to the target partition from the valid data area according to the target data length, and writing the target valid data to the controller according to the target partition address.
[0063] In an embodiment of the present application, after obtaining the target data length corresponding to the target partition, the vehicle-mounted terminal B can locate the data starting position of the target partition in the valid data area, and then read the valid data from the data starting position in sequence according to the target data length as the target valid data corresponding to the target partition.
[0064] The vehicle-mounted terminal B flashes the target partition of the controller in a wired transmission manner. Specifically, the target partition is located in the controller according to the target partition address, and the target valid data is flashed thereto.
[0065] In a possible implementation, valid data of different controller partitions can be placed in the valid data area in a certain order. Specifically, the positions of the controller partitions in the valid data area have a sequential relationship. Figure 3 , Figure 3 A partial flow chart of a method for flashing program data provided in an embodiment of the present application. Figure 3 As shown, an embodiment of the present application provides a method for flashing program data, wherein in step S30 "reading target valid data corresponding to the target partition from the valid data area according to the target data length" may include steps S301 to S303, and these steps are described in detail below.
[0066] S301, determining a preceding partition in the valid data area that is located before the target partition based on a sequence relationship;
[0067] S302, obtaining the length of the preceding data corresponding to the preceding partition, and determining the starting position of the target partition in the valid data area according to the length of the preceding data;
[0068] S303, starting from the starting position, read the target valid data from the valid data area according to the target data length.
[0069] In the embodiment of the present application, for ease of understanding, it is assumed that the partitions in the controller include partition 1, partition 2, partition 3 and partition 4, and the positions of the partitions in the controller in the valid data area have a sequential relationship of "partition 1→partition 2→partition 3→partition 4". Continuing to assume that the target partition is partition 4, the vehicle-mounted terminal B determines that the partitions located before the target partition in the valid data area (i.e., the pre-order partitions) include partition 1, partition 2 and partition 3 according to the above-mentioned sequential relationship, and then obtains the data lengths of partition 1, partition 2 and partition 3 in the pre-order partition (i.e., the pre-order data length) from the information area, calculates the sum of the pre-order data lengths of partition 1, partition 2 and partition 3, and takes the position of the sum of the pre-order data lengths in the valid data area plus 1 as the starting position of partition 4 in the valid data area, and reads the target valid data from the valid data area from the starting position, and the data length of the target valid data is equal to the target data length.
[0070] In a possible implementation, the information area may also include a data type (indicating the file type of program data, such as regular data, compressed data, encrypted data, etc.). When the remote flash instruction indicates non-single variable flash, the data type is one of regular data, compressed data, and encrypted data, wherein when the data type is compressed data, the data length includes the data length before compression and the data length after compression; when the remote flash instruction indicates single variable flash, the data type is regular data.
[0071] In this regard, the step S20 of "obtaining the target partition address and target data length corresponding to the target partition" may include the following steps:
[0072] When the remote flash instruction indicates version flashing and the data type is compressed data, the target partition address, the target data length before compression and the target data length after compression corresponding to the target partition are obtained;
[0073] Correspondingly, step S30 "reading target valid data corresponding to the target partition from the valid data area according to the target data length, and writing the target valid data to the controller according to the target partition address" may include the following steps:
[0074] Read the target valid data corresponding to the target partition from the valid data area according to the target compressed data length;
[0075] Decompress the target valid data, and the data length of the decompressed result of the target valid data is the target compressed data length;
[0076] The controller is flashed with the decompression result of the target valid data according to the target partition address.
[0077] In the embodiment of the present application, since different controllers correspond to different program areas and data areas, and the addresses of each partition are also different, all this information can be placed in the information area. See Table 1 below, which is an example of a 1K information area provided in an embodiment of the present application. As shown in Table 1, the information area contains a file header, a data type, the number of partitions, and a partition description of each partition (including a partition type, a partition address, and a data length). See Table 2 below, which is an example of a partition description provided in an embodiment of the present application. As shown in Table 2, the partition description contains a partition type, a partition address, a data length 1, and a data length 2.
[0078]
[0079] Table 1
[0080]
[0081] Table 2
[0082] Specifically, in the embodiment of the present application, when remotely flashing, program data often exists in file formats of different data types such as regular data, compressed data, and encrypted data. When the data type is regular data and encrypted data, data length 1 and data length 2 are the same, both representing the data length of each partition, and data length 2 has no practical meaning; when the data type is compressed data, data length 1 is the data length after compression, and data length 2 is the data length before compression. Compressed data represents compression processing of the original program data, and the data length will change, so there are two data lengths before and after compression.
[0083] When the remote flash instruction indicates a single variable flash, there is no problem of compressing and encrypting data, so its data type is regular data. Of course, there are two ways of flashing a single variable, flashing by address or flashing by DID (DID corresponds to a variable in the controller, such as 0x0015 represents the current mileage, similar to the identifier of a variable). Therefore, when flashing by address, data length 2 has no practical meaning and can be the same as data length 1. When flashing by DID, the partition address is the corresponding DID (for example, 0x0015), data length 1 is the data length of DID, and data length 2 has no practical meaning and can be the same as data length 1.
[0084] Based on this, when the remote flash instruction indicates version flashing and the data type is compressed data, the vehicle terminal B can obtain the target partition address while also obtaining the pre-compression data length (i.e., the target pre-compression data length) and the compressed data length (i.e., the target compressed data length) corresponding to the target partition. Then, according to the target compressed data length, the data starting position of the target partition is located in the valid data area, and then, according to the target compressed data length, the valid data is read from the data starting position in sequence as the target valid data; further, the target valid data is decompressed, and the data length of the decompression result of the target valid data is the same as the target compressed data length. Finally, the target partition is located in the controller according to the target partition address, and the decompression result of the target valid data is written to it.
[0085] To facilitate understanding of this application, it is assumed that the controller has program area 1, program area 2, data area 1, data area 2, an address single variable, and a DID single variable, wherein the partition address of program area 1 is 0x80040000, the data length is 0x1000, the partition address of program area 2 is 0x80041000, the data length is 0xC1000, the partition address of data area 1 is 0x80050000, the data length is 0x10000, the partition address of data partition 2 is 0x80061000, the data length is 0xC1000, an address single variable is to operate a variable VALUE, the partition address is 0x80050023, the data length is 4, and a DID single variable is a DID single variable EEA, the partition address is 0x0015, and the data length is 2. The following is an example of a 1K information area:
[0086] 0x01 (file header) 0x01 (data type) 06 (number of partitions)
[0087] 0x01 (Program area) 0x80040000 0x1000 0x1000
[0088] 0x01 (Program area) 0x80041000 0xC1000 0xC1000
[0089] 0x02 (data area) 0x80050000 0x10000 0x10000
[0090] 0x02 (data area) 0x80061000 0xC1000 0xC1000
[0091] 0x03 (address single variable) 0x80050023 00000004 00000004
[0092] 0x04 (DID single variable) 0x0015 00000002 00000002
[0093] The insufficient part of the 1k information area is filled with 0x00.
[0094] After the 1k information area, according to the order of the partitions in the information area, the valid data of each partition is stored in the valid data area in sequence according to the data length in the 1k information area.
[0095] The vehicle terminal B responds to the remote flash command issued by the platform. When flashing the entire area, it compares the software version in the current controller with the software version remotely issued by the platform to see if they are the same version. If they are the same version, only the data area 0x02 in the program data is read for flashing. If they are not the same version, both the program area 0x01 and the data area 0x02 in the program data need to be flashed. In addition, when flashing a single variable, the address single variable of 0x03 or the DID single variable of 0x04 is flashed according to the needs.
[0096] Through the above description, a program data flashing method provided by an embodiment of the present application can flexibly flash partitions according to needs. After the program data is sent, it can be flexibly flashed according to the real-time software version comparison. It does not require various types of interactive judgment information and conversion on the platform. Only one conversion is required, which saves time and has high real-time performance. After sending, only different platform instructions are needed to directly obtain files for flashing. There is no need to request downloads from the platform again, which reduces the failure probability caused by instability during transmission with the platform, reduces traffic consumption, and improves real-time performance.
[0097] A method for flashing program data provided by an embodiment of the present application is introduced above, and a device for executing the method for flashing program data is introduced below.
[0098] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a program data flashing device provided in an embodiment of the present application. Figure 4 As shown, a program data flashing device provided in an embodiment of the present application includes:
[0099] The data receiving module 10 is used to receive the program data sent by the platform. The program data includes an information area and a valid data area. The information area includes the partition type, partition address and data length of each partition in the controller, and the valid data area includes the valid data to be flashed in each partition.
[0100] The flash response module 20 is used to respond to the remote flash command issued by the platform, determine the target partition to be flashed by matching the partition type of each partition in the information area, and obtain the target partition address and target data length corresponding to the target partition; read the target valid data corresponding to the target partition from the valid data area according to the target data length, and flash the target valid data to the controller according to the target partition address.
[0101] In a possible implementation, the positions of the partitions in the controller in the valid data area have a sequential relationship;
[0102] The flash writing response module 20 is used to read the target valid data corresponding to the target partition from the valid data area according to the target data length, and is specifically used to:
[0103] Based on the sequential relationship, determine the preceding partition in the valid data area that is located before the target partition; obtain the preceding data length corresponding to the preceding partition, and determine the starting position of the target partition in the valid data area according to the preceding data length; starting from the starting position, read the target valid data from the valid data area according to the target data length.
[0104] In a possible implementation, the flash response module 20 for determining the target partition to be flashed by matching the partition types of each partition in the information area is specifically configured to:
[0105] In the case where the remote flash instruction indicates non-single-variable flashing, obtain the first software version issued by the platform and the second software version in the controller, and compare the first software version and the second software version; if the first software version is the same as the second software version, use the partition with the partition type of data area in the information area as the target partition; if the first software version is different from the second software version, use the partition with the partition type of program area or data area in the information area as the target partition; in the case where the remote flash instruction indicates single-variable flashing, use the partition in the information area whose partition type matches the single-variable type indicated by the remote flash instruction as the target partition.
[0106] In a possible implementation, the information area also includes a data type; when the remote writing instruction indicates non-single variable writing, the data type is one of regular data, compressed data, and encrypted data; when the data type is compressed data, the data length includes the data length before compression and the data length after compression; when the remote writing instruction indicates single variable writing, the data type is regular data;
[0107] The flash response module 20 for obtaining the target partition address and target data length corresponding to the target partition is specifically used for:
[0108] When the remote flash instruction indicates version flashing and the data type is compressed data, the target partition address, the target data length before compression and the target data length after compression corresponding to the target partition are obtained;
[0109] Correspondingly, the flash response module 20 for reading the target valid data corresponding to the target partition from the valid data area according to the target data length and flashing the target valid data to the controller according to the target partition address is specifically used for:
[0110] The target valid data corresponding to the target partition is read from the valid data area according to the target compressed data length; the target valid data is decompressed, and the data length of the decompressed result of the target valid data is the target compressed data length; the decompressed result of the target valid data is written to the controller according to the target partition address.
[0111] In a possible implementation, the information area also includes a file header, and the file header is used to indicate the size of the information area.
[0112] It should be noted that the detailed functions of each module in the embodiment of the present application can be found in the corresponding public part of the above-mentioned program data flashing method embodiment, and will not be repeated here.
[0113] The present application also provides an electronic device in an embodiment. Figure 5 , Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0114] like Figure 5 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 to a random access memory (RAM) 503. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0115] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a memory card, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0116] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the program data flashing methods provided in the embodiments of the present application.
[0117] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any program data flashing method provided in the embodiment of the present application.
[0118] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0119] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0120] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0121] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A method for flashing program data, It is characterized in that The program data flashing method comprises: Receive program data sent by the platform, the program data includes an information area and a valid data area, the information area includes the partition type, partition address and data length of each partition in the controller, and the valid data area includes the valid data to be flashed in each partition; In response to the remote flashing instruction issued by the platform, the target partition to be flashed is determined by matching the partition types of the partitions in the information area, and the target partition address and target data length corresponding to the target partition are obtained; The target valid data corresponding to the target partition is read from the valid data area according to the target data length, and the target valid data is flushed to the controller according to the target partition address.
2. The program data flashing method according to claim 1, It is characterized in that The positions of the partitions in the controller in the valid data area have a sequential relationship; The step of reading target valid data corresponding to the target partition from the valid data area according to the target data length includes: Determine a preceding partition in the valid data area that precedes the target partition based on the sequential relationship; Acquire the preamble data length corresponding to the preamble partition, and determine the starting position of the target partition in the valid data area according to the preamble data length; Starting from the starting position, the target valid data is read from the valid data area according to the target data length.
3. The program data flashing method according to claim 1, It is characterized in that The step of determining the target partition to be flashed by matching the partition types of the partitions in the information area includes: In the case where the remote flash instruction indicates non-single variable flash, the first software version issued by the platform and the second software version in the controller are obtained, and the first software version and the second software version are compared; if the first software version is the same as the second software version, the partition whose partition type is the data area in the information area is used as the target partition; if the first software version is different from the second software version, the partition whose partition type is the program area or the data area in the information area is used as the target partition; In the case where the remote flash instruction indicates single variable flash, the partition in the information area whose partition type matches the single variable type indicated by the remote flash instruction is used as the target partition.
4. The program data flashing method according to claim 3, It is characterized in that The information area also includes a data type; when the remote flash instruction indicates non-single variable flash, the data type is one of regular data, compressed data, and encrypted data; when the data type is compressed data, the data length includes a data length before compression and a data length after compression; In the case where the remote flash instruction indicates single variable flash, the data type is regular data; The obtaining the target partition address and the target data length corresponding to the target partition includes: When the remote flash instruction indicates version flashing and the data type is compressed data, obtaining the target partition address, target pre-compression data length, and target post-compression data length corresponding to the target partition; Correspondingly, reading the target valid data corresponding to the target partition from the valid data area according to the target data length, and flashing the target valid data to the controller according to the target partition address, includes: Reading the target valid data corresponding to the target partition from the valid data area according to the target compressed data length; Decompressing the target valid data, wherein the data length of the decompressed result of the target valid data is the target compressed data length; The decompression result of the target valid data is flashed to the controller according to the target partition address.
5. The program data flashing method according to claim 1, It is characterized in that The information area also includes a file header, and the file header is used to indicate the size of the information area.
6. A program data flashing device, It is characterized in that The program data flashing device comprises: A data receiving module is used to receive program data issued by the platform, wherein the program data includes an information area and a valid data area, wherein the information area includes the partition type, partition address and data length of each partition in the controller, and the valid data area includes the valid data to be flashed in each partition; A flash response module is used to respond to the remote flash instruction issued by the platform, determine the target partition to be flashed by matching the partition type of each partition in the information area, and obtain the target partition address and target data length corresponding to the target partition; read the target valid data corresponding to the target partition from the valid data area according to the target data length, and flash the target valid data to the controller according to the target partition address.
7. The program data flashing device according to claim 6, It is characterized in that The positions of the partitions in the controller in the valid data area have a sequential relationship; The flash response module for reading the target valid data corresponding to the target partition from the valid data area according to the target data length is specifically used to: Based on the sequential relationship, determine the preceding partition in the valid data area that is located before the target partition; obtain the preceding data length corresponding to the preceding partition, and determine the starting position of the target partition in the valid data area according to the preceding data length; starting from the starting position, read the target valid data from the valid data area according to the target data length.
8. A computer program product, It is characterized in that It comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the program data flashing method as claimed in any one of claims 1 to 5.
9. An electronic device, It is characterized in that The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the program data flashing method as described in any one of claims 1 to 5.
10. A computer storage medium, It is characterized in that The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the program data flashing method as described in any one of claims 1 to 5.
