Method and device for writing ecu data
Patent Information
- Application Number
- CN202210781096.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-04
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2042-07-04
AI Technical Summary
[0004]本申请的主要目的在于提供一种ECU数据的刷写方法、装置、计算机可读存储介质、处理器与电子设备,以解决现有技术中ECU数据的刷写方式需要消耗大量时间的问题
[0014] Applying the technical solution of this application, multiple memory blocks are created in the linker file; multiple functions from multiple object files are stored in multiple memory blocks, where the object files are files obtained after compiling source files; after storing the multiple functions, the characteristic values corresponding to the memory blocks are calculated, where the characteristic values are used to uniquely identify the memory blocks; if the characteristic values corresponding to the memory blocks are different from the characteristic values corresponding to the Flash blocks of the ECU, the Flash blocks are controlled to perform a flashing operation until the characteristic values of the Flash blocks after flashing are the same as the characteristic values corresponding to the memory blocks, where the flashing operation is used to update the multiple functions stored in the Flash blocks. In this solution, multiple memory blocks are created in the linker file, and the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU. Multiple functions from multiple object files are stored in multiple memory blocks. Multiple functions are stored in multiple memory blocks. After all functions are stored in multiple memory blocks, the feature values of each memory block are calculated. It is then confirmed whether the feature values of the multiple memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the multiple memory blocks are not the same as the feature values of their corresponding Flash blocks, it indicates that the function stored in the Flash block has changed. In this case, the original storage content of the Flash block with the changed function only needs to be deleted, and then the flashing operation is performed until the feature values of the flashed Flash block are the same as the feature values of the corresponding memory blocks. This solves the problem that the existing technology requires updating all Flash blocks for function updates when flashing ECU data, which consumes a lot of time.
Smart Images

