Code generation method and device, computer program product and electronic equipment

By analyzing the ECU's communication matrix description file to generate model data, building data modules and updating software components, the problem of inefficiency in manual configuration and verification in the traditional ECU development process is solved, and more efficient and reliable code development is achieved.

CN119512534APending Publication Date: 2025-02-25CHINA AUTOMOTIVE INNOVATION CORP
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411544797.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In traditional ECU development processes, application software engineers need to manually configure and verify the interactive signals between ECU nodes, resulting in inefficiency and error-prone, especially in complex communication matrices and multiple signals.

Method used

By obtaining the communication matrix description file of the control unit, parsing these files to obtain model data, building data modules and updating software components, thereby generating object codes, reducing the need for manual configuration.

Benefits of technology

Improves code development efficiency, reduces human errors, shortens development cycles, and improves the accuracy and reliability of code generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512534A_ABST
    Figure CN119512534A_ABST
Patent Text Reader

Abstract

The invention discloses a code generation method and device, a computer program product and electronic equipment. The method relates to the field of software development or other related fields and comprises the steps that M communication matrix description files of a control unit are obtained, each communication matrix description file is analyzed, M model data are obtained, and each piece of model data is used for representing information of vehicle-mounted software associated with the control unit; data modules are constructed according to the M pieces of model data, N data modules are obtained, and each data module represents information of the vehicle-mounted software; and updating a software component of the control unit by using the M model data to obtain a component file, generating a target code by using the N data modules and the component file, running the control unit based on the target code under the condition of obtaining the target code, and running the vehicle-mounted software in the communication process of the control unit. Through the method and the device, the problem of low code generation efficiency in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software development or other related fields, and in particular, to a code generation method, device, computer program product, and electronic device. Background Art

[0002] With the rapid development of the automobile industry and electrical information technology, the level of automobile intelligence, networking and electrification has been continuously improved. The number and complexity of automotive electronic control units (ECUs) have increased dramatically, and the demand for communication between ECUs has increased accordingly, resulting in a more complex in-vehicle communication network. Among them, ECU is the intelligent unit responsible for controlling various subsystems in the car. They are interconnected through various communication protocols (such as CAN (Controller Area Network), LIN (Local Interconnect Network Protocol), FlexRay (Flexible Ray), etc.) to achieve data exchange and function coordination.

[0003] In order to effectively manage and optimize these communications, the software development framework of the automotive industry is also evolving, among which AUTOSAR (AUTomotive Open System Architecture) has become an industry standard. The AUTOSAR architecture aims to create and establish an open and standardized software architecture, which will then be used in the development of automotive electronic control units. The AUTOSAR architecture supports the reuse, exchange, upgrade and integration of software components by defining concepts such as software components (SWC) and runtime environments (RTE).

[0004] However, with the increase in the number of ECUs and the complexity of the communication matrix, the interaction signals between ECU nodes are becoming more and more complex, and the traditional ECU development process faces challenges. In the traditional development process, application software engineers need to manually configure the port and interface information of component instances according to the communication matrix, which is time-consuming and error-prone. After completing the configuration, engineers need to export the design information as an ARXML file, which is then imported into the RTE generation tool (such as ISOLAR-A) by the basic software engineer for further editing and setting, and finally generate the RTE module code.

[0005] As controllers become more complex, when the communication matrix becomes large and the signal types become numerous, this manual configuration and verification process is not only inefficient, but for the CAN communication protocol stack, application software engineers need to manually configure more and more interface information, the development cycle becomes longer and longer, and problems are easily discovered in the late stage of development, resulting in rework and delays, which seriously challenges efficiency and reliability.

[0006] Currently, no effective solution has been proposed to address the problem of low efficiency in code generation in related technologies. Summary of the invention

[0007] The main purpose of the present application is to provide a code generation method, device, computer program product and electronic device to solve the problem of low efficiency of code generation in related technologies.

