ECU code updating method and device, electronic equipment and storage medium

Through the automated method of obtaining and updating ECU code, the problem of long and low efficiency of ECU code modification is solved, and efficient and accurate code updates are achieved.

CN119045848APending Publication Date: 2024-11-29EVE ENERGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411074190.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

In the prior art, the modification time of ECU codes is long, inefficient and prone to errors, resulting in errors and omissions caused by manual modification.

Method used

By obtaining the project folder, DBC file and configuration file, determine the target file where the signals related to the diagnostic service are located, and modify or replace the target file according to the configuration file and DBC file, generate the updated project folder, and finally turn it into Burn into the ECU to realize automated code updates.

Benefits of technology

It realizes automatic update of ECU code, shortens modification time, improves efficiency, and avoids errors and omissions caused by manual modification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045848A_ABST
    Figure CN119045848A_ABST
Patent Text Reader

Abstract

The invention discloses an ECU code updating method and device, electronic equipment and a storage medium, and the method comprises the steps that an engineering folder, a DBC file and a configuration file are obtained firstly, the engineering folder is an existing code file needed by normal operation of an ECU, and the DBC file is a file describing communication network data related to diagnosis service; determining a target file in which a signal used by the ECU during communication based on the diagnostic service is located in the engineering folder; modifying or replacing a target file in the project folder according to the configuration file and the DBC file to obtain an updated project folder; and burning the updated project folder into an ECU (Electronic Control Unit). When the code associated with the diagnostic service in the ECU is updated, the code associated with the diagnostic service in the ECU can be automatically updated only by configuring the DBC file and the configuration file, the modification time is short, the efficiency is high, and errors and omission caused by manual modification can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automobile communication technology, and in particular to an ECU code updating method, device, electronic equipment and storage medium. Background Art

[0002] ECU (Electronic Control Unit) usually refers to the ECU chip, which is a very core electronic component in the vehicle, equivalent to the brain of the vehicle. The car's diagnostic service (Unified Diagnostic Services) is the language for establishing diagnosis between the outside world and the inside of the car. The external diagnostic instrument and the ECU inside the car follow the diagnostic service protocol together, and the external diagnostic instrument can obtain corresponding feedback information from the ECU inside the car through the corresponding instructions of the diagnostic service.

[0003] With the development of the automobile industry, whether it is traditional automobiles or new energy vehicles, in order to further achieve effective performance such as functional safety, the computing power of a single ECU is also required to be improved accordingly. CAN (Controller Area Network) communication is the most basic and important communication method between various ECUs in the car. The DBC (Data Base CAN) file is a database file that describes the CAN communication information between all electronic nodes (ECUs) on the network. It is a necessary technical file for CAN communication testing in the communication field, and it is also a necessary file for parsing the CAN protocol content and analyzing the CAN communication content.

[0004] Currently, the code content of each file related to the diagnostic service in the ECU is modified manually, but the number of signals in the DBC file can reach hundreds. Manual code modification is time-consuming, resulting in a long modification time and low efficiency. Manual code modification is also prone to errors and omissions, and code proofreading also takes a lot of time. Summary of the invention

[0005] The present invention provides an ECU code updating method to solve the problems of long modification time, low efficiency and easy error when manually modifying codes related to diagnostic services in an ECU.

[0006] In a first aspect, the present invention provides an ECU code update method, wherein the ECU communicates with an external diagnostic instrument based on a diagnostic service, and the ECU code update method comprises:

[0007] Obtain a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing communication network data related to the diagnostic service;

[0008] Determine in the project folder the target file where the signal related to the diagnostic service is located;

[0009] Modify or replace the target file in the project folder according to the configuration file and the DBC file to obtain the updated project folder, wherein the configuration file includes the association relationship between the signal and the semaphore in the target file;

[0010] Burn the updated project folder into the ECU.

[0011] In a second aspect, the present invention provides an ECU code update device, comprising:

[0012] A file acquisition module, used to acquire a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing communication network data related to the diagnostic service;

