File flashing method and system of vehicle-mounted terminal, electronic equipment and storage medium

By generating and managing the index of data blocks, the target data blocks in the area to be flashed in the ECU are filtered out, which solves the problems of low flushing efficiency and large memory usage in the prior art, and realizes a more efficient flushing process and lower hardware dependence.

CN119847577APending Publication Date: 2025-04-18WEICHAI DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510015773.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The prior art is inefficient and occupies a lot of memory during the ECU file flushing process, affecting the operation efficiency of the equipment, and relying heavily on hardware configuration.

Method used

By obtaining the data rows in the target file, a data block, its start and end addresses, is generated, and stored in the index_map_ container. For the area to be flushed in the ECU, it is determined whether there is a target data block in the data block, and extract the data to be flushed from the target data block for flushing.

Benefits of technology

It reduces the memory usage during file flushing, improves the flushing efficiency, optimizes the operating efficiency of the device, and reduces the dependence on hardware configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847577A_ABST
    Figure CN119847577A_ABST
Patent Text Reader

Abstract

The invention provides a file flashing method and system for a vehicle-mounted terminal, electronic equipment and a storage medium, and the method comprises the steps: obtaining a target file which comprises a plurality of data lines arranged in sequence; generating each data block and a starting address and an ending address thereof according to each data line, and storing the starting address and the ending address of each data block into an indexmap container; for each to-be-flashed area in the ECU, acquiring an initial address and a length corresponding to the to-be-flashed area; according to the initial address of the to-be-flashed area and the initial address and the end address of each data block stored in the indexmap container, judging whether a target data block flashed into the to-be-flashed area exists in each data block or not; and if the target data block exists, determining to-be-flashed data from the target data block according to the initial address and the length of the to-be-flashed area, and storing the to-be-flashed data to the to-be-flashed area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data flashing, and more specifically, to a file flashing method, system, electronic device and storage medium for a vehicle-mounted terminal. Background Art

[0002] With the rapid development and popularization of smart cars, remote download (OTA) technology has been increasingly widely used. Automobile remote download technology provides technical support for remote upgrades of the Electronic Control Unit (ECU) of smart cars.

[0003] In the prior art, an external data flashing tool can be used to send files to the ECU through the ECU communication network, so that the ECU uses the received files to flash the files; however, this method generally uses the ECU to parse and flash the files line by line. However, this not only has low file flashing efficiency, but also occupies a large amount of memory during the flashing process, thereby affecting the operating efficiency of the device (ECU), and is highly dependent on related hardware configurations. Summary of the invention

[0004] In view of this, the present application provides a file flashing method, system, electronic device and storage medium for a vehicle-mounted terminal to reduce memory usage and improve file flashing efficiency, thereby optimizing the operating efficiency of the device and reducing dependence on hardware configuration.

[0005] The first aspect of the present application provides a file flashing method for a vehicle-mounted terminal, the method comprising:

[0006] Acquire a target file, wherein the target file includes a plurality of data rows arranged in sequence;

[0007] Generate each data block and its starting address and ending address according to each data row, and store the starting address and ending address of each data block into the index_map_ container;

[0008] For each area to be flashed in the ECU, obtain the starting address and length corresponding to the area to be flashed;

[0009] According to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container, it is determined whether there is a target data block to be flushed into the area to be flushed in each data block;

[0010] If the target data block exists, the data to be written is determined from the target data block according to the starting address and length of the area to be written, and the data to be written is stored in the area to be written.

[0011] Optionally, generating each data block and its starting address and ending address according to each data row, and storing the starting address and ending address of each data block in an index_map_container includes:

[0012] Determine the data rows to be parsed from each data row in sequence;

[0013] Parsing the data row to be parsed to determine whether the instruction type of the data row to be parsed is the first instruction type;

[0014] If the instruction type to be parsed is not the first instruction type, determining whether the instruction type of the data row to be parsed is the second instruction type;

[0015] If the instruction type of the data row to be parsed is the second instruction type, extracting the data row to be parsed and its associated data rows from each of the data rows;

[0016] Generate a data block and its starting address and ending address according to the to-be-parsed data row and its associated data rows;

[0017] Store the starting address and the ending address of the data block into the index_map_ container;

[0018] The data row to be parsed and its associated data rows are removed from each data row, and the process returns to sequentially determine the data row to be parsed from each data row until there is no data row to be parsed in each data row.

[0019] Optionally, generating a data block and a start address and an end address thereof according to the to-be-parsed data row and its associated data rows includes:

[0020] Generate corresponding data blocks according to the data to be parsed and each data row associated therewith;