[0008] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for generating a code is provided. The method comprises: obtaining M communication matrix description files of a control unit, parsing each communication matrix description file, and obtaining M model data, wherein each communication matrix description file is obtained by parsing a bus database file in the control unit, and each model data is used to characterize the information of the vehicle-mounted software associated with the control unit, and M is a positive integer; constructing a data module according to the M model data to obtain N data modules, wherein each data module characterizes the information of the vehicle-mounted software, and N is a positive integer; using the M model data to update the software components of the control unit to obtain component files, and using the N data modules and component files to generate target codes, wherein the component files characterize the information of the vehicle-mounted software, and when the target code is obtained, running the control unit based on the target code, and running the vehicle-mounted software during the communication process of the control unit.

[0009] Furthermore, constructing a data module based on the M model data to obtain N data modules includes: obtaining a preset module list, wherein the preset module list includes information of a model data set required to construct each data module; grouping the M model data according to the preset module list to obtain N groups of model data sets, wherein each group of model data sets includes at least one model data; obtaining a preset data module, and configuring the preset data module using each group of model data sets to obtain N data modules.

[0010] Furthermore, the N data modules include a first data module, a second data module and a third data module, and each group of model data sets is used to configure the preset data module to obtain the N data modules, including: obtaining a module configuration list, screening Y groups of model data sets from the N groups of model data sets according to the module configuration list, and configuring the Y groups of model data sets to obtain the first data module, wherein the module configuration list includes multiple data modules and the association relationship of the model data sets required for each data module, Y is less than N, and Y is a positive integer; obtaining module information associated with the first data module to obtain the first module information; obtaining K groups of model data sets from the N groups of model data sets, and performing module configuration using the first module information and the K groups of model data sets to obtain the second data module, wherein K is less than N, and K is a positive integer; and configuring the second data module and the N groups of model data sets to obtain the third data module.

[0011] Furthermore, configuring the third data module using the second data module and N groups of model data sets includes: obtaining module information associated with the second data module to obtain second module information; screening L groups of model data sets from the N groups of model data sets according to the module configuration list, constructing the second module information and the L groups of model data sets to obtain the third data module, wherein L is less than N and L is a positive integer.

[0012] Furthermore, the target code includes embedded code, and generating the target code using N data modules and component files includes: using N data modules to configure the format file to obtain a first preset format file; inputting the first preset format file into a verifier, and using the verifier to extract information from the first preset format file to obtain target information; generating a first processing file based on the target information, inputting the first processing file into a generator, and outputting the embedded code.

[0013] Furthermore, the target code includes standardized software code, and generating the target code using N data modules and component files includes: obtaining a code configuration file associated with the embedded code; importing the component file and the code configuration file into a code compiler, and outputting the standardized software code.

[0014] Furthermore, after generating the target code using N data modules and component files, the method also includes: obtaining a second preset format file from the software component layer associated with the control unit, importing the second preset format file into a code compiler to obtain a logic code, wherein the logic code refers to the code for processing data and controlling the flow in the control unit; obtaining a microcontroller code associated with the control unit, integrating and compiling the target code, the microcontroller code and the logic code to obtain an execution file of the control unit.

[0015] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a code generation device is provided. The device comprises: a first acquisition unit, used to acquire M communication matrix description files of a control unit, parse each communication matrix description file, and obtain M model data, wherein each communication matrix description file is obtained by parsing a bus database file in the control unit, and each model data is used to characterize the information of the vehicle-mounted software associated with the control unit, and M is a positive integer; a construction unit, used to construct a data module according to the M model data, and obtain N data modules, wherein each data module characterizes the information of the vehicle-mounted software, and N is a positive integer; an update unit, used to update the software components of the control unit using the M model data, and obtain component files, and generate target codes using the N data modules and component files, wherein the component files characterize the information of the vehicle-mounted software, and when the target code is obtained, the control unit is run based on the target code, and the vehicle-mounted software is run during the communication process of the control unit.

[0016] According to another aspect of an embodiment of the present invention, a computer storage medium is provided. The computer storage medium is used to store a program. When the program is running, the device where the computer storage medium is located is controlled to execute a code generation method.

[0017] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising one or more processors and a memory; the memory stores computer-readable instructions, and the processor is used to run the computer-readable instructions, wherein a method for generating a code is executed when the computer-readable instructions are run.

[0018] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, a method for generating a code is executed.