[0013] A target file determination module, used to determine the target file where the signal related to the diagnostic service is located in the project folder;

[0014] A project folder update module, used for modifying or replacing the target file in the project folder according to the configuration file and the DBC file to obtain the updated project folder, wherein the configuration file includes the association relationship between the signal and the semaphore in the target file;

[0015] The burning module is used to burn the updated project folder into the ECU.

[0016] In a third aspect, the present invention provides an electronic device, the electronic device comprising:

[0017] at least one processor; and

[0018] a memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the ECU code updating method described in the first aspect of the present invention.

[0020] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the ECU code update method described in the first aspect of the present invention when executed.

[0021] The embodiment of the present invention provides an ECU code update method, firstly obtaining a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing the communication network data related to the diagnostic service; determining the target file where the signal used by the ECU when communicating based on the diagnostic service is located in the project folder; modifying or replacing the target file in the project folder according to the configuration file and the DBC file to obtain an updated project folder, wherein the configuration file includes the association between the signal and the semaphore in the target file; and burning the updated project folder into the ECU. Then, when updating the code associated with the diagnostic service in the ECU, it is only necessary to configure the DBC file and the configuration file to realize automatic updating of the code associated with the diagnostic service in the ECU, with short modification time and high efficiency, and avoiding errors and omissions caused by manual modification.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 is a flow chart of an ECU code updating method provided by Embodiment 1 of the present invention;

[0025] Figure 2 This is a schematic diagram of a process for updating a code related to a diagnostic service in an ECU provided by a first embodiment of the present invention;

[0026] Figure 3 is a flow chart of an ECU code updating method provided by Embodiment 2 of the present invention;

[0027] Figure 4 It is a structural schematic diagram of an ECU code updating device provided by Embodiment 3 of the present invention;

[0028] Figure 5 It is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] Embodiment 1

[0031] Figure 1 This is a flowchart of an ECU code update method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of ECU code update. The method can be executed by an ECU code update device. The ECU code update device can be implemented in the form of hardware and / or software. The ECU code update device can be configured in an electronic device.

[0032] like Figure 1 As shown, the ECU code update method includes:

[0033] S101, obtaining a project folder, a DBC file, and a configuration file.

[0034] Unified Diagnostic Services is a universal service standard that includes functions such as session control, diagnostic request, diagnostic response and ECU programming. Diagnostic services are used for diagnosis and debugging of automotive electronic control units (ECUs) and can communicate on the CAN bus.

[0035] Among them, ECU communicates with external diagnostic instruments based on diagnostic services. Many projects related to diagnostic services require updating the codes related to diagnostic services in ECU. For example, to add an alarm function when the diagnosis is abnormal, to add a display function of a parameter related to diagnosis, etc., it is necessary to update the codes related to diagnostic services in ECU. The project folder is the code file required for the normal operation of the existing ECU, which is equivalent to a code document. When the codes related to diagnostic services in ECU need to be updated, the codes in the existing project folder can be updated to achieve the purpose of updating the codes related to diagnostic services in ECU. Optionally, the existing project folder can be a folder with similar functions to the current project. The project folder and the expected project folder can share some codes, which can save code update time and improve code update efficiency.

[0036] The DBC file is a file that describes the communication network data related to the diagnostic service. The DBC file can be provided by the developer or the customer to meet the developer's or customer's requirements for diagnostic functions.

[0037] S102: Determine, in the project folder, a target file containing signals related to the diagnostic service.

[0038] The project folder is equivalent to the code document, and the target file is the code segment in the code document. Each code segment corresponds to a certain function.

[0039] The target files related to the diagnostic service are usually fixed, and the location of the target files can be determined by code tags or code comment text. In an optional embodiment, the target files where the signals related to the diagnostic service are located are determined in the project folder, including: determining the target files where the signals used by the ECU based on the diagnostic service are located in the project folder through the hierarchical structure information of the project folder. The hierarchical structure information is a file that describes the distribution location or code level of each target file in the project folder.