[0021] Generate a starting address of the data block according to the data in the to-be-parsed data row and the address of the next data row of the to-be-parsed data row;

[0022] The end address of the data block is generated according to the data in the to-be-parsed data row and the address of the last data row in each data row associated with the to-be-parsed data.

[0023] Optionally, judging whether there is a target data block to be flushed into the area to be flushed in each of the data blocks according to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container, comprises:

[0024] For each of the data blocks, obtain the starting address and the ending address of the data block from the index_map_container, and construct a data address range of the data block according to the starting address and the ending address of the data block;

[0025] Determine whether the starting address of the area to be flashed is within the data address range;

[0026] If so, determining that the data block is a target data block to be flushed into the area to be flushed;

[0027] If not, it is determined that the data block is not a target data block to be flushed into the area to be flushed.

[0028] Optionally, determining the data to be written from the target data block according to the starting address and the length of the area to be written, and storing the data to be written in the area to be written, includes:

[0029] Generate a file instruction for the area to be flashed according to the starting address of the area to be flashed;

[0030] Determining a storage location of the target data block according to a starting address of the target data block and an offset thereof;

[0031] Move the file instruction of the area to be flushed to the storage location of the target data block, and extract data corresponding to the length of the area to be flushed from the data corresponding to the starting address of the area to be flushed in the target data block;

[0032] Generate data to be written according to the extracted data, and write the data to be written to the area to be written.

[0033] A second aspect of the present application provides a file flashing system for a vehicle-mounted terminal, the system comprising:

[0034] A first acquisition unit, configured to acquire a target file, wherein the target file includes a plurality of data rows arranged in sequence;

[0035] A storage unit, used for generating each data block and its starting address and ending address according to each data row, and storing the starting address and ending address of each data block into the index_map_container;

[0036] A second acquisition unit is used to acquire, for each area to be flashed in the ECU, a starting address and a length corresponding to the area to be flashed;

[0037] A first judgment unit is used to judge whether there is a target data block to be flushed into the area to be flushed in each of the data blocks according to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container;

[0038] The flashing unit is used to determine the data to be flashed from the target data block according to the starting address and length of the area to be flashed if the target data block exists, and store the data to be flashed in the area to be flashed.

[0039] Optionally, the storage unit includes:

[0040] A to-be-parsed data row determining unit, used to sequentially determine the to-be-parsed data row from each data row;

[0041] A parsing unit, configured to parse the data row to be parsed to determine whether the instruction type of the data row to be parsed is a first instruction type;

[0042] a second judgment unit, configured to judge whether the instruction type of the data row to be parsed is a second instruction type if the instruction type to be parsed is not the first instruction type;

[0043] an extracting unit, configured to extract the data row to be parsed and its associated data rows from each of the data rows if the instruction type of the data row to be parsed is the second instruction type;

[0044] A generating unit, configured to generate a data block and a starting address and an ending address thereof according to the to-be-parsed data row and its associated data rows;

[0045] A storage subunit, used for storing the start address and the end address of the data block into the index_map_container;

[0046] The removing unit is used to remove the data row to be parsed and its associated data rows from each data row, and return to execute the data row to be parsed determining unit until there is no data row to be parsed in each data row.

[0047] Optionally, the generating unit includes:

[0048] A first generating subunit, configured to generate corresponding data blocks according to the data to be parsed and each data row associated therewith;

[0049] A second generating subunit, configured to generate a starting address of the data block according to the data in the to-be-parsed data row and an address of a next data row of the to-be-parsed data row;

[0050] The third generating subunit is used to generate the end address of the data block according to the data in the data row to be parsed and the address of the last data row in each data row associated with the data to be parsed.

[0051] The third aspect of the present application provides an electronic device, comprising: a processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; and the memory is used to store a program, wherein the program is used to implement a file flashing method for a vehicle-mounted terminal as provided in the first aspect of the present application.

[0052] The fourth aspect of the present application provides a storage medium, in which computer executable instructions are stored, and the computer executable instructions are used to execute a file flashing method for a vehicle-mounted terminal as provided in the first aspect of the present application.