[0019] Through the present application, the following steps are adopted: obtaining M communication matrix description files of the control unit, parsing each communication matrix description file, and obtaining M model data, wherein each communication matrix description file is obtained by parsing the bus database file in the control unit, and each model data is used to characterize the information of the vehicle-mounted software associated with the control unit, and M is a positive integer; constructing a data module according to the M model data to obtain N data modules, wherein each data module represents the information of the vehicle-mounted software, and N is a positive integer; using the M model data to update the software components of the control unit to obtain component files, and using the N data modules and component files to generate target codes, wherein the component files represent the information of the vehicle-mounted software, and when the target code is obtained, the control unit is run based on the target code, and the vehicle-mounted software is run during the communication process of the control unit, thereby solving the problem of low efficiency of code generation in the related art, by obtaining the communication matrix description file of the control unit, parsing each communication matrix description file to obtain the corresponding model data, such as model data to construct data modules and component files, and then using the data modules and component files to generate target codes, thereby achieving the effect of improving code development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0021] Figure 1 is a flowchart of a method for generating a code according to an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a method for generating an embedded code according to an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of an optional code generation method provided according to an embodiment of the present application;

[0024] Figure 4 is a schematic diagram of a code generation device provided according to an embodiment of the present application;

[0025] Figure 5 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

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

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0030] It should be noted that the collected information used in this application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse to use it.

[0031] The present invention is described below in conjunction with preferred implementation steps. Figure 1 is a flowchart of a method for generating a code according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:

[0032] Step S101, obtain M communication matrix description files of the control unit, parse each communication matrix description file, and obtain M model data, wherein each communication matrix description file is obtained by parsing the bus database file in the control unit, and each model data is used to characterize the information of the vehicle software associated with the control unit, and M is a positive integer.

[0033] Specifically, the control unit refers to an electronic control unit (ECU: Electronic Control Unit). First, multiple communication matrix description files are obtained from the electronic control unit of the vehicle. These files contain content parsed from the bus database file (DBC: Database Container). For example, the communication matrix description file can be an ARXML file containing AUTOSAR model structure data such as CanCluster, EcuInstance, CanFrame, NmConfig, NmPdu, SystemSignal, etc. (that is, different model data). Then different model data can be parsed from it, and then different data modules can be constructed using the model data.

[0034] Step S102 , constructing data modules according to the M model data to obtain N data modules, wherein each data module represents information of the vehicle-mounted software, and N is a positive integer.

[0035] Specifically, after obtaining the model data in each communication matrix description file, different data modules can be constructed based on the model data. For example, the data modules can be CanNm, PduR, CanIf, CanSM, Com, Nm, ComM, etc., and the "ComSystem Templatesystem SignalRef" parameter in the ComSignal container in the COM module can be associated with the "ISignalToIPduMapping" of the communication matrix description, which can help to open up the application layer, RTE, and BSW layers, thereby ensuring the coordination and consistency of BSW and RTE code generation.

[0036] Step S103, using M model data to update the software components of the control unit, obtain component files, and generate target codes using N data modules and component files, wherein the component files represent information of the vehicle-mounted software, and when the target code is obtained, the control unit is run based on the target code, and the vehicle-mounted software is run during the communication process of the control unit.

[0037] Specifically, after obtaining multiple model data, these model data can be used to design software components and output component files of software components. When the communication matrix changes, the model data in the communication matrix description file can be quickly parsed to update the system mapping related to the ECU (Electronic Control Unit) software and the BSW (Basic Software) module configuration data related to the CAN communication protocol stack. Verification and code generation can be directly performed without manual configuration adjustments by engineers, thereby improving development efficiency.

[0038] The code generation method provided in the embodiment of the present application obtains M communication matrix description files of the control unit, parses each communication matrix description file, and obtains M model data, wherein each communication matrix description file is obtained by parsing the bus database file in the control unit, and each model data is used to represent the information of the vehicle-mounted software associated with the control unit, and M is a positive integer; constructs a data module according to the M model data to obtain N data modules, wherein each data module represents the information of the vehicle-mounted software, and N is a positive integer; uses the M model data to update the software components of the control unit to obtain component files, and generates target codes using the N data modules and component files, wherein the component files represent the information of the vehicle-mounted software. When the target code is obtained, the control unit is run based on the target code, and the vehicle-mounted software is run during the communication process of the control unit, thereby solving the problem of low efficiency of code generation in the related art, and obtaining the communication matrix description file of the control unit, parsing each communication matrix description file to obtain the corresponding model data, such as model data to construct data modules and component files, and then using the data modules and component files to generate target code, thereby achieving the effect of improving code development efficiency.