[0040] In addition, the file name of each target file may be pre-set in the project folder, and the file name may be used as a matching field to match and obtain the corresponding target file, which is not limited in the present invention.

[0041] S103: modify or replace the target file in the project folder according to the configuration file and the DBC file to obtain an updated project folder.

[0042] The configuration file includes the association relationship between the signal in the target file and the semaphore, wherein the signal refers to the signal in the project folder, and the semaphore refers to the semaphore in the DBC file, that is, the configuration file associates the signal in the target file with the semaphore in the DBC file one-to-one.

[0043] Therefore, the value of the variable in the target file in the project folder can be modified based on the association relationship, or the target file in the project folder can be replaced based on the association relationship.

[0044] Regarding the modification of the target file, specifically, the signal of the required modification (content) in the current target file is obtained from the configuration file as the signal to be modified; then the semaphore corresponding to the signal to be modified is obtained from the DBC file and filled into the position of the signal to be modified in the target file.

[0045] Regarding the replacement of the target file, specifically, the code generation template of each target file can be defined in the configuration file, so that the values ​​of the variables in the code generation template can be filled according to the DBC file, a new target file is generated and the original target file is replaced. In addition, a new target file can also be generated according to the original code in the target file, specifically, the original code in the target file is copied to a blank file to obtain the code to be processed, and the semaphore is replaced for the code to be processed according to the configuration file and the DBC file to obtain the processed code, and then the processed code overwrites the original code in the target file. The original code is pulled out to the blank file for semaphore replacement. The advantage of this operation is that multiple target files can be updated at the same time, code conflicts can be avoided, and development efficiency can be improved. This method of replacing the target file as a whole can also be used as a method of modifying the target file. Optionally, the number of signals and semaphores to be modified can be calculated to obtain the number of modifications. When the number of modifications is large, the project folder is updated by regenerating the target file and replacing the original target file. When the number of modifications is small, the project folder is updated by modifying the target file, and the existing code in the project folder can be reasonably used.

[0046] Optionally, the change method for each target file can be pre-set in the configuration file. The change methods include modification and replacement. The target files in the project folder are modified or replaced according to the configuration file and the DBC file. For each target file, when the change method corresponding to the target file is modification, the target file is modified according to the configuration file and the DBC file; when the change method corresponding to the target file is replacement, the target file is replaced according to the configuration file and the DBC file.

[0047] S104, burning the updated project folder into the ECU.

[0048] ECU is essentially an electronic component. By burning the updated project folder into the ECU through the burning tool, the code related to the diagnostic service in the ECU can be updated. When the ECU is running, it calls the code in the project folder to implement the diagnostic service.

[0049] In order to facilitate the code update of the ECU, an ECU code update device can be set to perform the update. Specifically, Figure 2 A flowchart for updating the code related to the diagnostic service in the ECU is shown in FIG. Figure 2 As shown, the ECU code updating device 200 obtains the project folder A1, the DBC file B, and the configuration file C, updates the project folder A1 based on the three to obtain the project folder A2, and burns the project folder A2 into the ECU 100. The whole process is automated, and there is no need to manually modify the specific content of the code.

[0050] The embodiment of the present invention provides an ECU code update method, firstly obtaining a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing the communication network data related to the diagnostic service; determining the target file where the signal used by the ECU when communicating based on the diagnostic service is located in the project folder; modifying or replacing the target file in the project folder according to the configuration file and the DBC file to obtain an updated project folder, wherein the configuration file includes the association between the signal and the semaphore in the target file; and burning the updated project folder into the ECU. Then, when updating the code associated with the diagnostic service in the ECU, it is only necessary to configure the DBC file and the configuration file to realize automatic updating of the code associated with the diagnostic service in the ECU, with short modification time and high efficiency, and avoiding errors and omissions caused by manual modification.

[0051] Embodiment 2

[0052] Figure 3 This is a flow chart of an ECU code update method provided in Embodiment 2 of the present invention. This embodiment of the present invention is optimized based on Embodiment 1 above. Figure 3 As shown, the ECU code update method includes:

[0053] S301, obtain the project folder, DBC file and configuration file.

[0054] The project folder contains the code files required for the normal operation of the existing ECU, and the DBC file is a file that describes the communication network data related to the diagnostic service.

[0055] S302: Determine, in the project folder, a target file containing signals related to the diagnostic service.

[0056] S303: For each target file, determine whether the target file is a dedicated file for the diagnosis service.

[0057] If yes, execute S304-S305, if no, execute S306.

[0058] For the target file, although it is the file where the signals related to the diagnostic service are located, it may also be a file used by other functions (modules), that is, the target file may not be a dedicated file for the diagnostic service, and the configuration file and DBC file only configure the content related to the diagnostic service. If the configuration file and DBC file are to be configured to generate a new target file, the newly generated target file cannot support the operation of other functions (modules). Therefore, for the target file of the dedicated file for the diagnostic service, it can be updated by replacement or modification, but for the target file of the dedicated file not for the diagnostic service, in order to support the operation of other functions (modules) at the same time, it can only be updated by modification.

[0059] S304: Determine a code generation template corresponding to the target file in the configuration file to obtain the target template.

[0060] The configuration file includes the association between signals and semaphores in the target file and the code generation template.

[0061] The target files are usually fixed, and it is also possible to know in advance which target files are updated by modification and which target files are updated by replacement. Therefore, the corresponding code generation template can be set in advance according to the target files updated by replacement.

[0062] Optionally, the target file includes 10 files, namely, signal filling file, receiving signal declaration file, signal definition file, callback parameter file, buffer area parameter file, communication module message frame definition file, diagnosis submodule message frame definition file, diagnosis frame definition file, and communication module signal parameter file. Among them, the signal filling file, signal definition file, callback parameter file, buffer area parameter file, diagnosis frame definition file, and communication module signal parameter file are dedicated files for diagnostic services, that is, files updated by replacement. Therefore, the configuration file is provided with code generation templates for these 6 files.

[0063] Among them, the communication module is equivalent to the communication center of the ECU, and the diagnosis submodule is a submodule of the communication module. All signals related to the diagnosis service in the ECU are processed by the diagnosis submodule.

[0064] Optionally, the dedicated files for the diagnostic service include a signal definition file. The signals include sending signals and receiving signals. The signal definition file defines the parameter contents of the sending signals and the receiving signals. The parameter contents of the sending signals include the protocol data unit, ID, receiving mailbox and callback function name of the sending signals. The parameter contents of the receiving signals include the protocol data unit, ID, signal length and callback function name of the receiving signals.

[0065] Optionally, the dedicated files for the diagnostic service include a buffer parameter file, the signals include sending signals and receiving signals, the communication parameter file defines the communication parameters of sending signals and receiving signals, the communication parameters of sending signals include the protocol data unit of sending signals, message sending buffer and length, and sending default values; the communication parameters of receiving signals include the protocol data unit of receiving signals, message receiving buffer and length, and receiving default values.

[0066] Among them, the Protocol Data Unit (PDU) is a data unit that represents the transmission between peer levels; it can be used to represent the information and data transmitted between the sender and the receiver peer entities.

[0067] S305 , generating a new target file based on the association relationship between the signal and the semaphore in the configuration file, the target template and the DBC file.

[0068] A new target file is generated based on the association relationship between signals and semaphores in the configuration file, the target template and the DBC file, including: according to the association relationship between signals and semaphores in the configuration file, determining the semaphore corresponding to the signal in the target template in the DBC file to obtain an information pair of the signal and the semaphore; and generating a new target file based on the information pair and the target template.

[0069] For ECU code update, the efficiency of automatically generating a new target file is usually higher than the efficiency of modifying an existing target file. Therefore, in this embodiment, when the target file is a dedicated file for diagnostic services, the project folder is updated by directly generating a new target file and replacing it.