[0053] The present application provides a file flashing method, system, electronic device and storage medium for a vehicle-mounted terminal, which obtain a target file, wherein the target file includes a plurality of data rows arranged in sequence; generate each data block and its starting address and ending address according to each data row, and store the starting address and ending address of each data block in an index_map_container; for each area to be flashed in an ECU, obtain the starting address and length corresponding to the area to be flashed; determine whether there is a target data block to be flashed into the area to be flashed in each data block according to the starting address of the area to be flashed and the starting address and ending address of each data block stored in the index_map_container; if the target data block exists, determine the data to be flashed from the target data block according to the starting address and length of the area to be flashed, and store the data to be flashed in the area to be flashed. It can be seen that the technical solution provided by the present application can first extract multiple data blocks from the target file, so that when the ECU is flashing the file, the target data blocks to be flashed into each area to be flashed in the ECU can be screened out from each data block. Finally, the key information (data to be flashed) that is finally flashed into each area to be flashed can be further extracted from each target data block. In this way, not only can the required flashing data be obtained according to the requirements of the area to be flashed (starting address and length), but also the memory occupancy rate during the flashing process can be reduced, thereby optimizing the operating efficiency of the equipment and reducing dependence on hardware configuration. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0055] Figure 1 A schematic diagram of a process flow of a file flashing method for a vehicle terminal provided in an embodiment of the present application;

[0056] Figure 2 An example diagram of the data format of a data row provided in an embodiment of the present application;

[0057] Figure 3 An example diagram of a method for generating and storing a data block and its starting address, ending address and file pointer provided in an embodiment of the present application;

[0058] Figure 4 An example diagram of an embodiment of the present application for determining data to be flushed from a target data block according to a starting address and a length of the area to be flushed, and storing the data to be flushed in the area to be flushed;

[0059] Figure 5 A schematic diagram of the structure of a file flashing system for a vehicle terminal provided in an embodiment of the present application;

[0060] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

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

[0063] In order to better understand this application, the technical names involved in this application are explained below:

[0064] An electronic controller (also known as an electronic control unit or ECU) is an embedded system in automotive electronic systems that is used to control electrical systems, electronic systems, and automotive subsystems.

[0065] ECU data flashing, also known as ECU data filling, has the following basic principle: the external data flashing tool sends data information to the ECU through the ECU communication network (mostly K-line and CAN bus) to achieve ECU data management and update.

[0066] Flash file: A file that stores new firmware or updated data. The file format used for flashing is usually S19 and HEX. The file contains the program code, configuration data or calibration parameters required by the ECU.

[0067] ProF file: A data file format used in vehicle electronic controllers (ECUs) that contains information for system configuration, firmware updates, and parameter calibration. This type of file is used to transmit and store key information during vehicle maintenance, upgrades, and diagnostics.

[0068] Data block: refers to a logical unit consisting of a group of continuous data within a specific address range in a Hex file. The starting address of each data block is defined by an extended linear address record with instruction type 04, which represents the high-order address part of the block data in memory.

[0069] Extended Linear Address Record: A special record type in the Intel HEX file format that is used to support memory addressing exceeding 64KB.

[0070] See also Figure 1 , shows a schematic flow chart of a file flashing method for a vehicle terminal provided in an embodiment of the present application, the method specifically comprising the following steps:

[0071] S101: Acquire a target file, where the target file includes a plurality of data rows arranged in sequence.

[0072] In the specific process of executing step S101 , when it is necessary to flash the ECU data of the vehicle-mounted terminal, a flash file that needs to be input into the ECU, ie, a target file, can be obtained.

[0073] The target file includes multiple data rows arranged in sequence, and the data format of each data row is as follows: Figure 2 shown.

[0074] In the examples of this application, see Figure 2, for each data line in the target file, ":" is used as the start code; two hexadecimal digits constitute the byte length, representing the byte length of the data area; the address is composed of four hexadecimal digits, representing the 16-bit starting register address offset of the data; the explanation of the instruction type in the data line can be found in Table 2; the data of the data line is composed of a data sequence composed of n bytes, each word consists of two hexadecimal digits, and the value of n is equal to the value of the byte length.

[0075] It should be noted that the target file may be a Hex file. For example, the Hex file includes a plurality of data rows arranged in sequence, as shown in Table 1.

[0076] Table 1:

[0077] Line Number Contents of hex file 1 :0200000480007A 2 :2000000030000000043D…0300AFAFAFAFAFAFF3 … … 2049 :20FFE000000000000000…000000000000000000001 2050 :02000004800179 2051 :200000000000000000000…00000000000000000E0 … … 4101 :0CFFF400270141D372E3229F8D1CDD60C9 4102 :02000004800278 … … 57379 :00000001FF

[0078] It should be noted that, for each data line in the Hex file, the data line includes a start code, a byte length, an address, an instruction type, data, and a check code.

[0079] It should also be noted that the instruction type can be represented by "00", "01", "02", "03", "04", and "05"; each instruction type and its function are shown in Table 2.

[0080] Table 2:

[0081] Instruction Type effect "00” Indicates that the row records data (the content of the flash) "01” Indicates the end of the hex file, usually appears at the end of the file "02” Indicates that the record is the extended segment address (data address segment) "03” Indicates that the record is the start segment address "04” Indicates that the record is an extended linear address "05” Indicates that the record is the starting linear address

[0082] S102: Generate each data block and its starting address and ending address according to each data row, and store the starting address and ending address of each data block into the index_map_container.

[0083] In the specific process of executing step S102, after obtaining the target file, the obtained target file can be preprocessed first to simplify the content of the entire flash file (target file) into different data blocks, and at the same time determine the starting address and ending address of each data block, and store the obtained starting address and ending address of each data block in the index_map_container, so that the key information (data to be flashed) that needs to be flashed in each area to be flashed in the ECU can be filtered out from each data block according to the starting address and ending address of each data block stored in the index_map_container, thereby achieving the purpose of reducing the content occupancy rate during the flashing process.

[0084] In an embodiment of the present application, for each data row in the target file, multiple data rows with an associated relationship can be determined according to the instruction type in each data row, and a data block and its starting address and ending address can be generated according to the multiple data rows with an associated relationship, and finally the data block and its starting address and ending address can be stored in the index_map_ container.

[0085] Optionally, the process of generating each data block and its starting address and ending address according to each data row, and storing the starting address and ending address of each data block in the index_map_container can be specifically as follows: determine the data row to be parsed from each data row in sequence; parse the data row to be parsed to determine whether the instruction type of the data row to be parsed is the first instruction type; if the instruction type to be parsed is not the first instruction type, determine whether the instruction type of the data row to be parsed is the second instruction type; if the instruction type of the data row to be parsed is the second instruction type, extract the data row to be parsed and its associated data rows from each data row; generate data blocks and their starting address and ending address according to the data row to be parsed and its associated data rows; store the data blocks and their starting address and ending address in the index_map_container; remove the data row to be parsed and its associated data rows from each data row, and return to execute the process of determining the data row to be parsed from each data row in sequence until there are no data rows to be parsed in each data row. If the instruction type of the data row to be parsed is the first instruction type, the preprocessing process of the target file can be directly ended; if the instruction type of the data row to be parsed is not the first instruction type and is not the second instruction type, the data row to be parsed can be removed from each data row, and the execution is returned to sequentially determine the data row to be parsed from each data row until there is no data row to be parsed in each data row.

[0086] As a preferred method in an embodiment of the present application, the process of generating a data block, a starting address and an ending address of a data block according to a data row to be parsed and its associated data rows can be specifically as follows: generating a data block according to the data row to be parsed and the corresponding data rows of each data row associated with the data row to be parsed; generating a starting address of a data block according to the data in the data row to be parsed and the address of the next data row of the data row to be parsed; generating an ending address of a data block according to the data in the data row to be parsed and the address of the last data row in the data rows associated with the data to be parsed.

[0087] It should be noted that the first instruction type and the second instruction type can be set according to actual applications; for example, when the target file is an Hxe file, the first instruction type can be "01" that indicates the end of the Hex file, and the second instruction type can be "04" that indicates an extended linear address. The first instruction type and the second instruction type can be set according to actual applications, and this is not limited in the embodiments of the present application.

[0088] In some embodiments, when it is determined that the instruction type of the data row to be parsed is the second instruction type, the continuous data rows whose order is below the type to be parsed and whose instruction type is the target instruction type can be determined as the data rows associated with the data row to be parsed, and a corresponding data block is generated according to the data row to be parsed and each data row associated with it; the starting address of the data block is generated according to the address in the data row to be parsed that is the first in the multiple data rows associated with the data row to be parsed; the end address of the data block is generated according to the address and byte length in the data row to be parsed that is the last in the multiple data rows associated with the data row to be parsed. Wherein, when the target file is an Hxe file, the target instruction type can be "00", which can be set according to the actual application, and is not limited in this embodiment of the present application.

[0089] Furthermore, for each data block, a file pointer of the data block may be further calculated according to the starting address of the data block, and the file pointer of the data block may be stored in the index_map_container.