[0039] Optionally, in the code generation method provided in the embodiment of the present application, constructing a data module according to M model data to obtain N data modules includes: obtaining a preset module list, wherein the preset module list includes information of a model data set required to construct each data module; grouping the M model data according to the preset module list to obtain N groups of model data sets, wherein each group of model data sets includes at least one model data; obtaining a preset data module, and configuring the preset data module using each group of model data sets to obtain N data modules.

[0040] Specifically, the preset module list includes data information for generating various data modules. For example, when the data module is a Com module, the list records the information of model data such as EcuInstance, CanFrame, CanCluster, etc. required to build the data module; when the data module is an EcuC module, the above list records the information of model data such as EcuInstance, NmConfig, CanFrame, CanCluster, etc. required to build the data module; when the data module is a CanIf module, the above list records the information of model data such as EcuInstance, NmConfig, CanCluster, NmPdu, etc. required to build the data module.

[0041] After obtaining the preset module list, all model data can be divided according to the list to generate model data sets corresponding to each data module, and then the preset data modules can be configured based on these model data sets to obtain different data modules. This embodiment provides support for data analysis and application by managing model data.

[0042] Different data modules are constructed in different ways. Optionally, in the code generation method provided in the embodiment of the present application, N data modules include a first data module, a second data module and a third data module. Each group of model data sets is used to configure the preset data module to obtain N data modules, including: obtaining a module configuration list, screening Y groups of model data sets from N groups of model data sets according to the module configuration list, and configuring the Y groups of model data sets to obtain a first data module, wherein the module configuration list includes multiple data modules and an association relationship between the model data sets required for each data module, Y is less than N, and Y is a positive integer; obtaining module information associated with the first data module to obtain first module information; obtaining K groups of model data sets from the N groups of model data sets, and performing module configuration using the first module information and the K groups of model data sets to obtain a second data module, wherein K is less than N, and K is a positive integer; and configuring the second data module and the N groups of model data sets to obtain a third data module.

[0043] It should be noted that the data module can be divided into a first data module, a second data module and a third data module according to the required model data. For example, the first data module only needs multiple model data to be constructed, and when configuring the second data module, the module information of the first data module is also required for auxiliary construction. Therefore, the first data module can include an EcuC module and a ComM module, and the second data module can include a Com module, a CanIf module, an Nm module and a CanNm module.

[0044] Specifically, when the EcuC module is constructed using the model data set, the above model data can be obtained from the model data set containing model data such as EcuInstance, NmConfig, CanFrame, CanCluster, etc. according to the module configuration list, and then a global PDU (Protocol Data Unit) is created based on the model data, and the global PDU is used as the internal parameter of the local PDU to obtain the above first data module; when the ComM module is constructed using the model data set, the above model data can be obtained from the model data set containing the EcuInstance model data, and the ComM module can be constructed using the model data, wherein ComMChannel contains the configuration parameters of the bus channel.

[0045] After obtaining the first data module, the module information of the first data module is obtained, and then the module information and the model data set are used to configure the second data module: when constructing the Com module, the model data is first obtained from the model data set containing model data such as EcuInstance, CanFrame, CanCluster, etc., and the module information of the constructed EcuC module is obtained at the same time, and the Com I-PDU transmission direction (Com IPduDirection), signal processing method (ComIPduSignalProcessing), type (Com IPduSignalRef), I-PDU working group (ComIPduGroupRef), Com signal reference (Com IPduSignalRef), global PDU reference (Com PduIdRef), etc. are processed to obtain the Com module.

[0046] When constructing the CanIf module, first obtain the model data from the model data set containing the model data such as EcuInstance, NmConfig, CanCluster, and NmPdu, and obtain the module information of the constructed EcuC module, and then construct the CanIf module based on these data; when constructing the Nm module, obtain the model data from the model data set containing the EcuInstance model data, and obtain the module information of the constructed ComM module, and then construct the Nm module based on these data; when constructing the CanNm module, obtain the model data from the model data set containing the EcuInstance, CanCluster, and other model data, and after obtaining the module information of the constructed EcuC module and the ComM module, use these data to construct the CanNm module. Finally, configure the third data module based on the module information of the second data module and the model data set. This embodiment lays the foundation for generating target code by constructing different data modules using model data sets.