[0070] Among them, the dedicated files of the diagnostic service include signal definition files. The contents of the signal definition files include the parameter contents of sending signals and receiving signals. The parameter contents of sending signals include the protocol data unit, ID, receiving mailbox and callback function name of the sending signal. The parameter contents of receiving signals include the protocol data unit, ID, signal length and callback function name of the receiving signal.

[0071] The dedicated files for diagnostic services include buffer parameter files. The contents of communication parameter files include communication parameters for sending and receiving messages. The communication parameters for sending messages include the protocol data unit of the sent message, the message sending buffer and length, and the sending default value; the communication parameters for receiving messages include the protocol data unit of the received message, the message initial value, the message receiving buffer and length, and the receiving default value.

[0072] S306 , reassigning the signals related to the diagnostic service in the target file based on the configuration file and the DBC file to obtain a modified target file.

[0073] Based on the configuration file and the DBC file, the signals related to the diagnostic service in the target file are reassigned to obtain a modified target file, including: determining the signals related to the diagnostic service in the target file according to the configuration file to obtain the signals to be modified; for each signal to be modified, according to the association between the signal and the semaphore in the configuration file, determining the semaphore corresponding to the signal to be modified in the DBC file to obtain the target information amount; reassigning the signal to be modified using the target information amount; after traversing the signals to be modified in the target file, obtaining the modified target file.

[0074] S307: After the target file traversal is completed, an updated project folder is obtained.

[0075] S308. Burn the updated project folder into the ECU.

[0076] In this embodiment, the target file in the project folder is modified or replaced according to the configuration file and the DBC file to obtain an updated project folder, which specifically includes: for each target file, determining whether the target file is a special file for diagnostic services; if so, determining the code generation template corresponding to the target file in the configuration file to obtain the target template; generating a new target file based on the association relationship between the signal and the semaphore in the configuration file, the target template and the DBC file; if not, reassigning the signal related to the diagnostic service in the target file based on the configuration file and the DBC file to obtain the modified target file; after the target file traversal is completed, the updated project folder is obtained. The efficiency of automatically generating a new target file is higher than the efficiency of modifying an existing target file. Therefore, in this embodiment, when the target file is a special file for diagnostic services, the code update efficiency can be improved by directly generating a new target file and replacing it to achieve the update of the project folder.

[0077] In order to clearly illustrate the ECU code updating method of the present invention, the following target file is used for example description.

[0078] Table 1. Target files and introduction table.

[0079]

[0080]

[0081] Table 1 is a table of target files and their introductions. In Table 1, the target file's file name 1 is a Chinese name, and the target file is actually a code segment, so the file name 2 is the actual code segment name. The steps of the ECU code update method are:

[0082] 1. First, obtain the DBC file, project folder and configuration file, and use the configuration file to associate the signals (variables) in the project folder with the semaphores in the DBC file one-to-one.

[0083] 2. CarCan.c (signal filling file): divide the signal into TX (transmit) signal and RX (receive) signal, initialize the TX signal and RX signal, and then load the data to generate the file CarCan.c.

[0084] Specifically, in step 1, place all TX IDs in the enumeration. Since each project is different, the number of TX IDs may also be different. The TX ID is defined by the DBC file. Read the TX ID in the DBC file and put it into the enumeration; in step 2, initialize the variables corresponding to the RX signal in the initialization function, that is, assign them all to 0; in step 3, load the variables corresponding to the TX signal and the variables corresponding to the RX signal according to the configuration file; in step 4, initialize the variables corresponding to the RX signal when setting the error. Step 5, generate CarCan.c (signal filling file). Among them, in step 3, when loading the variables corresponding to the RX signal, the order of the PDU (serial number) is set.

[0085] 3. Swadp.c / Swadp.h (receive signal declaration file): declare the RX signal and put it in the Swadp.c and Swadp.h files.

[0086] The corresponding code snippet is as follows:

[0087] / *RXID=8x320* /

[0088] Volatilerea 132_T ComRv_ioBcoutputcur;

[0089] Volatilerea 132_T ComRV_uoBcoutputVolt;

[0090] / *RXID=0x320* /