[0090] In actual application, see Figure 3After obtaining the Hex file, you can parse the first line of data in the Hex file (the first data line), that is, determine the first line of data as the data line to be parsed; determine whether the instruction type recordType in the data line to be parsed is "01"; if so, you can end the current parsing process; if not, you can further determine whether the instruction type recordType in the data line to be parsed is "04"; if not, you can remove the data line to be parsed from the Hex file, and use the next line of data (the second data line) as the data line to be parsed, and return to execute the step of determining whether the instruction type recordType in the data line to be parsed is "01"; if so, starting from the next line of the data line to be parsed, you can determine the consecutive data lines with the instruction type of "00" as the relevant data line to be parsed. The method comprises the following steps: generating a corresponding data block according to the data to be parsed and the data rows associated with the data to be parsed; generating a starting address of the data block according to the data in the data row to be parsed and the address of the next data row of the data row to be parsed, and generating a file pointer of the data block according to the starting address; generating an ending address of the data block according to the data in the data row to be parsed and the address of the last data row in the data rows associated with the data to be parsed; storing the generated data block and its starting address, ending address and file pointer in the index_map_ container; removing the data row to be parsed and the data rows associated with the data row to be parsed from the Hex file, re-determining the next row of data of the last row of data in the data rows associated with the data row to be parsed as the data to be parsed, and returning to the step of determining whether the instruction type recordType in the data row to be parsed is "01".

[0091] For example, taking the Hex file shown in Table 1 as an example, first, the first data row in the Hex file can be used as the data row to be parsed; it can be seen from Table 1 that the instruction type of the data row to be parsed is the second instruction type (04), and then starting from the second data row, the continuous data rows with the instruction type of "00" can be determined as the data rows associated with the data row to be parsed, that is, it can be seen from Table 1 that the data rows corresponding to the row numbers 2-2049 can be determined as the data rows associated with the data row to be parsed, and the corresponding data blocks are generated according to the data rows corresponding to the row numbers 1-2049 (the data row to be parsed and its associated data rows); and the starting address of the data block can be generated as 80000000 according to the data (8000) in the data row to be parsed and the address (0000) in the data row with the row number 2; according to the data (8000) in the data row to be parsed, the address (FFE0) in the data row with the row number 2049 and the byte length, the end address of the data block is determined to be 8000FFE0+19.

[0092] S103: For each area to be flashed in the ECU, obtain the starting address and length corresponding to the area to be flashed.

[0093] In an embodiment of the present application, when flashing the ECU, the memory of the ECU can be first divided into multiple different areas to be flashed, so that the data to be flashed required for the area to be flashed can be subsequently determined based on the starting address and length of each area to be flashed; specifically, the ProF file corresponding to the vehicle-mounted terminal to which the ECU belongs can be obtained, and the starting address and length (flash length) corresponding to the area to be flashed can be obtained from the ProF file.

[0094] It should be noted that the various areas to be flashed corresponding to the ECU may include the Bootloader area, DATA area and CODE area, among which the Bootloader area is responsible for starting the ECU and is usually not modifiable; the DATA area stores calibration data, configuration parameters, etc.; the CODE area stores control programs and algorithms and is often used for flashing updates.

[0095] It should also be noted that the PROF file of the ECU is usually generated by the automobile manufacturer, ECU supplier or developer for debugging, calibration or flashing operations, and corresponds to a specific ECU. The PROF file specifies the starting address and length required for flashing different areas (such as the DATA area), and the target file stores the data corresponding to these addresses.

[0096] Therefore, when performing a flash operation, you can first obtain the starting address and flash length of each area from the PROF file, and then extract the data in the corresponding address range from the target file, so as to obtain the required flash data according to the needs, which can reduce the memory usage during the flash process to a certain extent. For example, if the address range of the DATA area is 0x00 to 0xFFFFF, you need to extract the data in this range from the HEX file for flashing.

[0097] S104: According to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container, it is determined whether there is a target data block to be flushed into the area to be flushed. If there is a target data block, step S105 is executed.

[0098] In the specific process of executing step S104, after obtaining the starting address of the area to be flashed, the data address range corresponding to each data block stored in the index_map_ container can be further obtained, and based on the starting address of the area to be flashed and the data address range of each data block, the target data block where the data to be flashed in the area to be flashed is flashed is determined from each data block.

[0099] Optionally, for each data block, obtain the starting address and ending address of the data block from the index_map_container, and construct a data address range of the data block based on the starting address and ending address of the data block; determine whether the starting address of the area to be flushed is within the data address range; if so, determine that the data block is the target data block flushed into the area to be flushed; if not, determine that the data block is not the target data block flushed into the area to be flushed.

[0100] For example, assuming that the starting address of the area to be flushed is 0x00, it can be determined whether there is a data block containing the starting address 0x00 in the data address range of each data block; if so, the data block corresponding to the data address range containing the starting address 0x00 can be determined as the target data block of the area to be flushed. If not, it can be determined that there is no data block of the data to be flushed into the area to be flushed in the data blocks, and thus the flushing operation can be omitted for the area to be flushed.

[0101] S105: Determine the data to be written from the target data block according to the starting address and length of the area to be written, and store the data to be written in the area to be written.