[0047] When configuring the third data module, the module information of the second data module is also required for auxiliary operations. Optionally, in the code generation method provided in the embodiment of the present application, the third data module is obtained by configuring the second data module and N groups of model data sets, including: obtaining module information associated with the second data module to obtain second module information; screening L groups of model data sets from N groups of model data sets according to the module configuration list, constructing the second module information and L groups of model data sets to obtain the third data module, wherein L is less than N and L is a positive integer.

[0048] Specifically, the third data module may include a PduR module and a CanSM module. When the PduR module is constructed using a model data set, the model data is obtained from the model data set containing model data such as EcuInstance, CanFrame, and CanCluster. After obtaining the module information of the constructed EcuC module, CanIf module, and Com module, these data are used to associate Pdu, PduRRoutingPath, etc. in EcuC with PduRDestPduRef / PduRSrcPduRef, and then the PduR module is constructed. When the CanSM module is constructed, the model data is obtained from the model data set containing the EcuInstance model data, and the module information of the constructed CanIf module and ComM module is obtained, and then the CanSM module is constructed based on these data. This embodiment can improve development efficiency by configuring the third data module using the module information of the first data module, the module information of the second data module, and the model data set, and then using the above data modules to generate target code.

[0049] The target code includes multiple types. Optionally, in the code generation method provided in the embodiment of the present application, the target code includes an embedded code. Generating the target code using N data modules and component files includes: configuring a format file using N data modules to obtain a first preset format file; inputting the first preset format file into a verifier, and using the verifier to extract information from the first preset format file to obtain target information; generating a first processing file based on the target information, inputting the first processing file into a generator, and outputting an embedded code.

[0050] Furthermore, the target code includes standardized software code, and generating the target code using N data modules and component files includes: obtaining a code configuration file associated with the embedded code; importing the component file and the code configuration file into a code compiler, and outputting the standardized software code.

[0051] Specifically, embedded code can refer to RTE (Real-Time Execution) code, which can process real-time data and events as code in a real-time system. When the RTE code is generated using a data module, Figure 2 is a schematic diagram of a method for generating an embedded code according to an embodiment of the present application, such as Figure 2 As shown, firstly, the data module can be used to configure the format file, thereby obtaining a first preset format file (ie, an ARXML file).

[0052] Furthermore, the first preset format file is sequentially input into the validator and the generator, and then the generator can output the embedded code, and implement specific functions based on the code. This embodiment generates the embedded code by using the data module, thereby improving the reliability and performance of the system.

[0053] Optionally, in the code generation method provided in the embodiment of the present application, the target code includes standardized software code, and generating the target code using N data modules and component files includes: obtaining a code configuration file associated with the embedded code; importing the component file and the code configuration file into a code compiler, and outputting the standardized software code.

[0054] Specifically, standardized software code refers to BSW (Basic Software) code, which can be used as standardized software components for automotive electronic systems. The BSW code includes basic functional modules, such as communication protocol stacks, diagnostic functions, operating systems, etc., and can support the development and integration of automotive electronic systems.

[0055] In order to generate standardized software code, the model data can be used to update the software components of the control unit first, that is, to obtain the communication port sending data DataProtoptype from the component in the software component design, and then parse the system signal SystemSignal from the communication matrix description file, and use the above data to match and update it to SystemMapping, and then obtain the component file.

[0056] Further, after obtaining the code configuration file associated with the embedded code, the component file and the code configuration file are imported into the code compiler, and the compiler optimizes and adjusts the code according to the settings in the configuration file, thereby obtaining the standardized software code. This embodiment can ensure that the generated software code correctly interacts with the hardware device by using the component file and the code configuration file to produce the standardized software code, so that the software can be developed and deployed more efficiently, and at the same time ensure that the software can run correctly on the target device.