Figure CN115129352B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of engines, and more specifically, to a method, apparatus, computer-readable storage medium, processor, and electronic device for flashing ECU data. Background Technology
[0002] The ECU flashing file is an executable program generated by compiling and linking multiple .c files. This executable program needs to be flashed into the ECU's Flash memory. There are generally three existing ECU flashing methods: 1) Full upgrade: This method downloads and updates the entire new software version to the old software's storage location. The disadvantage is that it is time-consuming due to the need for downloading, erasing, and programming. 2) Differential upgrade: Traditional differential upgrade methods use differential algorithms to obtain differential upgrade packages for the old and new software versions, requiring only the download of the upgrade package. The disadvantage is that the ECU needs a large amount of RAM space to build the new software version using the upgrade package. 3) Compressed transmission: The content to be transmitted is compressed, then decompressed after transmission to the ECU. The disadvantage is that it requires a large amount of RAM space. These methods consume a significant amount of time and RAM, making them unsuitable for situations where microcontroller RAM resources and computing performance are limited.
[0003] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0004] The main objective of this application is to provide a method, apparatus, computer-readable storage medium, processor, and electronic device for flashing ECU data, in order to solve the problem that flashing ECU data in the prior art requires a lot of time.
[0005] To achieve the above objectives, according to one aspect of this application, a method for flashing ECU data is provided, comprising: creating multiple memory blocks in a linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU; storing multiple functions from multiple object files into the multiple memory blocks, wherein the object files are files obtained by compiling source files; after storing the multiple functions, calculating the feature values corresponding to the memory blocks, wherein the feature values are used to uniquely identify the memory blocks; if the feature values corresponding to the memory blocks are different from the feature values corresponding to the Flash blocks, controlling the Flash blocks to perform a flashing operation until the feature values of the flashed Flash blocks are the same as the feature values corresponding to the memory blocks, wherein the flashing operation is used to update the multiple functions stored in the Flash blocks.
[0006] Optionally, storing multiple functions from multiple object files into multiple memory blocks includes: storing multiple functions from the same object file into memory blocks sequentially.
[0007] Optionally, multiple functions from multiple object files can be stored in multiple memory blocks, including: if the memory occupied by a function is greater than the remaining memory of a memory block, storing the function in a memory block where the available memory is greater than or equal to the memory occupied by the function.
[0008] Optionally, multiple functions from multiple object files are stored in multiple memory blocks, including: if the memory occupied by a function is greater than the memory of a single memory block, the function is stored in a combined memory block, wherein the combined memory block is composed of multiple contiguous memory blocks, and the memory of the combined memory block is greater than the memory occupied by the function. Optionally, after storing multiple functions, feature values corresponding to the memory blocks are calculated, including: retrieving multiple functions from the memory blocks; controlling the verification program to calculate the multiple functions to obtain the feature values corresponding to the memory blocks.
[0009] Optionally, after storing multiple functions and calculating the feature values corresponding to the memory blocks, the method includes storing the feature values in the first four bytes of the memory blocks.
[0010] To achieve the above objectives, according to one aspect of this application, an ECU data flashing apparatus is provided, comprising: a creation unit for creating multiple memory blocks in a linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU; a first storage unit for storing multiple functions from multiple object files into the multiple memory blocks, wherein the object files are files obtained by compiling source files; a calculation unit for calculating feature values corresponding to the memory blocks after storing the multiple functions, wherein the feature values are used to uniquely identify the memory blocks; and a control unit for controlling the Flash blocks to perform a flashing operation when the feature values corresponding to the memory blocks are different from the feature values corresponding to the Flash blocks, until the feature values of the flashed Flash blocks are the same as the feature values corresponding to the memory blocks, wherein the flashing operation is used to update the multiple functions stored in the Flash blocks.
[0011] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein the program executes any of the above-described methods for flashing ECU data.
[0012] To achieve the above objectives, according to another aspect of this application, a processor is provided, which runs a program that executes any of the above-described methods for flashing ECU data.
[0013] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, a display device, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a method for performing any of the above-mentioned ECU data flashing.
[0014] Applying the technical solution of this application, multiple memory blocks are created in the linker file; multiple functions from multiple object files are stored in multiple memory blocks, where the object files are files obtained after compiling source files; after storing the multiple functions, the characteristic values corresponding to the memory blocks are calculated, where the characteristic values are used to uniquely identify the memory blocks; if the characteristic values corresponding to the memory blocks are different from the characteristic values corresponding to the Flash blocks of the ECU, the Flash blocks are controlled to perform a flashing operation until the characteristic values of the Flash blocks after flashing are the same as the characteristic values corresponding to the memory blocks, where the flashing operation is used to update the multiple functions stored in the Flash blocks. In this solution, multiple memory blocks are created in the linker file, and the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU. Multiple functions from multiple object files are stored in multiple memory blocks. Multiple functions are stored in multiple memory blocks. After all functions are stored in multiple memory blocks, the feature values of each memory block are calculated. It is then confirmed whether the feature values of the multiple memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the multiple memory blocks are not the same as the feature values of their corresponding Flash blocks, it indicates that the function stored in the Flash block has changed. In this case, the original storage content of the Flash block with the changed function only needs to be deleted, and then the flashing operation is performed until the feature values of the flashed Flash block are the same as the feature values of the corresponding memory blocks. This solves the problem that the existing technology requires updating all Flash blocks for function updates when flashing ECU data, which consumes a lot of time. Attached Figure Description
[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0016] Figure 1 A flowchart illustrating a method for flashing ECU data according to an embodiment of this application is shown;
[0017] Figure 2 A schematic diagram of an ECU data flashing device according to an embodiment of this application is shown. Detailed Implementation
[0018] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0019] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0021] It should be understood that when an element (such as a layer, film, region, or substrate) is described as being "on" another element, the element may be directly on the other element, or there may be an intermediate element present. Furthermore, in the specification and claims, when an element is described as being "connected" to another element, the element may be "directly connected" to the other element, or "connected" to the other element via a third element.
[0022] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0023] ECU (Electronic Control Unit): It consists of a microcontroller, memory, input / output interface, digital-to-analog converter, and large-scale integrated circuits such as shaping and driving. In the ECU, the CPU is the core part, which has the functions of calculation and control.
[0024] As mentioned in the background section, existing methods for flashing ECU data consume a significant amount of time. To address this issue, in a typical embodiment of this application, a method, apparatus, computer-readable storage medium, processor, and electronic device for flashing ECU data are provided.
[0025] According to an embodiment of this application, a method for flashing ECU data is provided.
[0026] Figure 1 This is a flowchart illustrating a method for flashing ECU data according to an embodiment of this application. Figure 1 As shown, the method includes the following steps:
[0027] Step S101: Create multiple memory blocks in the linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU; Step S102: Store multiple functions from multiple object files into multiple memory blocks, wherein the object files are files obtained after compiling the source files;
[0028] Step S103: After storing multiple functions, calculate the feature value corresponding to the memory block, where the feature value is used to uniquely identify the memory block; if the feature value corresponding to the memory block is different from the feature value corresponding to the Flash block, control the Flash block to perform a write operation until the feature value of the Flash block after writing is the same as the feature value corresponding to the memory block, where the write operation is used to update the multiple functions stored in the Flash block.
[0029] This method creates multiple memory blocks in the linker file, with the number of memory blocks being greater than or equal to the number of Flash blocks in the ECU. Multiple functions from multiple target files are stored in these memory blocks. After all functions are stored, the feature values of each memory block are calculated. It is then verified whether the feature values of the memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the memory blocks are different from those of their corresponding Flash blocks, it indicates that the function stored in the Flash block has changed. In this case, the original content of the Flash block with the changed function is deleted, and the flashing operation is performed again. This process continues until the feature values of the flashed Flash block are the same as the feature values of the corresponding memory blocks. This method solves the problem of the time-consuming process of updating all Flash blocks during ECU data flashing in existing technologies.
[0030] Specifically, the principle of ECU data flashing is as follows: an external data flashing tool sends data information to the ECU through the ECU communication network, realizing the management and updating of ECU data to keep the engine in optimal working condition. Multiple memory blocks, the same number as the ECU's Flash blocks, are created in the linker file, as shown in Table 1. Table 1 is a block table for Flash memory within a microcontroller. Flash is a contiguous address space. The application area is divided into blocks according to hardware characteristics. Flash blocks can be individually erased, written, and deleted, reducing the workload of development and verification. It also eliminates the need for compression algorithms, saving RAM space.
[0031] The linker file tells the compiler during the compilation phase which memory block to store functions in. Flash memory is the internal program storage space of the microcontroller, featuring electronic erasable programmability and fast data retrieval. Storing multiple functions from multiple object files into multiple memory blocks eliminates the need for manual addition of functions, reducing errors caused by manual intervention.
[0032] After multiple functions are stored in multiple memory blocks, the characteristic values of each memory block are calculated. These characteristic values identify the memory blocks. The host computer sequentially checks whether the characteristic values of the multiple memory blocks are the same as the characteristic values of their corresponding Flash blocks. If the characteristic values of the multiple memory blocks are different from the characteristic values of their corresponding Flash blocks, the Flash block is controlled to perform a write operation until the characteristic values of the written Flash block are the same as the characteristic values of the corresponding memory blocks. This method is suitable for situations where the differences are not significant, such as during software debugging, and can greatly shorten the write time and improve work efficiency.
[0033] Table 1. Block table of Flash memory inside a microcontroller
[0034]
[0035] In one specific embodiment of this application, storing multiple functions from multiple object files into multiple memory blocks includes: sequentially storing multiple functions from the same object file into memory blocks. This method uses a linker file to sequentially store multiple functions into multiple memory blocks, saving time spent downloading and updating function packages and reducing overall processing time.
[0036] Specifically, the linker determines which memory block a function should be stored in, and functions from the same object file are stored sequentially into memory blocks.
[0037] In one specific embodiment of this application, multiple functions from multiple object files are stored in multiple memory blocks. This includes: if the memory occupied by a function is greater than the remaining memory in a memory block, storing the function in a memory block where available memory is greater than or equal to the memory occupied by the function. In this method, when the remaining memory in a memory block is insufficient to store a function, the function is stored in the next memory block that can store the function, ensuring that all functions are placed in memory blocks and standardizing the rationality of program design.
[0038] In practical applications, if a memory block already contains two functions, and the remaining memory in the memory block is less than the memory occupied by the third function, then the third function is placed into the next free memory block with more memory than the third function.
[0039] In one specific embodiment of this application, storing multiple functions from multiple object files into multiple memory blocks includes: when the memory occupied by a function is greater than the memory of a single memory block, storing the function into a combined memory block, wherein the combined memory block is composed of multiple contiguous memory blocks, and the memory of the combined memory block is greater than the memory occupied by the function. This method, in cases where the sum of the memory of multiple memory blocks is insufficient to store a single function, combines the multiple memory blocks into a single memory block with a memory size greater than the function's memory usage, ensuring that all functions are placed into memory blocks. This approach considers various scenarios for storing functions in memory blocks, making it more rational.
[0040] In practical applications, if the memory occupied by a function is greater than the sum of the memory of three memory blocks but less than the sum of the memory of four memory blocks, the four memory blocks are combined into one memory block, and the function is stored in the memory block formed by combining the four memory blocks.
[0041] In one specific embodiment of this application, after storing multiple functions, the feature values corresponding to memory blocks are calculated, including: obtaining multiple functions in the memory block; controlling a verification program to calculate the multiple functions to obtain the feature values corresponding to the memory block. In this method, each function has an identifier code. The verification program can calculate the feature values corresponding to the memory block. By using the feature values corresponding to the memory block, the memory block is uniquely identified, thereby achieving the purpose of identifying and distinguishing multiple memory blocks.
[0042] Specifically, the functions in the memory blocks are used to calculate feature values through a verification program. These feature values serve to identify the memory blocks and can be calculated using various algorithms, such as cyclic redundancy check, parity check, and Hamming check.
[0043] In one specific embodiment of this application, after storing multiple functions and calculating the feature values corresponding to memory blocks, the method includes: storing the feature values in the first four bytes of the memory block. In this method, storing the feature values in the first four bytes of the memory block facilitates comparison with the feature values of the corresponding Flash blocks, standardizes the storage location of the feature values, and saves workload for code writers.
[0044] Specifically, the storage location of the characteristic values of the memory blocks in the memory blocks is determined, which facilitates comparison with the characteristic values of the corresponding Flash blocks. When performing ECU data writing operations, only the Flash blocks whose characteristic values have changed need to be updated, reducing the Flash block erasure time.
[0045] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0046] This application also provides an ECU data flashing device. It should be noted that the ECU data flashing device of this application can be used to execute the ECU data flashing method provided in this application. The following describes the ECU data flashing device provided in this application.
[0047] Figure 2 This is a schematic diagram of an ECU data flashing device according to an embodiment of this application. Figure 2As shown, the device includes: a creation unit 201, used to create multiple memory blocks in a linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU; a first storage unit 202, used to store multiple functions from multiple object files into multiple memory blocks, wherein the object files are files obtained after compiling source files; a calculation unit 203, used to calculate the feature values corresponding to the memory blocks after storing the multiple functions, wherein the feature values are used to uniquely identify the memory blocks; and a control unit 204, used to control the Flash blocks to perform a write operation when the feature values corresponding to the memory blocks are different from the feature values corresponding to the Flash blocks, until the feature values of the Flash blocks after writing are the same as the feature values corresponding to the memory blocks, wherein the write operation is used to update the multiple functions stored in the Flash blocks. In this device, multiple memory blocks are created in the linker file, with the number of memory blocks being greater than or equal to the number of Flash blocks in the ECU. Multiple functions from multiple target files are stored in these memory blocks. After all functions are stored in the memory blocks, the feature values of each memory block are calculated. It is then confirmed whether the feature values of the memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the memory blocks are different from those of their corresponding Flash blocks, it indicates that the function stored in the Flash block has changed. In this case, the original content of the Flash block with the changed function is deleted, and the flashing operation is performed again. This process continues until the feature values of the flashed Flash block are the same as the feature values of the corresponding memory blocks. This solves the problem in existing technologies where flashing ECU data requires updating all Flash blocks, which consumes a lot of time. This device resolves the issue of the time-consuming nature of existing ECU data flashing methods.
[0048] Specifically, the principle of ECU data flashing is as follows: an external data flashing tool sends data information to the ECU through the ECU communication network, realizing the management and updating of ECU data to keep the engine in optimal working condition. Multiple memory blocks, the same number as the ECU's Flash blocks, are created in the linker file, as shown in Table 1. Table 1 is a block table for Flash memory within a microcontroller. Flash is a contiguous address space. The application area is divided into blocks according to hardware characteristics. Flash blocks can be individually erased, written, and deleted, reducing the workload of development and verification. It also eliminates the need for compression algorithms, saving RAM space.
[0049] The linker file tells the compiler during the compilation phase which memory block to store functions in. Flash memory is the internal program storage space of the microcontroller, featuring electronic erasable programmability and fast data retrieval. Storing multiple functions from multiple object files into multiple memory blocks eliminates the need for manual addition of functions, reducing errors caused by manual intervention.
[0050] After multiple functions are stored in multiple memory blocks, feature values are calculated for each memory block. These feature values identify the memory blocks. The host computer sequentially checks whether the feature values of the multiple memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the multiple memory blocks are different from those of their corresponding Flash blocks, the Flash block is controlled to perform a write operation until the feature values of the written Flash block are the same as those of the corresponding memory blocks. This method is suitable for situations where the differences in modification are not significant, such as during software debugging, and can greatly shorten the write time and improve work efficiency. In a specific embodiment of this application, the first storage unit 202 includes a first storage subunit for sequentially storing multiple functions from the same object file into memory blocks. In this device, multiple functions are sequentially stored into multiple memory blocks through linking files, saving the time of downloading and updating function packages and reducing the overall time consumption.
[0051] Specifically, the linker determines which memory block a function should be stored in, and functions from the same object file are stored sequentially into memory blocks.
[0052] In one specific embodiment of this application, the first storage unit 202 includes a second storage subunit, used to store the function in a memory block where the available memory is greater than or equal to the function's occupied memory when the function's occupied memory is greater than the remaining memory in the memory block. In this device, when the remaining memory in a memory block is insufficient to store the function, the function is stored in the next memory block that can store the function, ensuring that all functions are placed in memory blocks and standardizing the rationality of program design.
[0053] In practical applications, if a memory block already contains two functions, and the remaining memory in the memory block is less than the memory occupied by the third function, then the third function is placed into the next free memory block with more memory than the third function.
[0054] In one specific embodiment of this application, the first storage unit 202 includes a third storage subunit, used to store the function in a combined memory block when the memory occupied by the function is greater than the memory of a single memory block. The combined memory block is composed of multiple consecutive memory blocks, and the memory of the combined memory block is greater than the memory occupied by the function. In this device, when the sum of the memory of multiple memory blocks is insufficient to store a single function, the multiple memory blocks are combined into a single memory block with a memory larger than the memory occupied by the function. This ensures that all functions are placed in the memory blocks, considering various scenarios of function storage in memory blocks, making the method more rational.
[0055] In practical applications, if the memory occupied by a function is greater than the sum of the memory of three memory blocks but less than the sum of the memory of four memory blocks, the four memory blocks are combined into one memory block, and the function is stored in the memory block formed by combining the four memory blocks.
[0056] In one specific embodiment of this application, the calculation unit 203 includes: an acquisition subunit for acquiring multiple functions in a memory block; and a control subunit for controlling a verification program to calculate the multiple functions to obtain the feature values corresponding to the memory block. In this device, each function has an identifier code. The verification program can calculate the feature values corresponding to the memory block, thereby uniquely identifying the memory block and achieving the purpose of identifying and distinguishing multiple memory blocks.
[0057] Specifically, the functions in the memory blocks are used to calculate feature values through a verification program. These feature values serve to identify the memory blocks and can be calculated using various algorithms, such as cyclic redundancy check, parity check, and Hamming check.
[0058] In one specific embodiment of this application, the device includes: a second storage unit, used to store the feature values corresponding to the memory blocks into the first four bytes of the memory blocks after calculating the feature values corresponding to the memory blocks after storing multiple functions.
[0059] The aforementioned ECU data flashing device includes a processor and a memory. The aforementioned creation unit 201 and the like are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.
[0060] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can address the problem of excessive time consumption in existing ECU data flashing methods.
[0061] The memory may include non-permanent memory in computer-readable media, such as 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.
[0062] This invention provides a computer-readable storage medium including a stored program, wherein when the program is executed, it controls the device containing the computer-readable storage medium to perform the aforementioned method for flashing ECU data.
[0063] This invention provides a processor for running a program, wherein the program executes the aforementioned method for flashing ECU data.
[0064] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps:
[0065] Step S101: Create multiple memory blocks in the linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU;
[0066] Step S102: Store multiple functions from multiple object files into multiple memory blocks, where the object files are the files obtained after compiling the source files;
[0067] Step S103: After storing multiple functions, calculate the feature value corresponding to the memory block, where the feature value is used to uniquely identify the memory block; if the feature value corresponding to the memory block is different from the feature value corresponding to the Flash block, control the Flash block to perform a write operation until the feature value of the Flash block after writing is the same as the feature value corresponding to the memory block, where the write operation is used to update the multiple functions stored in the Flash block.
[0068] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0069] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:
[0070] Step S101: Create multiple memory blocks in the linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU;
[0071] Step S102: Store multiple functions from multiple object files into multiple memory blocks, where the object files are the files obtained after compiling the source files;
[0072] Step S103: After storing multiple functions, calculate the feature value corresponding to the memory block, where the feature value is used to uniquely identify the memory block; if the feature value corresponding to the memory block is different from the feature value corresponding to the Flash block, control the Flash block to perform a write operation until the feature value of the Flash block after writing is the same as the feature value corresponding to the memory block, where the write operation is used to update the multiple functions stored in the Flash block.
[0073] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0074] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0075] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0076] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0077] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0078] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0079] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0080] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0081] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0082] 1) In the ECU data flashing determination method of this application, multiple memory blocks are created in the linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks of the ECU; multiple functions from multiple object files are stored in multiple memory blocks, wherein the object files are files obtained after compiling source files; after storing multiple functions, the feature values corresponding to the memory blocks are calculated, wherein the feature values are used to uniquely identify the memory blocks; if the feature values corresponding to the memory blocks are different from the feature values corresponding to the Flash blocks, the Flash blocks are controlled to perform a flashing operation until the feature values of the Flash blocks after flashing are the same as the feature values corresponding to the memory blocks, wherein the flashing operation is used to update the multiple functions stored in the Flash blocks. This method creates multiple memory blocks in the linker file, with the number of memory blocks being greater than or equal to the number of Flash blocks in the ECU. Multiple functions from multiple target files are stored in these memory blocks. After all functions are stored, the feature values of each memory block are calculated. It is then verified whether the feature values of the memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the memory blocks are different from those of their corresponding Flash blocks, it indicates that the function stored in the Flash block has changed. In this case, the original content of the Flash block with the changed function is deleted, and the flashing operation is performed again. This process continues until the feature values of the flashed Flash block are the same as the feature values of the corresponding memory blocks. This method solves the problem of the time-consuming process of updating all Flash blocks during ECU data flashing in existing technologies.
[0083] 2) In the ECU data flashing determination device of this application, a creation unit is used to create multiple memory blocks in a linker file; a first storage unit is used to store multiple functions from multiple object files into multiple memory blocks, wherein the object files are files obtained after compiling source files; a calculation unit is used to calculate the feature values corresponding to the memory blocks after storing multiple functions, wherein the feature values are used to uniquely identify the memory blocks; and a control unit is used to control the Flash block to perform a flashing operation when the feature values corresponding to the memory blocks are different from the feature values corresponding to the ECU's Flash block, until the feature values of the flashed Flash block are the same as the feature values corresponding to the memory blocks, wherein the flashing operation is used to update the multiple functions stored in the Flash block. In this device, multiple memory blocks are created in the linker file, with the number of memory blocks being greater than or equal to the number of Flash blocks in the ECU. Multiple functions from multiple target files are stored in these memory blocks. After all functions are stored in the memory blocks, the feature values of each memory block are calculated. It is then confirmed whether the feature values of the memory blocks are the same as the feature values of their corresponding Flash blocks. If the feature values of the memory blocks are different from those of their corresponding Flash blocks, it indicates that the function stored in the Flash block has changed. In this case, the original content of the Flash block with the changed function is deleted, and the flashing operation is performed again. This process continues until the feature values of the flashed Flash block are the same as the feature values of the corresponding memory blocks. This solves the problem in existing technologies where flashing ECU data requires updating all Flash blocks, which consumes a lot of time. This device resolves the issue of the time-consuming nature of existing ECU data flashing methods.
[0084] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for flashing ECU data, characterized in that, include: Multiple memory blocks are created in the linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU; Multiple functions from multiple object files are stored in multiple memory blocks, wherein the object files are files obtained by compiling source files; After storing multiple functions, the feature value corresponding to the memory block is calculated, wherein the feature value is used to uniquely identify the memory block; If the feature value corresponding to the memory block is different from the feature value corresponding to the Flash block, the Flash block is controlled to perform a write operation until the feature value of the Flash block after writing is the same as the feature value corresponding to the memory block. The write operation is used to update the multiple functions stored in the Flash block. Storing multiple functions from multiple object files into multiple memory blocks includes: If the memory occupied by the function is greater than the remaining memory of the memory block, the function is stored in the memory block where the available memory is greater than or equal to the memory occupied by the function; Storing multiple functions from multiple object files into multiple memory blocks includes: If the memory occupied by the function is greater than the memory of one memory block, the function is stored in a combined memory block, wherein the combined memory block is composed of multiple consecutive memory blocks, and the memory of the combined memory block is greater than the memory occupied by the function.
2. The method according to claim 1, characterized in that, Storing multiple functions from multiple object files into multiple memory blocks includes: Multiple functions from the same object file are sequentially stored in the memory blocks.
3. The method according to claim 1, characterized in that, After storing multiple functions, the characteristic values corresponding to the memory blocks are calculated, including: Obtain multiple functions from the memory block; The control verification program calculates multiple functions to obtain the feature values corresponding to the memory blocks.
4. The method according to claim 1, characterized in that, After storing multiple functions and calculating the feature values corresponding to the memory blocks, the method includes: The feature value is stored in the first four bytes of the memory block.
5. An ECU data flashing / writing device, characterized in that, include: A creation unit is used to create multiple memory blocks in a linker file, wherein the number of memory blocks is greater than or equal to the number of Flash blocks in the ECU; The first storage unit is used to store multiple functions from multiple object files into multiple memory blocks, wherein the object files are files obtained after compiling source files; A computing unit is configured to calculate a feature value corresponding to the memory block after storing multiple functions, wherein the feature value is used to uniquely identify the memory block; A control unit is configured to control the Flash block to perform a write operation when the feature value corresponding to the memory block is different from the feature value corresponding to the Flash block, until the feature value of the Flash block after writing is the same as the feature value corresponding to the memory block, wherein the write operation is used to update multiple functions stored in the Flash block; The first storage unit includes a second storage subunit, used to store the function in a memory block where the available memory is greater than or equal to the function's occupied memory, when the function's occupied memory is greater than the remaining memory of the memory block.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the ECU data flashing method according to any one of claims 1 to 4.
7. A processor, characterized in that, The processor is used to run a program, wherein the program executes the ECU data flashing method according to any one of claims 1 to 4 when it runs.
8. An electronic device, characterized in that, include: One or more processors, a memory, a display device, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including a method for performing the flashing of ECU data according to any one of claims 1 to 4.
Citation Information
Patent Citations
Multi-project independent compiling method and system, terminal and medium
CN112306540A
Configuration data downloading method, device and equipment and readable storage medium
CN112506547A
Vehicle-mounted electronic control unit data flashing method and system based on UDS
CN113093694A