Brushing method and device of automobile electronic control unit, electronic equipment and medium
By acquiring the ECU's software version information and using a nested loop algorithm, the problem of ECU flashing methods being unable to distinguish between chip types and versions was solved, enabling compatible flashing of different chips under the same ECU firmware, thus improving flashing efficiency and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SAIC GM WULING AUTOMOBILE CO LTD
- Filing Date
- 2025-12-17
- Publication Date
- 2026-05-08
AI Technical Summary
Existing ECU flashing methods cannot distinguish between chip types and versions, leading to flashing failures for different chips under the same ECU firmware. This may result in ECU malfunction or damage, with high repair costs and long repair times.
By obtaining the vehicle model and target ECU software version information, the flashing package is parsed to obtain multiple sets of flashing instructions. Nested loops and conditional branching algorithms are used to determine the chip's compatibility with the instructions, and flashing instructions are sent step by step until a match is achieved, thus realizing compatible flashing of different chips under the same ECU firmware.
It enables compatible flashing of different chips under the same ECU firmware, simplifies the flashing process, improves flashing efficiency, and reduces maintenance costs and time.
Smart Images

Figure CN121996267A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive electronics technology, and in particular to a method, apparatus, electronic device, and storage medium for flashing automotive electronic control units. Background Technology
[0002] With the continuous development of intelligent and electric vehicles and the increasing personalized demands of users, the functions of automotive ECUs (Electronic Control Units) are becoming more and more powerful. At the same time, there are more and more methods for reprogramming ECUs, and the variety of automotive chips available on the market is also increasing. Each manufacturer's automotive chip has different manufacturing processes and firmware upgrade requirements. Therefore, ECU reprogramming has become a core requirement for vehicle manufacturers and an important part of after-sales maintenance.
[0003] Current ECU flashing methods cannot distinguish between chip types and versions within the ECU firmware. They can only flash a single chip within the same ECU firmware, failing to flash different chips within the same ECU firmware. When an ECU contains chips of different types and versions, the current flashing method carries the risk of flashing the wrong chip software, leading to ECU malfunction or damage. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and storage medium for flashing automotive electronic control units, which helps to flash different chips under the same ECU firmware, and multiple chips are compatible with a single flashing process.
[0005] Firstly, this application provides a method for flashing an automotive electronic control unit, comprising: Obtain the corresponding flashing package based on the vehicle model and the software version information of the target ECU. The target ECU includes multiple chips, and the multiple chips include the target chip. The flash package is parsed to obtain multiple sets of flash instructions, including the first flash instruction. Send the first write command to the target chip; Receive the response information from the target chip; Based on the response information, determine whether the flash data of the first flash instruction matches the target chip. If they do not match, send other flash instructions from multiple sets of flash instructions to the target chip in sequence until the target chip matches the flash data of one of the sets of flash instructions.
[0006] In one possible implementation, the write data of the first write instruction includes the erase address and the erase length, and the response information includes the target chip's response information to the erase address and the erase length. Based on the response information, determine whether the flash data of the first flash instruction matches the target chip, including: If the response information indicates that the target chip has responded to the erase address and erase length, then the write data of the first write instruction matches the target chip. If the response information indicates that the target chip's response to the erase address and erase length is not successful, then the write data of the first write instruction does not match the target chip.
[0007] In one possible implementation, before sending the first write command to the target chip, the method further includes: Send a flashing mode command to the target ECU so that the target ECU responds to the flashing mode command and enters the flashing session mode; In response to the target ECU having entered the flashing session mode, a secure access request is sent to the target ECU; After the secure access request is granted, the step of sending the first write command to the target chip is executed.
[0008] One possible implementation of the method also includes: If the write data of the first write instruction matches the target chip, then continue to send write instructions to other chips besides the target chip.
[0009] In one possible implementation, the method further includes: verifying the flash package after the flashing of multiple chips is completed.
[0010] In one possible implementation, after the flashing package passes verification, the target ECU is reset so that the target ECU exits the flashing session mode.
[0011] In one possible implementation, the write data of the first write instruction also includes write data.
[0012] Secondly, this application provides a device for flashing and rewriting automotive electronic control units, comprising: The acquisition module is used to obtain the corresponding flashing package based on the vehicle model and the software version information of the target ECU. The target ECU includes multiple chips, and the multiple chips include the target chip. The parsing module is used to parse the flash package to obtain multiple sets of flash instructions, including the first flash instruction. The sending module is used to send the first write command to the target chip; The receiving module is used to receive the response information from the target chip; The judgment module is used to determine whether the write data of the first write instruction matches the target chip based on the reply information. If they do not match, other write instructions from multiple sets of write instructions are sent to the target chip in sequence until the target chip matches the write data of one of the sets of write instructions.
[0013] Thirdly, this application provides an electronic device, including: a processor and a memory, wherein the memory is used to store a computer program; and the processor is used to run the computer program to implement the flashing method for the automotive electronic control unit as described in the first aspect.
[0014] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to implement the flashing method for the automotive electronic control unit as described in the first aspect.
[0015] The beneficial effects of this application are as follows: This application provides a method, apparatus, electronic device, and storage medium for flashing an automotive electronic control unit. The flashing device obtains a flashing package corresponding to the vehicle model and the software version information of the target ECU. After parsing the flashing package, it obtains multiple sets of flashing instructions and sends one set of flashing instructions (i.e., the chip to be flashed) to the target chip in the ECU. After receiving the first flashing instruction, the target chip verifies whether the first flashing instruction matches its own and sends a reply information to the flashing device. The flashing device determines whether the flashing data of the first flashing instruction matches the target chip based on the received reply information. If they do not match, it sequentially sends other flashing instructions from the multiple sets of flashing instructions to the target chip until the target chip matches the flashing data of one of the sets of flashing instructions. In other words, the flashing device continues to select another set of flashing instructions from multiple sets and send it to the target chip. The target chip then verifies the flashing instructions and sends another reply message to the flashing device. The flashing device determines whether the data matches. If the data does not match, the cycle of sending flashing instructions, receiving reply messages, and determining whether the data matches continues until the target chip matches the flashing data of one of the sets of flashing instructions. At this point, the flashing device stops sending flashing instructions to the target chip.
[0016] This application enables the flashing of different chips under the same ECU firmware by adding nested loops and conditional branching algorithms during the chip flashing process. Multiple chips are compatible with a single flashing process, without the need to add new processes or make additional changes to the chip firmware. Attached Figure Description
[0017] Figure 1 A schematic flowchart illustrating the method for flashing an automotive electronic control unit provided in an embodiment of this application; Figure 2A schematic diagram of the structure of the writing device for the automotive electronic control unit provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0018] In this embodiment of the application, unless otherwise stated, the character " / " indicates that the preceding and following objects are in an OR relationship. For example, A / B can represent A or B. "AND / OR" describes the relationship between the associated objects, indicating that three relationships can exist. For example, A AND / OR B can represent: A existing alone, A and B existing simultaneously, and B existing alone.
[0019] It should be noted that the terms "first" and "second" used in the embodiments of this application are used only for distinguishing descriptive purposes and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated, nor should they be construed as indicating or implying order.
[0020] In the embodiments of this application, "at least one" means one or more, and "more than one" means two or more. Furthermore, "at least one of the following" or similar expressions refer to any combination of these items, which may include any combination of a single item or a plurality of items. For example, at least one of A, B, or C can represent: A, B, C, A and B, A and C, B and C, or A, B, and C. Each of A, B, and C can be an element itself or a set containing one or more elements.
[0021] In this application, terms such as "exemplary," "in some embodiments," and "in another embodiment" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the term "exemplary" is intended to present the concept in a concrete manner.
[0022] In the embodiments of this application, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction, their meanings are consistent. Similarly, in the embodiments of this application, "communication" and "transmission" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction, their meanings are consistent. For example, transmission can include sending and / or receiving, and can be a noun or a verb.
[0023] In the embodiments of this application, the term "equal to" can be used in conjunction with "greater than" to apply to technical solutions employing the condition of "greater than", and can also be used in conjunction with "less than" to apply to technical solutions employing the condition of "less than". It should be noted that when "equal to" is used with "greater than", it cannot be used with "less than"; and when "equal to" is used with "less than", it cannot be used with "greater than".
[0024] The basic principle of ECU flashing is that an external data flashing tool sends data information to the ECU through the ECU communication network to realize the management and updating of ECU data. When the ECU supplier is the same but the chips are different, the different chips will respond differently to the flashing command.
[0025] Currently, most flashing methods include OTA (Over-The-Air Technology), OBD (On-Board Diagnostics) flashing, and external ECU flashing. OTA flashing refers to the remote transmission and updating of device firmware, software, or data via wireless communication networks (such as 4G / 5G, Wi-Fi), without the need for a physical hardware connection. OBD flashing is a non-disassembly method that uses the vehicle's OBD diagnostic port (without removing the ECU) and connects to the vehicle's bus system. External ECU flashing is an offline flashing method that directly connects an external programmer / adapter to the ECU chip or debugging interface (often requiring ECU removal / opening the casing), bypassing bus limitations.
[0026] The above flashing methods cannot distinguish the chip type and version in the ECU firmware. They can only flash a single chip under the same ECU firmware, and cannot flash different chips under the same ECU firmware. When the ECU has different types and versions of chips, the above flashing methods risk flashing the wrong chip software, resulting in ECU malfunction or ECU damage, with relatively high repair costs and time consumption.
[0027] Based on the above problems, this application proposes a method for flashing automotive electronic control units, which helps to flash different chips under the same ECU firmware, and multiple chips are compatible with a single flashing process.
[0028] Figure 1 The flowchart illustrating the method for flashing an automotive electronic control unit provided in this application embodiment specifically includes the following steps: Step S11: Obtain the corresponding flashing package based on the vehicle model and the software version information of the target ECU.
[0029] The target ECU comprises multiple chips, and these multiple chips include the target chip.
[0030] Specifically, the flashing device (such as a diagnostic tool host, host computer, etc.) connects to the vehicle and the target ECU, obtains the vehicle model and the target ECU's software version information, and obtains the flashing package corresponding to the vehicle model and the target ECU's software version information from the OEM's official server or the OEM's OTA platform.
[0031] This application obtains the vehicle model and target ECU software version information before flashing to ensure that the flashing package is fully compatible with the hardware and avoids incorrect flashing.
[0032] It should be noted that the target ECU can be any type of electronic control unit in the vehicle, such as the engine control unit, transmission control unit, or air conditioning control unit. Multiple chips include MCU (Microcontroller Unit) chips, security chips, communication chips, etc., and the target chip is one of these multiple chips.
[0033] Step S12: Parse the flash package to obtain multiple sets of flash commands.
[0034] Among them, the multiple sets of flashing instructions include a first flashing instruction, which is any one of the multiple sets of flashing instructions.
[0035] Specifically, taking the flashing device as the host computer as an example, after the host computer loads the flashing package, it parses the flashing package to obtain multiple sets of flashing instructions, each set of flashing instructions corresponding to a type of chip.
[0036] Optionally, the write data for each set of write commands includes the erase address, erase length, and write content.
[0037] Step S13: Send the first write command to the target chip.
[0038] Specifically, the host computer sends the first write command to the target chip via wireless (such as a wireless network) or wired (such as a CAN bus).
[0039] Step S14: Receive the response information from the target chip.
[0040] Specifically, when the target chip receives the first write command sent by the host computer, it needs to verify the write data of the first write command and then send a reply information to the host computer. The reply information is used to indicate whether the write data of the write command matches its own chip.
[0041] Step S15: Determine whether the write data of the first write instruction matches the target chip based on the reply information. If they do not match, send other write instructions from multiple sets of write instructions to the target chip in sequence until the target chip matches the write data of one set of write instructions.
[0042] Specifically, the host computer determines whether the flash data of the first flash command matches the target chip based on the received reply information. If they do not match, the host computer sequentially sends other flash commands from multiple sets of flash commands to the target chip until the target chip matches the flash data of one of the sets of flash commands. In other words, when the first flash command does not match the target chip, the host computer continues to select another set of flash commands from multiple sets of flash commands and sends it to the target chip. The target chip then verifies this set of flash commands and sends another reply information to the host computer. The host computer then determines whether they match. If they do not match, the cycle of sending flash commands, receiving reply information, and determining whether they match continues until the target chip matches the flash data of one of the sets of flash commands. At this point, the host computer stops sending flash commands to the target chip.
[0043] This application incorporates nested loops and conditional branching algorithms into the chip flashing process. It uses the chip's response information to determine whether the chip matches the received flashing command. If they do not match, it continues to send other flashing commands in the flashing packet until the chip receives a matching flashing command.
[0044] The method described in this application eliminates the need to distinguish between chip types and versions within the ECU firmware. Therefore, when an ECU contains multiple chips, it is not necessary to disassemble the ECU to determine the chip types and versions. This allows for the flashing of different chips under the same ECU firmware, and multiple chips are compatible with a single flashing process, requiring no additional procedures or modifications to the chip firmware. Furthermore, the host computer only needs to determine whether the response information matches, without needing in-depth analysis of the reasons for mismatches, simplifying the host computer logic and improving flashing efficiency.
[0045] The chip flashing process includes erasing and writing. Erasing refers to clearing the original firmware or data in the chip to make room for the new program and avoid conflicts between the old and new data. Writing refers to writing the new firmware from the flashing package into the chip's Flash memory in address order.
[0046] The first flash instruction's data includes the erase address and erase length. The erase address refers to the "starting position" of the erase, and the erase length refers to the "range" of data to be erased. During chip flashing, the erase address and erase length directly determine "which locations of data to erase" and "how much data to erase." The erase address and length of the flash data must meet certain constraints; otherwise, the flashing process will fail or the hardware will be damaged. These constraints include: the erase address must be the starting address of a sector or block and within the valid address range; the erase length must be an integer multiple of the sector or block size, and the address and length must not exceed the Flash memory range.
[0047] In some optional embodiments, the write data of the first write instruction includes an erase address and an erase length, and the response information includes the target chip's response information to the erase address and erase length; determining whether the write data of the first write instruction matches the target chip based on the response information includes: If the response information indicates that the target chip has responded to the erase address and erase length, then the write data of the first write instruction matches the target chip. If the response information indicates that the target chip's response to the erase address and erase length is not successful, then the write data of the first write instruction does not match the target chip.
[0048] Specifically, when the target chip receives the first write command, it needs to verify the erase address and erase length in the write data of the first write command. If the target chip's verification of the erase address and length does not meet the lower limit conditions, the chip will return a "negative response" (response failed) to the host computer. If the chip's verification of the erase address and length meets the lower limit conditions, the chip will return a "positive response" (response passed) to the host computer. A successful response indicates that the write data of the first write command matches the target chip, while a failed response indicates that the write data of the first write command does not match the target chip.
[0049] It is understandable that "negative response" and "positive response" are response information sent by the target chip to the host computer. For example, "negative response" is "100" and "positive response" is "200".
[0050] Different production batches and hardware versions of the same model of chip (such as version B and version C of MCU) may have differences in pin definitions and underlying drivers. The flashing data must include the corresponding hardware version's adaptation information, otherwise peripheral functions will be abnormal (such as the communication chip being unable to recognize the CAN bus).
[0051] In some optional embodiments, the flashing data of the first flashing instruction may further include chip hardware version adaptation information, and the response information may further include feedback information from the target chip regarding the chip hardware version adaptation information. Determining whether the flashing data of the first flashing instruction matches the target chip based on the response information may further include: if the feedback information indicates that the target chip matches the chip hardware version adaptation information, then the flashing data of the first flashing instruction matches the target chip; if the feedback information indicates that the target chip does not match the chip hardware version adaptation information, then the flashing data of the first flashing instruction does not match the target chip.
[0052] Optionally, the write data of the first write instruction may also include write data.
[0053] Once the target chip responds to the erase address and erase length of the first write instruction, the target chip begins to execute the chip erase process according to the first write instruction. After the erase process is completed, the write process for writing data is then executed.
[0054] When different chips of the same ECU need to be flashed and upgraded, the host computer flashes each chip one by one, and performs the same process for each chip, namely, a loop process of sending flashing instructions, receiving reply information, and judging whether they match.
[0055] In some optional embodiments, if the write data of the first write instruction matches the target chip, then write instructions are sent to other chips besides the target chip.
[0056] After each set of flashing commands is sent, the host computer must wait for the chip's response (positive or negative response) to confirm that the chip matches the flashing command before sending the next set of flashing commands to another chip. This avoids the host computer being unable to distinguish "which response corresponds to which chip's command" when multiple chips send commands concurrently, thus improving the reliability of flashing.
[0057] In some optional embodiments, before sending the first flashing instruction to the target chip, the method provided in this application further includes: sending a flashing mode instruction to the target ECU, so that the target ECU enters a flashing session mode in response to the flashing mode instruction; in response to the target ECU having entered the flashing session mode, sending a security access request to the target ECU; and after the security access request is approved, performing the step of sending the first flashing instruction to the target chip.
[0058] Specifically, after the host computer obtains and parses the flashing package, it sends a flashing mode command to the target ECU. Upon receiving the flashing mode command, the target ECU exits the normal operating mode and enters the flashing session mode. In the flashing session mode, the target ECU suspends application execution and only responds to flashing-related commands, indicating that the flashing process is stable and reliable.
[0059] When the host computer diagnoses that the target ECU has entered the flashing session mode, it sends a secure access request to the target ECU. After the target ECU authenticates the secure access request, it sends a successful request instruction to the host computer. The host computer then executes the step of sending the first flashing instruction to the target chip.
[0060] Optionally, the process of the target ECU authenticating the secure access request includes: the host computer initiates a secure access request; the target ECU generates a random seed A and returns it to the host computer; the host computer uses a pre-shared key and an agreed-upon algorithm to calculate key B based on A and sends it to the target ECU; the target ECU uses the same key and algorithm to calculate key C based on A; the target ECU compares B and C; if they match, authentication is successful, allowing subsequent flashing; if they do not match, authentication fails, and flashing is rejected.
[0061] In some optional embodiments, the method provided in this application further includes: verifying the flash package after the flashing of multiple chips is completed.
[0062] Specifically, after the flashing of multiple chips is completed, the host computer sends a "read firmware checksum" command to the chip. Upon receiving the command, the chip calculates the firmware checksum (such as CRC32) of the written data using its built-in algorithm and returns it to the host computer. The host computer compares the checksum returned by the chip with the "expected checksum" (pre-stored when the flashing package is generated) corresponding to that chip in the flashing package. If the checksums match, the checksum is considered valid; otherwise, the checksum is considered invalid. By verifying the data in the flashing package, the system ensures that the written data for each chip is error-free, guaranteeing the consistency and reliability of the flashing process.
[0063] In some optional embodiments, the method provided in this application further includes: resetting the target ECU after the flashing package passes verification, so that the target ECU exits the flashing session mode.
[0064] Specifically, when all chips in the target ECU have been flashed, the target ECU exits the flashing session mode and switches to normal operating mode.
[0065] This application resets the ECU to allow the newly flashed firmware to take effect and restore the ECU to its normal operating state. Without a reset, the new firmware may fail to load, and the ECU will remain in the flashing session mode, unable to perform normal control functions, restore normal vehicle control functions, and network communication.
[0066] Based on the same idea, this application also provides a flashing device for automotive electronic control units, such as... Figure 2 This is a schematic diagram of a flashing device for an automotive electronic control unit provided in an embodiment of this application. The flashing device 20 for the automotive electronic control unit mainly includes: The acquisition module 21 is used to acquire the corresponding flashing package based on the vehicle model and the software version information of the target ECU. The target ECU includes multiple chips, and the multiple chips include the target chip. Parsing module 22 is used to parse the flash package to obtain multiple sets of flash instructions, including the first flash instruction; Sending module 23 is used to send the first write command to the target chip; The receiving module 24 is used to receive the response information from the target chip; The judgment module 25 is used to determine whether the write data of the first write instruction matches the target chip based on the reply information. If they do not match, other write instructions in multiple sets of write instructions are sent to the target chip in sequence until the target chip matches the write data of one set of write instructions.
[0067] In one possible implementation, the write data of the first write instruction includes the erase address and erase length, and the response information includes the target chip's response information to the erase address and erase length; the judgment module 25 is also used for: If the response information indicates that the target chip has responded to the erase address and erase length, then the write data of the first write instruction matches the target chip. If the response information indicates that the target chip's response to the erase address and erase length is not successful, then the write data of the first write instruction does not match the target chip.
[0068] In one possible implementation, before sending the first write command to the target chip, the sending module 23 is further configured to: Send a flashing mode command to the target ECU so that the target ECU responds to the flashing mode command and enters the flashing session mode; In response to the target ECU having entered the flashing session mode, a secure access request is sent to the target ECU; After the secure access request is granted, the step of sending the first write command to the target chip is executed.
[0069] In one possible implementation, the judgment module 25 is also used for: If the write data of the first write instruction matches the target chip, then continue to send write instructions to other chips besides the target chip.
[0070] In one possible implementation, the above-mentioned vehicle electronic control unit flashing device 20 further includes a verification module for verifying the flashing package after the flashing of multiple chips is completed.
[0071] In one possible implementation, the above-mentioned vehicle electronic control unit flashing device 20 further includes a reset module, used to reset the target ECU after the flashing package passes verification, so that the target ECU exits the flashing session mode.
[0072] In one possible implementation, the write data of the first write instruction also includes write data.
[0073] Figure 2 The vehicle electronic control unit flashing device 20 provided in the illustrated embodiment can be used to execute the technical solution of the method embodiment shown in this application. Its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0074] The above should be understood Figure 2 The division of modules in the automotive electronic control unit flashing device 20 shown is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. These modules can be implemented entirely in software via processing element calls; they can be fully implemented in hardware; or some modules can be implemented in software via processing element calls, while others are implemented in hardware. For example, the acquisition module can be a separate processing element or integrated into a chip in the electronic device. The implementation of other modules is similar. Furthermore, these modules can be fully or partially integrated together, or they can be implemented independently. During implementation, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0075] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs). Alternatively, these modules can be integrated together as a system-on-a-chip (SOC).
[0076] In the above embodiments, the processor may include, for example, a CPU, DSP, microcontroller, or digital signal processor, and may also include a GPU, embedded neural network processing unit (NPU), and image signal processor (ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as an ASIC, or one or more integrated circuits for controlling the execution of the program in this application. Furthermore, the processor may have the function of operating one or more software programs, which may be stored in a storage medium.
[0077] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the method for flashing an automotive electronic control unit provided in the embodiments of this application.
[0078] The following is combined with Figure 3 The exemplary electronic devices provided in the embodiments of this application are further described. Figure 3 A schematic diagram of the structure of electronic device 3000 is shown.
[0079] The aforementioned electronic device 3000 may include: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor can execute the flashing method of the automotive electronic control unit provided in the embodiment of this application by calling the program instructions.
[0080] Figure 3 A block diagram is shown of an exemplary electronic device 3000 suitable for implementing embodiments of this application. Figure 3 The electronic device 3000 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0081] like Figure 3 As shown, the electronic device 3000 is presented in the form of a general-purpose computing device. The components of the electronic device 3000 may include, but are not limited to: one or more processors 3010, memory 3020, communication bus 3040 connecting different system components (including memory 3020 and processor 3010), and communication interface 3030.
[0082] The communication bus 3040 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, Micro Channel Architecture (MAC) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.
[0083] Electronic devices 3000 typically include a variety of computer system-readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, removable and non-removable media.
[0084] Memory 3020 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. Although Figure 3 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a compact disc read-only memory (CD-ROM), a digital video disc read-only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the communication bus 3040 via one or more data media interfaces. The memory 3020 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0085] A program / utility having a set (at least one) of program modules may be stored in memory 3020. Such program modules include, but are not limited to, an operating system, one or more applications, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules typically perform the functions and / or methods described in the embodiments of this application.
[0086] Electronic device 3000 can also communicate with one or more external devices (e.g., keyboard, pointing device, display, etc.), and with one or more devices that enable a user to interact with the electronic device, and / or with any device that enables the electronic device to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through communication interface 3030. Furthermore, electronic device 3000 can also communicate through a network adapter ( Figure 3(Not shown) communicates with one or more networks (e.g., Local Area Network (LAN), Wide Area Network (WAN), and / or public networks, such as the Internet). The aforementioned network adapter can communicate with other modules of the electronic device via the communication bus 3040. It should be understood that, although... Figure 3 As not shown, other hardware and / or software modules can be used in conjunction with the electronic device 3000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Drives (RAID) systems, tape drives, and data backup storage systems.
[0087] The processor 3010 executes various functional applications and data processing by running programs stored in the memory 3020, such as implementing the methods provided in the embodiments of this application.
[0088] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 3000. In other embodiments of this application, the electronic device 3000 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0089] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0090] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0091] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0092] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A method for flashing an automotive electronic control unit, characterized in that, The method includes: Obtain the corresponding flashing package based on the vehicle model and the software version information of the target ECU. The target ECU includes multiple chips, and the multiple chips include the target chip. The flash package is parsed to obtain multiple sets of flash instructions, including a first flash instruction. Send a first write command to the target chip; Receive the response information from the target chip; Based on the response information, it is determined whether the flashing data of the first flashing instruction matches the target chip. If they do not match, other flashing instructions from the multiple sets of flashing instructions are sent to the target chip in sequence until the target chip matches the flashing data of one of the sets of flashing instructions.
2. The method according to claim 1, characterized in that, The write data of the first write instruction includes the erase address and the erase length, and the response information includes the response information of the target chip to the erase address and the erase length; The step of determining whether the flash data of the first flash instruction matches the target chip based on the reply information includes: If the response information indicates that the target chip's response to the erase address and the erase length is successful, then the write data of the first write instruction matches the target chip. If, based on the response information, it is determined that the target chip's response to the erase address and the erase length is not successful, then the write data of the first write instruction does not match the target chip.
3. The method according to claim 1, characterized in that, Before sending the first flash command to the target chip, the method further includes: Send a flashing mode command to the target ECU so that the target ECU responds to the flashing mode command and enters a flashing session mode; In response to the target ECU having entered the flashing session mode, a secure access request is sent to the target ECU; After the secure access request is granted, the step of sending the first flash instruction to the target chip is executed.
4. The method according to claim 3, characterized in that, The method further includes: If the write data of the first write instruction matches the target chip, then write instructions are sent to other chips besides the target chip.
5. The method according to claim 4, characterized in that, The method further includes: After the flashing of the multiple chips is completed, the flashing package is verified.
6. The method according to claim 5, characterized in that, The method further includes: After the flashing package passes verification, the target ECU is reset so that the target ECU exits the flashing session mode.
7. The method according to claim 2, characterized in that, The write data of the first write instruction also includes write data.
8. A flashing device for an automotive electronic control unit, characterized in that, include: The acquisition module is used to acquire the corresponding flashing package based on the vehicle model and the software version information of the target ECU. The target ECU includes multiple chips, and the multiple chips include the target chip. The parsing module is used to parse the flash package to obtain multiple sets of flash instructions, including a first flash instruction. The sending module is used to send a first write command to the target chip; A receiving module is used to receive the response information from the target chip; The judgment module is used to determine whether the flashing data of the first flashing instruction matches the target chip based on the reply information. If they do not match, other flashing instructions in the multiple sets of flashing instructions are sent to the target chip in sequence until the target chip matches the flashing data of one of the sets of flashing instructions.
9. An electronic device, characterized in that, include: A processor and a memory, the memory being used to store a computer program; the processor being used to run the computer program to implement the flashing method for an automotive electronic control unit as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the flashing method for an automotive electronic control unit as described in any one of claims 1-7.