[0057] Optionally, in the code generation method provided in the embodiment of the present application, after generating the target code using N data modules and component files, the method also includes: obtaining a second preset format file from the software component layer associated with the control unit, importing the second preset format file into the code compiler to obtain a logic code, wherein the logic code refers to the code for processing data and control flow in the control unit; obtaining a microcontroller code associated with the control unit, integrating and compiling the target code, the microcontroller code and the logic code to obtain an execution file of the control unit.

[0058] Specifically, after using the data module to generate the target code, you can also control the control unit to obtain a second preset format file in the software component layer, import the second preset format file into the code compiler to obtain the logic code, and then after obtaining the microcontroller code MCAL (Microcontroller Abstraction Layer) code, integrate and compile and link the application layer algorithm, target code, MCAL code and logic code to form an executable file, and run the executable file on the control unit.

[0059] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0060] The present application also provides a method for generating a code. Figure 3 is a schematic diagram of an optional code generation method provided according to an embodiment of the present application, such as Figure 3 As shown, the method includes:

[0061] First, multiple communication matrix description files are obtained from the vehicle's electronic control unit. These files contain the content parsed from the DBC (Database Container) file, and then different model data can be parsed from them, and then different data modules can be constructed using the model data. While obtaining multiple model data, these model data can be used for software component design. First, the model data can be used to update the software components of the control unit, that is, to obtain the communication port sending data DataProtoptype from the components in the software component design, and then parse the system signal SystemSignal from the communication matrix description file, and use the above data to match and update it to SystemMapping, and then obtain the component file.

[0062] Furthermore, the data module can be used to configure the format file to obtain a first preset format file (i.e., an ARXML file), and then the first preset format file is input into the Validator and the Generator in sequence, so that the generator can output the embedded code (i.e., the RTE code); after obtaining the code configuration file associated with the embedded code, the above-mentioned component files and the code configuration file are imported into the code compiler, and the compiler optimizes and adjusts the code according to the settings in the configuration file, so as to obtain the standardized software code (i.e., the BSW code).

[0063] This embodiment obtains the communication matrix description file of the control unit, parses each communication matrix description file to obtain corresponding model data, such as model data to construct data modules and component files, and then uses the data modules and component files to generate target code, thereby achieving the effect of improving code development efficiency.

[0064] The embodiment of the present application also provides a device for generating a code. It should be noted that the device for generating a code in the embodiment of the present application can be used to execute the method for generating a code provided in the embodiment of the present application. The device for generating a code provided in the embodiment of the present application is introduced below.

[0065] Figure 4 is a schematic diagram of a code generation device provided according to an embodiment of the present application, such as Figure 4 As shown, the device includes: a first acquisition unit 40, a construction unit 41, and an update unit 42.

[0066] A first acquisition unit 40 is used to acquire M communication matrix description files of the control unit, parse each communication matrix description file, and obtain M model data, wherein each communication matrix description file is obtained by parsing a bus database file in the control unit, each model data is used to represent information of the vehicle software associated with the control unit, and M is a positive integer;

[0067] A construction unit 41 is used to construct a data module according to the M model data to obtain N data modules, wherein each data module represents information of the vehicle-mounted software, and N is a positive integer;

[0068] The updating unit 42 is used to update the software components of the control unit using M model data to obtain component files, and generate target codes using N data modules and component files, wherein the component files represent information of the vehicle-mounted software, and when the target codes are obtained, the control unit is run based on the target codes, and the vehicle-mounted software is run during the communication process of the control unit.

[0069] The code generation device provided in the embodiment of the present application obtains M communication matrix description files of the control unit through the first acquisition unit 40, parses each communication matrix description file, and obtains M model data, wherein each model data is used to represent the information of the vehicle-mounted software associated with the control unit, and M is a positive integer; the construction unit 41 constructs a data module according to the M model data to obtain N data modules, wherein each communication matrix description file is obtained by parsing the bus database file in the control unit, each data module represents the information of the vehicle-mounted software, and N is a positive integer; the update unit 42 uses the M model data to update the software components of the control unit to obtain component files, and generates target code using N data modules and component files, wherein the component files represent the information of the vehicle-mounted software, and when the target code is obtained, the control unit is run based on the target code, and the vehicle-mounted software is run during the communication process of the control unit, thereby solving the problem of low efficiency of code generation in the related art, by obtaining the communication matrix description file of the control unit, parsing each communication matrix description file to obtain the corresponding model data, such as model data to construct data modules and component files, and then using the data modules and component files to generate target code, thereby achieving the effect of improving code development efficiency.