[0102] In an embodiment of the present application, after obtaining the starting address and length of the area to be written, a file instruction for the area to be written can be generated according to the starting address of the area to be written; the storage location of the target data block is determined according to the starting address of the target data block and its offset; the file instruction for the area to be written is moved to the storage location of the target data block, and data corresponding to the length of the area to be written is extracted from the data corresponding to the starting address of the area to be written in the target data block; data to be written is generated according to the extracted data, and the data to be written is written to the area to be written, such as Figure 4 shown.

[0103] It should be noted that after extracting the corresponding data from the target data block, it can be determined whether the length of the extracted data is greater than the length of the area to be flashed; if it is equal, the extracted data can be directly used as the data to be flashed; if it is less, 00 or FF can be filled after the extracted data until the length is equal to the length of the area to be flashed, and the data to be flashed is obtained.

[0104] It should also be noted that the end address of the area to be flashed can be determined based on the starting address and length of the area to be flashed, and it can be determined whether the end address of the area to be flashed is within the data address range of the target data block; if it is, it means that data equal to the length of the area to be flashed can be extracted from the target data block; if it is not, it means that the length of the data extracted from the target data block is less than the length of the area to be flashed. At this time, the extracted data can be filled until data equal to the length of the area to be flashed is obtained, and the data to be flashed can be obtained.

[0105] The present application provides a file flashing method for a vehicle-mounted terminal, which comprises obtaining a target file, wherein the target file comprises a plurality of data rows arranged in sequence; generating each data block and its starting address and ending address according to each data row, and storing the starting address and ending address of each data block in an index_map_container; obtaining the starting address and length corresponding to each area to be flashed in an ECU; judging whether there is a target data block to be flashed into the area to be flashed in each data block according to the starting address of the area to be flashed and the starting address and ending address of each data block stored in the index_map_container; if there is a target data block, determining the data to be flashed from the target data block according to the starting address and length of the area to be flashed, and storing the data to be flashed in the area to be flashed. It can be seen that the technical solution provided by the present application can first extract multiple data blocks from the target file, so that when the ECU is flashing the file, the target data blocks to be flashed into each area to be flashed in the ECU can be screened out from each data block. Finally, the key information (data to be flashed) that is finally flashed into each area to be flashed can be further extracted from each target data block. In this way, not only can the required flashing data be obtained according to the requirements of the area to be flashed (starting address and length), but also the memory occupancy rate during the flashing process can be reduced, thereby optimizing the operating efficiency of the equipment and reducing dependence on hardware configuration.

[0106] Based on the file flashing method for the vehicle terminal provided in the above embodiment of the present application, correspondingly, the embodiment of the present application also provides a file flashing system for the vehicle terminal, such as Figure 5 As shown, the file flashing system of the vehicle terminal includes:

[0107] A first acquisition unit 51 is used to acquire a target file, where the target file includes a plurality of data rows arranged in sequence;

[0108] The storage unit 52 is used to generate each data block and its starting address and ending address according to each data row, and store the starting address and ending address of each data block into the index_map_ container;

[0109] The second acquisition unit 53 is used to acquire the starting address and length of each area to be flashed in the ECU;

[0110] The first judgment unit 54 is used to judge whether there is a target data block to be flushed into the area to be flushed in each data block according to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container;

[0111] The flashing unit 55 is used to determine the data to be flashed from the target data block according to the starting address and length of the area to be flashed if the target data block exists, and store the data to be flashed in the area to be flashed.

[0112] The specific principles and execution processes of each unit in the file flashing system of the vehicle-mounted terminal disclosed in the above-mentioned embodiment of the present application are the same as the file flashing method of the vehicle-mounted terminal disclosed in the above-mentioned embodiment of the present application. Please refer to the corresponding parts of the file flashing method of the vehicle-mounted terminal disclosed in the above-mentioned embodiment of the present application, and will not be repeated here.

[0113] The present application provides a file flashing system for an in-vehicle terminal, which obtains a target file, wherein the target file includes a plurality of data rows arranged in sequence; generates each data block and its starting address and ending address according to each data row, and stores the starting address and ending address of each data block in an index_map_container; obtains the starting address and length corresponding to each area to be flashed in an ECU; determines whether there is a target data block to be flashed in each data block according to the starting address of the area to be flashed and the starting address and ending address of each data block stored in the index_map_container; if there is a target data block, determines the data to be flashed from the target data block according to the starting address and length of the area to be flashed, and stores the data to be flashed in the area to be flashed. It can be seen that the technical solution provided by the present application can first extract multiple data blocks from the target file, so that when the ECU is flashing the file, the target data blocks to be flashed into each area to be flashed in the ECU can be screened out from each data block. Finally, the key information (data to be flashed) that is finally flashed into each area to be flashed can be further extracted from each target data block. In this way, not only can the required flashing data be obtained according to the requirements of the area to be flashed (starting address and length), but also the memory occupancy rate during the flashing process can be reduced, thereby optimizing the operating efficiency of the equipment and reducing dependence on hardware configuration.