[0091] extern volatile rea132_T ComRV_i0BcOutputCur;

[0092] extern volatile real32_T ComRV_uoBcoutputVolt;

[0093] All signals need to be declared, and the corresponding variables are declared at the specified location. This file declares the variables in CarCan.c. In addition to the diagnosis submodule, the variables of other submodules in the communication module are also declared here.

[0094] 4. Diag_CanIf_Lcfg.c (signal definition file): Set the RX signal related content, including PDU (protocol data unit, which is actually the sequence number of PDU), ID, DLC (signal length, the longest is 64 bytes, usually defined as 8), callback function (name), etc.;

[0095] Set the relevant content of the TX signal, including PDU, ID, receiving mailbox (1.2.3, 1.2.3 loop), callback function, etc. After generating the code, Diag_CanIf_Lcfg.c is generated.

[0096] 5. App_Com.c (callback parameter file): Configure the callback functions of RX and TX (define the contents of the callback functions). The PDU sequence needs to be consistent with that in the step 6 file to generate App_Com.c.

[0097] The message sending confirmation callback function (each message needs to be configured, including ordinary messages and diagnostic messages), the message receiving confirmation callback function (each message needs to be configured, including ordinary messages and diagnostic messages), ordinary messages are other messages in the communication module except diagnostic messages. Diagnosis belongs to the interactive mode, and a lot of information can be installed in the diagnostic message for use, for example, the signal required by the vehicle can be installed in the diagnostic message for use.

[0098] 6. Com_MsgCfg.c (buffer parameter file):

[0099] Define the TX message Ipd (consistent with the above PDU); set the default value of the TX message buffer; add the message send buffer and length (8) in the Com_TxIpduInitTable[] array; add the send default value in the Com_TxIpduDefaultValue[] array;

[0100] Define the Rx message Ipdu (consistent with the above PDU); set the initial value of the Rx message; add the message receiving buffer and length in the Com_RxIpduInitTable[] array; add the receiving default value in the Com_RxIpduDefaultValue[] array; and then generate Com_MsgCfg.c.

[0101] 7. Com_Cfg.h (communication module message frame definition file): calculate the number of frames of TX and RX (not the number of signals) according to DBC, and replace the number of frames in the original file (COM_TXIPDUNUM and COM_RXIPDUNUM); TX and RX are defined as IPDUBUF types consistent with the number of configuration files; RX message reception notification callback function declaration; TX message sending confirmation notification callback function declaration; Com_Cfg.h is a parameter file for the communication module.

[0102] 8. Diag_CanIf.h (diagnostic submodule message frame definition file): Calculate the number of TX and RX frames according to DBC, and replace the frame number in the original file (CANIF_CFG_TOTAL_TXPDUID and CANIF_CFG_TOTAL_RXPDUID); Diag_CanIf.h is a parameter file for the diagnostic submodule. Note: The above frame number includes the total number of ordinary messages and diagnostic messages.

[0103] 9. Diag_CanTp_PBCfg.c (diagnostic frame definition file): Add (1) TX and (2) RX diagnostic frames according to DBC. The PDUID (consistent with the above PDU) must be consistent with the PDU sequence number in the Diag_CanIf_Lcfg.c file to generate Diag_CanTp_PBCfg.c;

[0104] 10. Com_Cfg.c (communication module signal parameter file): add TX message sending type, including whether to send timeout monitoring information; increase TX message sending cycle; increase TX send timeout setting; increase TX send delay setting; add TX IpduIDMap function to configure the send message IPduID, starting from zero); configure the message sending confirmation notification callback function in the Com_TxIpduConfirmTable[] array; RX message receiving timeout judgment and time threshold configuration (where PDU is consistent with the PDU in step 6); RX message receiving notification callback function configuration; Com_Cfg.c file is the parameter configuration file of the entire communication module.

[0105] The TX messages here include common messages and diagnostic messages. For common messages, which need to be sent periodically, message sending timeout monitoring is required. For diagnostic messages, which are sent as events, timeout monitoring is not required. You can set the corresponding RX message receiving timeout judgment and time threshold configuration.