[0070] Optionally, in the code generation device provided in the embodiment of the present application, the construction unit 41 includes: a first acquisition module, used to obtain a preset module list, wherein the preset module list includes information of a model data set required to construct each data module; a division module, used to group M model data according to the preset module list to obtain N groups of model data sets, wherein each group of model data sets includes at least one model data; a second acquisition module, used to obtain preset data modules, and configure the preset data modules using each group of model data sets to obtain N data modules.

[0071] Optionally, in the code generation device provided in the embodiment of the present application, the construction unit 41 includes: a third acquisition module, used to obtain a module configuration list, screen Y groups of model data sets from N groups of model data sets according to the module configuration list, and configure the Y groups of model data sets to obtain a first data module, wherein the module configuration list includes multiple data modules and an association relationship between the model data sets required for each data module, Y is less than N, and Y is a positive integer; a fourth acquisition module, used to obtain module information associated with the first data module to obtain first module information; a fifth acquisition module, used to obtain K groups of model data sets from the N groups of model data sets, and perform module configuration using the first module information and the K groups of model data sets to obtain a second data module, wherein K is less than N, and K is a positive integer; and a first configuration module, used to configure the second data module and the N groups of model data sets to obtain a third data module.

[0072] Optionally, in the code generation device provided in the embodiment of the present application, the construction unit 41 includes: a sixth acquisition module, used to obtain module information associated with the second data module to obtain the second module information; a screening module, used to screen L groups of model data sets from N groups of model data sets according to the module configuration list, and construct the second module information and the L groups of model data sets to obtain a third data module, wherein L is less than N and L is a positive integer.

[0073] Optionally, in the code generation device provided in the embodiment of the present application, the update unit 42 includes: a second configuration module, used to use N data modules to configure the format file to obtain a first preset format file; an input module, used to input the first preset format file into a verifier, and use the verifier to extract information from the first preset format file to obtain target information; a generation module, used to generate a first processing file based on the target information, input the first processing file into the generator, and output the embedded code.

[0074] Optionally, in the code generation device provided in the embodiment of the present application, the update unit 42 includes: a seventh acquisition module, used to obtain a code configuration file associated with the embedded code; an import module, used to import component files and code configuration files into a code compiler to output standardized software code.

[0075] Optionally, in the code generation device provided in the embodiment of the present application, the device also includes: a second acquisition unit, which is used to obtain a second preset format file from the software component layer associated with the control unit after generating the target code using N data modules and component files, and import the second preset format file into the code compiler to obtain a logic code, wherein the logic code refers to the code for processing data and control flow in the control unit; a third acquisition unit, which is used to obtain a micro-control code associated with the control unit, and integrate and compile the target code, the micro-control code and the logic code to obtain an execution file of the control unit.

[0076] The device for generating the above code includes a processor and a memory. The above first acquisition unit 40, construction unit 41, update unit 42, etc. are all stored in the memory as program units, and the processor executes the above program units stored in the memory to implement corresponding functions.

[0077] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the problem of low efficiency of code generation in the related art can be solved by adjusting kernel parameters.

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

[0079] An embodiment of the present invention provides a computer storage medium, which is used to store a program. When the program is running, the device where the computer storage medium is located is controlled to execute a code generation method.

[0080] Figure 5 is a schematic diagram of an electronic device provided according to an embodiment of the present application, such as Figure 5 As shown, an embodiment of the present invention provides an electronic device, the electronic device 50 includes a processor, a memory, and a program stored in the memory and executable on the processor, the processor is used to execute computer-readable instructions, wherein the computer-readable instructions execute a method for generating a code when they are executed. The device in this article can be a server, a PC, a PAD, a mobile phone, etc.

[0081] The present application also provides a computer program product, including a computer program, which implements the steps of a code generation method in each embodiment of the present application when the computer program is executed by a processor.

[0082] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0083] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0084] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.