[0114] Optionally, a to-be-parsed data row determining unit is used to sequentially determine the to-be-parsed data row from each data row;

[0115] A parsing unit, used for parsing the data line to be parsed to determine whether the instruction type of the data line to be parsed is the first instruction type;

[0116] A second judgment unit, configured to judge whether the instruction type of the data row to be parsed is a second instruction type if the instruction type to be parsed is not the first instruction type;

[0117] a data row extraction unit, configured to extract the data row to be parsed and its associated data rows from each data row if the instruction type of the data row to be parsed is the second instruction type;

[0118] A generating unit, used for generating a data block and a starting address and an ending address thereof according to a data row to be parsed and its associated data rows;

[0119] A storage subunit, used for storing the start address and the end address of the data block into the index_map_ container;

[0120] The elimination unit is used to eliminate the data row to be parsed and its associated data rows from each data row, and return to execute the data row to be parsed determination unit until there is no data row to be parsed in each data row.

[0121] Optionally, generate a unit, including:

[0122] A first generating subunit, configured to generate corresponding data blocks according to the data to be parsed and each data row associated therewith;

[0123] A second generating subunit, used for generating a starting address of a data block according to data in the data row to be parsed and an address of a data row next to the data row to be parsed;

[0124] The third generating subunit is used to generate an end address of the data block according to the data in the data row to be parsed and the address of the last data row in each data row associated with the data to be parsed.

[0125] Optionally, the first judging unit includes:

[0126] A data address range determination unit, used for obtaining the start address and the end address of each data block from the index_map_container, and forming a data address range of the data block according to the start address and the end address of the data block;

[0127] A third judgment unit is used to judge whether the starting address of the area to be flashed is within the data address range;

[0128] A first determining unit is used to determine that the data block is a target data block to be flushed into the area to be flushed if located;

[0129] The second determining unit is configured to determine that the data block is not a target data block to be flushed into the area to be flushed if the data block is not located therein.

[0130] Optional, flash unit, including:

[0131] A file instruction generating unit, used for generating a file instruction of the area to be flashed according to the starting address of the area to be flashed;

[0132] A storage position determination unit, used to determine the storage position of the target data block according to the starting address and offset of the target data block;

[0133] A data extraction unit is used to move the file instruction of the area to be flushed to the storage position of the target data block, and extract data corresponding to the length of the area to be flushed from the data corresponding to the starting address of the area to be flushed in the target data block;

[0134] The flash subunit is used to generate data to be flashed according to the extracted data, and flash the data to be flashed to the area to be flashed.

[0135] The present application also provides a storage medium, which stores computer-executable instructions. When the computer-readable instructions are loaded and executed by a processor, any of the above-mentioned file flashing method embodiments for a vehicle-mounted terminal is implemented.

[0136] The present application also provides an electronic device, such as Figure 6 As shown, the electronic device includes a processor 601 and a memory 602; a program is stored in the memory; the processor calls the program in the memory to execute any one of the above-mentioned file flashing method embodiments of the vehicle-mounted terminal.

[0137] The processor in the present application may be a CPU of a terminal, or an MCU integrated in the terminal, or a combination of a CPU and an MCU. Moreover, the processor includes a kernel, which retrieves a corresponding program from a memory, and one or more kernels may be provided.

[0138] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0139] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which 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 on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

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

[0141] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

[0142] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A file flashing method for a vehicle-mounted terminal, characterized in that: The method comprises: Acquire a target file, wherein the target file includes a plurality of data rows arranged in sequence; Generate each data block and its starting address and ending address according to each data row, and store the starting address and ending address of each data block into the index_map_ container; For each area to be flashed in the ECU, obtain the starting address and length corresponding to the area to be flashed; According to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container, it is determined whether there is a target data block to be flushed into the area to be flushed in each data block; If the target data block exists, the data to be written is determined from the target data block according to the starting address and length of the area to be written, and the data to be written is stored in the area to be written.