[0106] Embodiment 3

[0107] Figure 4 This is a schematic diagram of the structure of an ECU code update device provided in Embodiment 3 of the present invention. Figure 4As shown, the ECU code updating device includes:

[0108] The file acquisition module 401 is used to acquire a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing communication network data related to the diagnostic service;

[0109] A target file determination module 402, used to determine the target file where the signal related to the diagnostic service is located in the project folder;

[0110] A project folder updating module 403 is used to modify or replace the target file in the project folder according to the configuration file and the DBC file to obtain the updated project folder, wherein the configuration file includes the association relationship between the signal and the semaphore in the target file;

[0111] The burning module 404 is used to burn the updated project folder into the ECU.

[0112] Optionally, the target file determination module 402 includes:

[0113] The target file determination submodule is used to determine the target file where the signal used by the ECU based on the diagnostic service is located in the project folder through the hierarchical structure information of the project folder.

[0114] Optionally, the configuration file further includes a code generation template, and the project folder updating module 403 includes:

[0115] A dedicated file determination submodule is used to determine, for each target file, whether the target file is a dedicated file for diagnostic services; if so, execute the content of the target template determination submodule; if not, execute the content of the target file modification submodule;

[0116] A target template determination submodule, used to determine a code generation template corresponding to the target file in the configuration file to obtain a target template;

[0117] A first target file generation submodule, used for generating a new target file based on the association relationship between the signal and the semaphore in the configuration file, the target template and the DBC file;

[0118] A target file modification submodule, used for reassigning the signals related to the diagnostic service in the target file based on the configuration file and the DBC file to obtain the modified target file;

[0119] The project folder update submodule is used to obtain the updated project folder after the target file traversal is completed.

[0120] Optionally, the first target file generation submodule includes:

[0121] An information pair determination unit, configured to determine, in the DBC file, a signal quantity corresponding to the signal in the target template according to the association relationship between the signal and the signal quantity in the configuration file, to obtain an information pair of the signal and the signal quantity;

[0122] The target file generating unit is used to generate a new target file based on the information pair and the target template.

[0123] Optionally, the target file modification submodule includes:

[0124] A signal to be modified determining unit, configured to determine a signal related to the diagnostic service in the target file according to the configuration file, to obtain a signal to be modified;

[0125] A target information volume determination unit is used to determine, for each of the signals to be modified, the signal volume corresponding to the signal to be modified in the DBC file according to the association relationship between the signal and the signal volume in the configuration file, so as to obtain the target information volume;

[0126] a re-assignment unit, configured to re-assign the signal to be modified by using the target information amount;

[0127] The target file modification completion determination unit is used to obtain the modified target file after the traversal of the signal to be modified in the target file is completed.

[0128] Optionally, the dedicated file of the diagnostic service includes a signal definition file, the content of the signal definition file includes the parameter content of the sending signal and the receiving signal, the parameter content of the sending signal includes the protocol data unit, ID, receiving mailbox and callback function name of the sending signal, and the parameter content of the receiving signal includes the protocol data unit, ID, signal length and callback function name of the receiving signal.

[0129] Optionally, the dedicated file of the diagnostic service includes a buffer parameter file, the content of the communication parameter file includes communication parameters for sending messages and receiving messages, the communication parameters for sending messages include the protocol data unit of the sent message, the message sending buffer and length, and the sending default value; the communication parameters for receiving messages include the protocol data unit of the received message, the message initial value, the message receiving buffer and length, and the receiving default value.

[0130] The ECU code updating device provided in the embodiment of the present invention can execute the ECU code updating method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0131] Embodiment 4

[0132] Figure 5 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0133] like Figure 5 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0134] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0135] The processor 41 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 41 executes the various methods and processes described above, such as an ECU code update method.

[0136] In some embodiments, the ECU code update method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the ECU code update method described above can be performed. Alternatively, in other embodiments, the processor 41 can be configured to perform the ECU code update method in any other appropriate manner (e.g., by means of firmware).