[0085] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0086] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0087] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0088] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0089] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0090] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for generating a code, characterized in that: include: Acquire M communication matrix description files of the control unit, parse each communication matrix description file, and obtain M model data, wherein each communication matrix description file is obtained by parsing a bus database file in the control unit, each model data is used to characterize information of the vehicle software associated with the control unit, and M is a positive integer; Constructing a data module according to the M model data to obtain N data modules, wherein each data module represents information of the vehicle-mounted software, and N is a positive integer; The software components of the control unit are updated using the M model data to obtain component files, and target codes are generated using the N data modules and the component files, wherein the component files represent information of the vehicle-mounted software. When the target codes are obtained, the control unit is run based on the target codes, and the vehicle-mounted software is run during the communication process of the control unit.

2. The method according to claim 1, characterized in that The data modules are constructed according to the M model data to obtain N data modules including: Obtaining a preset module list, wherein the preset module list includes information of a model data set required to construct each data module; Grouping the M model data according to the preset module list to obtain N groups of model data sets, wherein each group of model data sets includes at least one model data; A preset data module is obtained, and each set of model data sets is used to configure the preset data module to obtain the N data modules.

3. The method according to claim 2, characterized in that The N data modules include a first data module, a second data module and a third data module. The preset data modules are configured using each set of model data sets, and the N data modules include: Obtain a module configuration list, select Y groups of model data sets from the N groups of model data sets according to the module configuration list, and configure the Y groups of model data sets to obtain a first data module, wherein the module configuration list includes a plurality of data modules and an association relationship between model data sets required by each data module, Y is less than N, and Y is a positive integer; Acquire module information associated with the first data module to obtain first module information; Acquire K groups of model data sets from the N groups of model data sets, perform module configuration using the first module information and the K groups of model data sets to obtain the second data module, wherein K is less than N, K is a positive integer; The third data module is obtained by configuring the second data module and the N groups of model data sets.

4. The method according to claim 3, characterized in that Utilizing the second data module and the N groups of model data sets to configure the third data module includes: Acquire module information associated with the second data module to obtain second module information; According to the module configuration list, L groups of model data sets are selected from the N groups of model data sets, and the second module information and the L groups of model data sets are constructed to obtain the third data module, wherein L is less than N and L is a positive integer.

5. The method according to claim 1, characterized in that The target code includes an embedded code, and generating the target code using the N data modules and the component files includes: Using the N data modules to configure the format file, a first preset format file is obtained; Inputting the first preset format file into a verifier, and using the verifier to extract information from the first preset format file to obtain target information; A first processing file is generated based on the target information, the first processing file is input into a generator, and the embedded code is output.

6. The method according to claim 5, characterized in that The target code includes standardized software code, and generating the target code using the N data modules and the component files includes: Obtaining a code configuration file associated with the embedded code; The component files and the code configuration file are imported into a code compiler to output the standardized software code.

7. The method according to claim 1, characterized in that After generating the target code using the N data modules and the component files, the method further includes: Obtaining a second preset format file from a software component layer associated with the control unit, and importing the second preset format file into a code compiler to obtain a logic code, wherein the logic code refers to a code for processing data and controlling a flow in the control unit; The microcontrol code associated with the control unit is obtained, and the target code, the microcontrol code and the logic code are integrated and compiled to obtain an execution file of the control unit.

8. A code generating device, characterized in that: include: A first acquisition unit is used to acquire M communication matrix description files of the control unit, parse each communication matrix description file, and obtain M model data, wherein each communication matrix description file is obtained by parsing a bus database file in the control unit, each model data is used to characterize information of the vehicle software associated with the control unit, and M is a positive integer; A construction unit, configured to construct a data module according to the M model data to obtain N data modules, wherein each data module represents information of the vehicle-mounted software, and N is a positive integer; An updating unit is used to update the software components of the control unit using the M model data to obtain component files, and generate target codes using the N data modules and the component files, wherein the component files represent information of the vehicle-mounted software, and when the target code is obtained, the control unit is run based on the target code, and the vehicle-mounted software is run during the communication process of the control unit.

9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the code generation method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the code generation method described in any one of claims 1 to 7.

Citation Information

Cited By

  • Generation method of application layer communication component in vehicle-mounted electronic control unit (ECU)

    CN121255150A

  • A method for generating an application layer communication component in an electronic control unit (ECU) of a vehicle

    CN121255150B