2. The method according to claim 1, characterized in that Generating each data block and its starting address and ending address according to each data row, and storing the starting address and ending address of each data block in the index_map_ container, includes: Determine the data rows to be parsed from each data row in sequence; Parsing the data row to be parsed to determine whether the instruction type of the data row to be parsed is the first instruction type; If the instruction type to be parsed is not the first instruction type, determining whether the instruction type of the data row to be parsed is the second instruction type; If the instruction type of the data row to be parsed is the second instruction type, extracting the data row to be parsed and its associated data rows from each of the data rows; Generate a data block and its starting address and ending address according to the to-be-parsed data row and its associated data rows; Store the starting address and the ending address of the data block into the index_map_ container; The data row to be parsed and its associated data rows are removed from each data row, and the process returns to sequentially determine the data row to be parsed from each data row until there is no data row to be parsed in each data row.

3. The method according to claim 2, characterized in that The step of generating a data block and a start address and an end address thereof according to the to-be-parsed data row and its associated data row comprises: Generate corresponding data blocks according to the data to be parsed and each data row associated therewith; Generate a starting address of the data block according to the data in the to-be-parsed data row and the address of the next data row of the to-be-parsed data row; The end address of the data block is generated according to the data in the to-be-parsed data row and the address of the last data row in each data row associated with the to-be-parsed data.

4. The method according to claim 3, characterized in that The step of judging whether there is a target data block to be flushed into the area to be flushed in each of the data blocks according to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container, comprises: For each of the data blocks, obtain the starting address and the ending address of the data block from the index_map_container, and construct a data address range of the data block according to the starting address and the ending address of the data block; Determine whether the starting address of the area to be flashed is within the data address range; If so, determining that the data block is a target data block to be flushed into the area to be flushed; If not, it is determined that the data block is not a target data block to be flushed into the area to be flushed.

5. The method according to claim 3, characterized in that: The step of determining the data to be written from the target data block according to the starting address and length of the area to be written, and storing the data to be written in the area to be written comprises: Generate a file instruction for the area to be flashed according to the starting address of the area to be flashed; Determining a storage location of the target data block according to a starting address of the target data block and an offset thereof; Move the file instruction of the area to be flushed to the storage location of the target data block, and extract data corresponding to the length of the area to be flushed from the data corresponding to the starting address of the area to be flushed in the target data block; Generate data to be written according to the extracted data, and write the data to be written to the area to be written.

6. A file flashing system for a vehicle terminal, characterized in that: The system comprises: A first acquisition unit, configured to acquire a target file, wherein the target file includes a plurality of data rows arranged in sequence; A storage unit, used for generating each data block and its starting address and ending address according to each data row, and storing the starting address and ending address of each data block into the index_map_container; A second acquisition unit is used to acquire, for each area to be flashed in the ECU, a starting address and a length corresponding to the area to be flashed; A first judgment unit is used to judge whether there is a target data block to be flushed into the area to be flushed in each of the data blocks according to the starting address of the area to be flushed, the starting address and the ending address of each data block stored in the index_map_container; The flashing unit is used to determine the data to be flashed from the target data block according to the starting address and length of the area to be flashed if the target data block exists, and store the data to be flashed in the area to be flashed.

7. The system according to claim 6, characterized in that The storage unit comprises: A to-be-parsed data row determining unit, used to sequentially determine the to-be-parsed data row from each data row; A parsing unit, configured to parse the data row to be parsed to determine whether the instruction type of the data row to be parsed is a first instruction type; a second judgment unit, configured to judge whether the instruction type of the data row to be parsed is a second instruction type if the instruction type to be parsed is not the first instruction type; an extracting unit, configured to extract the data row to be parsed and its associated data rows from each of the data rows if the instruction type of the data row to be parsed is the second instruction type; A generating unit, configured to generate a data block and a starting address and an ending address thereof according to the to-be-parsed data row and its associated data rows; A storage subunit, used for storing the start address and the end address of the data block into the index_map_container; The removing unit is used to remove the data row to be parsed and its associated data rows from each data row, and return to execute the data row to be parsed determining unit until there is no data row to be parsed in each data row.

8. The system according to claim 7, characterized in that The generating unit comprises: A first generating subunit, configured to generate corresponding data blocks according to the data to be parsed and each data row associated therewith; A second generating subunit, configured to generate a starting address of the data block according to the data in the to-be-parsed data row and an address of a next data row of the to-be-parsed data row; The third generating subunit is used to generate the end address of the data block according to the data in the data row to be parsed and the address of the last data row in each data row associated with the data to be parsed.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program, and the program is used to implement a file flashing method for a vehicle-mounted terminal as described in any one of claims 1-5.

10. A storage medium, characterized in that: The storage medium stores computer executable instructions, and the computer executable instructions are used to execute a file flashing method for a vehicle-mounted terminal as described in any one of claims 1-5.