[0137] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0138] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0139] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0140] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0141] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0142] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0144] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An ECU code update method, characterized in that: The ECU communicates with an external diagnostic instrument based on a diagnostic service, and the ECU code update method includes: Obtain a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing communication network data related to the diagnostic service; Determine in the project folder the target file where the signal related to the diagnostic service is located; Modify or replace the target file in the project folder according to the configuration file and the DBC file to obtain the updated project folder, wherein the configuration file includes the association relationship between the signal and the semaphore in the target file; Burn the updated project folder into the ECU.

2. The ECU code updating method according to claim 1, characterized in that: The target file where the signal related to the diagnostic service is located is determined in the project folder, including: The target file where the signal used by the ECU based on the diagnostic service is located is determined in the project folder through the hierarchical structure information of the project folder.

3. The ECU code updating method according to claim 1, characterized in that: The configuration file also includes a code generation template, and the target file in the project folder is modified or replaced according to the configuration file and the DBC file to obtain the updated project folder, including: For each of the target files, determining whether the target file is a dedicated file for diagnostic services; If so, determining a code generation template corresponding to the target file in the configuration file to obtain a target template; Generate a new target file based on the association relationship between the signal and the semaphore in the configuration file, the target template and the DBC file; If not, reassign the signals related to the diagnostic service in the target file based on the configuration file and the DBC file to obtain a modified target file; After the target file traversal is completed, the updated project folder is obtained.

4. The ECU code updating method according to claim 3, characterized in that: The generating a new target file based on the association relationship between the signal and the semaphore in the configuration file, the target template and the DBC file comprises: According to the association relationship between the signal and the semaphore in the configuration file, the semaphore corresponding to the signal in the target template is determined in the DBC file to obtain an information pair of the signal and the semaphore; A new target file is generated based on the information pair and the target template.

5. The ECU code updating method according to claim 3, characterized in that: The reassigning of the signal related to the diagnostic service in the target file based on the configuration file and the DBC file to obtain the modified target file comprises: Determine the signal related to the diagnostic service in the target file according to the configuration file, and obtain the signal to be modified; For each of the signals to be modified, according to the association relationship between the signal and the signal quantity in the configuration file, the signal quantity corresponding to the signal to be modified is determined in the DBC file to obtain the target information quantity; Re-assigning the signal to be modified by using the target information amount; After the signal to be modified in the target file is traversed completely, the modified target file is obtained.

6. The ECU code updating method according to claim 3, characterized in that: The dedicated file of the diagnostic service includes a signal definition file, the content of the signal definition file includes the parameter content of the sending signal and the receiving signal, the parameter content of the sending signal includes the protocol data unit, ID, receiving mailbox and callback function name of the sending signal, and the parameter content of the receiving signal includes the protocol data unit, ID, signal length and callback function name of the receiving signal.

7. The ECU code updating method according to claim 3, characterized in that: The dedicated file of the diagnostic service includes a buffer parameter file, and the content of the communication parameter file includes communication parameters for sending messages and receiving messages. The communication parameters for sending messages include the protocol data unit of the sent message, the message sending buffer and length, and the sending default value; the communication parameters for receiving messages include the protocol data unit of the received message, the message initial value, the message receiving buffer and length, and the receiving default value.

8. An ECU code updating device, characterized in that: include: A file acquisition module, used to acquire a project folder, a DBC file and a configuration file, wherein the project folder is a code file required for the normal operation of an existing ECU, and the DBC file is a file describing communication network data related to the diagnostic service; A target file determination module, used to determine the target file where the signal related to the diagnostic service is located in the project folder; A project folder update module, used for modifying or replacing the target file in the project folder according to the configuration file and the DBC file to obtain the updated project folder, wherein the configuration file includes the association relationship between the signal and the semaphore in the target file; The burning module is used to burn the updated project folder into the ECU.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the ECU code updating method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the ECU code updating method according to any one of claims 1 to 7 when executed.