Methods, apparatus, storage media and electronic devices for automatic generation of vehicle control codes
By receiving code generation data from the vehicle control unit and using the target function interface to automatically process code generation, the problem of low compatibility and cumbersome operation in the existing vehicle control code generation process is solved, and efficient and accurate code generation is achieved.
Patent Information
- Application Number
- CN202211017489.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-23
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-08-23
AI Technical Summary
In existing technologies, the process of generating vehicle control codes suffers from low compatibility, cumbersome operation, susceptibility to human error, and low generation efficiency and accuracy, especially when operating through a graphical interface, making it difficult to generate codes efficiently.
By receiving code generation data from the vehicle control unit, the code generation is automated using the target function interface. This includes first instruction parameters representing the system description file and second instruction parameters representing the configuration module information. The target control code file is generated based on preset standard document verification and code templates, reducing manual intervention and improving code generation efficiency and accuracy.
It enables efficient and accurate generation of vehicle control codes, reduces the complexity of manual operation and the consumption of system resources, and improves the efficiency and accuracy of code generation.
Smart Images

Figure CN115437617B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of intelligent vehicle software development technology, and in particular to methods, apparatus, storage media and electronic devices for automatically generating vehicle control codes. Background Technology
[0002] As people's demands for automotive performance continue to increase, the quantity and quality of vehicle control code are also constantly rising. The generation of control code for onboard control units generally utilizes a unified development platform for code development and configuration to achieve the generation of various Electronic Control Unit (ECU) related parameters, verification, and executable code.
[0003] Unified development platforms typically utilize configuration tools provided by software vendors to generate configuration description documents for electronic control units (ECUs). However, these configuration description documents often exhibit standard discrepancies, leading to low compatibility. Furthermore, configuration tools are generally based on graphical user interfaces (GUIs), requiring prior configuration and verification of each module before triggering corresponding buttons for code generation. GUIs demand significant computing power for graphical processing, and their fragmented display and operation result in disjointed information and low execution efficiency. Additionally, the simultaneous display of numerous operable areas on the GUI necessitates multiple clicks to complete code generation commands, making the process cumbersome, prone to human error, and ultimately resulting in low code generation efficiency and accuracy. Summary of the Invention
[0004] To address at least one of the aforementioned technical problems, this disclosure provides a method, apparatus, storage medium, and electronic device for automatically generating vehicle control codes.
[0005] According to one aspect of this disclosure, a method for automatically generating vehicle control codes is provided, comprising:
[0006] Based on the target function interface, at least one set of code generation data is received from the vehicle control unit. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter is used to characterize the storage information of the system description file of the vehicle control unit. The second instruction parameter includes the configuration module information required to generate the target control code file. The system description file is used to describe the system module information corresponding to the vehicle control unit.
[0007] Obtain the system description file corresponding to the first instruction parameter;
[0008] Based on the system description file corresponding to the first instruction parameter and the second instruction parameter, code generation processing is performed to obtain the target control code file for each of the at least one set of code generation data.
[0009] In some possible implementations, the step of performing code generation processing based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code files for each of the at least one set of code generation data includes:
[0010] The system description file is parsed to obtain the system module information included in the system description file;
[0011] If the system module information matches the configuration module information included in the second instruction parameter, obtain the configuration module data corresponding to the configuration module information;
[0012] Verify whether the configuration module data corresponding to the configuration module information is normal based on the preset standard document;
[0013] If normal, the configuration module data is processed to generate code based on the preset code template to obtain the target control code file.
[0014] In some possible implementations, before obtaining the configuration module data corresponding to the configuration module information if the system module information matches the configuration module information included in the second instruction parameter, the method further includes:
[0015] The parameter status of the second instruction parameter is detected to obtain the parameter status detection result;
[0016] If the parameter status detection result indicates that the parameter status is not empty, the step of obtaining the configuration module data corresponding to the configuration module information is triggered if the system module information matches the configuration module information included in the second instruction parameter.
[0017] In some possible implementations, the method further includes:
[0018] If the parameter status detection result is that the parameter status is empty, obtain the configuration module data corresponding to the system module information;
[0019] Verify whether the configuration module data corresponding to the system module information is normal based on the preset standard document;
[0020] If normal, the system module information corresponding to the configuration module data is processed by code generation based on the preset code template to obtain the target control code file.
[0021] In some possible implementations, the code generation data further includes a third instruction parameter, which represents the target path information of the target control code file. After performing code generation processing based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code files for each of the at least one set of code generation data, the method further includes:
[0022] Based on the third instruction parameter, the target control code file is stored in the storage location corresponding to the target path information.
[0023] In some possible implementations, the code generation data further includes a fourth instruction parameter, which includes application information, and after receiving at least one set of code generation data from the vehicle control unit based on the target function interface, it further includes:
[0024] The target application corresponding to the fourth instruction parameter is determined based on the application information;
[0025] Launch the target application;
[0026] The code generation process based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code files for each of the at least one set of code generation data includes:
[0027] The target application performs code generation processing on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code file for each of the at least one set of code generation data.
[0028] In some possible implementations, the method further includes:
[0029] The path status of the file path corresponding to the target path information of the third instruction parameter is detected to obtain the path status detection result;
[0030] If the path status detection result is normal, the step of obtaining the system description file corresponding to the first instruction parameter is triggered.
[0031] According to a second aspect of this disclosure, an apparatus for automatically generating vehicle control codes is provided, the apparatus comprising:
[0032] The code generation data receiving module is used to receive at least one set of code generation data from the vehicle control unit based on the target function interface. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter is used to characterize the storage information of the system description file of the vehicle control unit. The second instruction parameter includes the configuration module information required to generate the target control code file. The system description file is used to describe the system module information corresponding to the vehicle control unit.
[0033] The system description file acquisition module is used to acquire the system description file corresponding to the first instruction parameter;
[0034] The code generation module is used to perform code generation processing based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code file of each of the at least one set of code generation data.
[0035] According to a third aspect of this disclosure, an electronic device is provided, including at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the vehicle control code automatic generation method as described in any one of the first aspects by executing the instructions stored in the memory.
[0036] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided that stores at least one instruction or at least one program, said instruction or program being loaded and executed by a processor to implement the automatic vehicle control code generation method as described in any of the first aspects.
[0037] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure.
[0038] Implementing this disclosure has the following beneficial effects:
[0039] The technical solution of this application receives at least one set of code generation data from an on-board control unit via a target function interface. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter represents the storage information of the system description file of the on-board control unit, and the second instruction parameter includes configuration module information required to generate the target control code file. The system description file describes the system module information corresponding to the on-board control unit. By using code generation data with multiple command parameters to input the target control code generation instruction at once, the system avoids interruptions and human errors caused by multiple clicks, reducing manual intervention and improving the accuracy and efficiency of vehicle control code generation. The system description file corresponding to the first instruction parameter is obtained, and it can automatically parse and identify system description files under any path. Based on the system description file corresponding to the first instruction parameter and the second instruction parameter, code generation processing is performed to obtain the target control code files for each of the at least one set of code generation data. Control code is generated using one set of code generation data. This approach does not require much computing power to process graphics; it only requires focusing on the core logic of code generation. System resources are used more efficiently, ensuring the normal operation of other system functions and improving code generation efficiency.
[0040] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0041] To more clearly illustrate the technical solutions and advantages in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This diagram illustrates a structural schematic of an implementation environment according to an embodiment of the present disclosure;
[0043] Figure 2 A flowchart illustrating an automatic vehicle control code generation method according to an embodiment of the present disclosure is shown.
[0044] Figure 3 A flowchart illustrating a first method for generating target control code files according to an embodiment of the present disclosure is shown.
[0045] Figure 4 A flowchart illustrating a state detection method for a second instruction parameter according to an embodiment of the present disclosure is shown.
[0046] Figure 5A flowchart illustrating a second method for generating target control code files according to an embodiment of this disclosure is shown.
[0047] Figure 6 A flowchart illustrating a third instruction parameter detection method according to an embodiment of the present disclosure is shown.
[0048] Figure 7 A schematic diagram of the structure of a vehicle control code automatic generation device according to an embodiment of the present disclosure is shown.
[0049] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is shown; Detailed Implementation
[0050] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0051] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0052] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.
[0053] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.
[0054] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0055] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.
[0056] The AUTOSAR Classic Platform (AUTOSAR CP) primarily focuses on the Electronic Control Unit (ECU) of the control system. The software architecture defined in AUTOSAR CP has a three-layer structure: Application Software Layer (ASW), Runtime Environment (RTE), and Basic Software Layer (BSW). The BSW provides the functionalities typically used by the ECU. Configuration of the Basic Software Layer (BSW) generally utilizes BSW configuration tools provided by software vendors, rather than being developed by the automaker or supplier. During the BSW configuration phase, developers need to use BSW configuration tools to configure ECU parameters, verify, and generate executable code. However, each software vendor has its own BSW configuration tool. While all conform to the AUTOSAR standard, the generated ARXML files have minor differences, resulting in low compatibility and incomplete support for various AUTOSAR standard protocol stacks and sub-modules. Furthermore, BSW configuration tools are generally based on graphical user interfaces, which have their own drawbacks. Therefore, this disclosure directly utilizes the target function interface to automatically verify parameters and generate executable code, reducing manual intervention and improving the accuracy and efficiency of vehicle control code generation. For example... Figure 1As shown, the operating environment of this disclosure can be an operating system configured with a BSW configuration tool including the target function interface 1, an AUTOSAR Tool Platform (Artop) 2, a Java integrated development environment (Eclipse) basic platform 3, an Eclipse Modeling Framework (EMF) 4, and an xpand plugin 5 provided by the Eclipse platform.
[0057] Figure 2 This diagram illustrates a flowchart of an automatic vehicle control code generation method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the above method includes:
[0058] S101. Receive at least one set of code generation data from the vehicle control unit based on the target function interface. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter is used to characterize the storage information of the system description file of the vehicle control unit. The second instruction parameter includes the configuration module information required to generate the target control code file. The system description file is used to describe the system module information corresponding to the vehicle control unit.
[0059] The system obtains user-inputted code generation data using a specified tool, or obtains user-inputted code generation data acquisition instructions using a specified tool, to acquire a script file containing at least one set of code generation data. Each set of code generation data is acquired through the target function interface; the code generation data is a collection of command data used to automatically generate target control code.
[0060] The system receives one or more sets of code generation data through a target function interface. The target application is then determined based on this code generation data, and each set of code generation data is parsed by the target application. For example, the target function interface could be a command-line interface, obtaining a set of code generation data input by the user in a command-line tool. During execution, this code generation data is retrieved through the command-line interface. Alternatively, a specified script file can be invoked by inputting an instruction in the command-line tool, sequentially executing each set of code generation data in the script file until the target control code corresponding to each set of code generation data is generated.
[0061] The code generation data includes a first instruction parameter and a second instruction parameter, separated by a preset separator, exemplarily a space. The first instruction parameter includes the absolute path and filename of the system description file for the vehicle control unit. The system description file can be identified through the first instruction parameter. If the first instruction parameter is empty, or if the system description file is not found according to the first instruction parameter, the target application reports an error and indicates that the operation command is unrecognized. In one embodiment, the system description file includes system module information corresponding to the vehicle control unit configured by the user based on requirements and the ClassicAUTOSAR standard document. The file extension of the system description file can be ARXML. For example, the first instruction parameter is "D:\cmdgenerate\Config.arxml", where Config.arxml is the filename of the system description file, and D:\cmdgenerate is the absolute path of the system description file. The second instruction parameter includes configuration module information required to generate the target code file. The configuration module information includes at least one configuration module name. The configuration module is a module included in the CAN communication protocol stack, diagnostic protocol stack, calibration protocol stack, system protocol stack, memory protocol stack, system service protocol stack, and communication service protocol stack based on the Classic AUTOSAR standard. For example, the second instruction parameter is "PduR,Os,Com", which includes the PduR configuration module, the Os configuration module, and the Com configuration module.
[0062] S102. Obtain the system description file corresponding to the first instruction parameter;
[0063] The target application obtains the system description file based on the first instruction parameter, which includes the absolute path and name of the system description file.
[0064] The system description file directory is determined based on its absolute path, and the system description file corresponding to the first instruction parameter is determined based on its name.
[0065] S103. Based on the system description file corresponding to the first instruction parameter and the second instruction parameter, code generation processing is performed to obtain at least one set of target control code files for each set of code generation data.
[0066] If all system description files contain configuration modules corresponding to the second instruction parameters, the system description files are parsed based on the preset framework and preset meta-model, and the configuration modules required in the system description files are determined based on the second instruction parameters. Based on the configuration module information corresponding to the second instruction parameters in the system description files and the preset code template, the target control code file corresponding to each set of code generation data is generated.
[0067] For example, the AUTOSAR metamodel generated based on the EMF framework parses the system description file. The core EMF model, Ecore, implements reflective access and configuration of the AUTOSAR metamodel. Through the interface provided by Artop, the metamodel instance corresponding to the configuration module of the second instruction in the system description file parsing can be obtained. Artop implements the specific logic for AUTOSAR metamodel parsing. Based on the container and parameter definition information of the components stored under the EUC-MODULE-CONFIGURATION-VALUES tag structure of the metamodel instance, and combined with the xpand code template of the tool, the required target control code file is generated. xpand is a plugin provided by the Eclipse platform. For example, the target control code file can be a class code file with the .c or .h extension.
[0068] The AUTOSAR metamodel is inherited and extended from the EMF core model Ecore. Based on the first instruction parameter, it can parse and identify system description files conforming to the AUTOSAR standard in any path and form an AUTOSAR metamodel instance in memory, facilitating the processing of any system description file. Code generation for system description files is achieved through tool commands. Command scripts can be used to combine multiple commands for automated editing, reducing manual intervention and further improving the accuracy and efficiency of code generation.
[0069] Automating code generation from a single set of code-generated data saves system resources. Generating code using a graphical user interface (GUI) requires graphics processing, leading to numerous threads, high system resource consumption, and extremely low stack management efficiency during thread switching. Furthermore, GUI applications with many threads are unsuitable for using IP address identifiers to prevent thread interruptions, making code generation prone to blocking. In contrast, generating code from a single set of code-generated data requires minimal computational power for graphics processing, allowing the system to focus on the core logic of code generation. This results in more efficient use of system resources, ensuring the smooth operation of other system functions and preventing unresponsiveness due to thread blocking.
[0070] Please see Figure 3 In some embodiments, code generation processing is performed based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain at least one set of target control code files for each set of code generation data, including:
[0071] S1031. Parse the system description file to obtain the system module information included in the system description file;
[0072] S1033. If the system module information matches the configuration module information included in the second instruction parameter, obtain the configuration module data corresponding to the configuration module information;
[0073] S1035. Verify whether the configuration module data corresponding to the configuration module information is normal based on the preset standard document;
[0074] S1037. If normal, the configuration module data is processed by code generation based on the preset code template to obtain the target control code file.
[0075] Specifically, after the target application obtains the system description file based on the first instruction parameter, it parses the system module information included in the system description file to obtain the configuration module information corresponding to the second instruction parameter. The configuration module information includes at least one configuration module name. Based on the configuration module names, it determines whether all configuration module information corresponding to the second instruction parameter exists in the system description file. If any configuration module in the configuration module information does not exist in the system description file, an error is reported, indicating the existence of an unrecognized command. If the configuration module information corresponding to the second instruction parameter can be found in the system description file, the configuration module data corresponding to the configuration module information is obtained from the system description file. The configuration module data corresponding to the configuration module information is verified against a preset standard document to see if it conforms to the standard. If it does not conform to the standard, an error is reported, and a prompt to check the system description file is displayed. If the configuration module data corresponding to the configuration module information conforms to the standard, code generation processing is performed on the configuration module data based on a preset code template to obtain the target control code file.
[0076] For example, the first instruction parameter is "D:\cmdgenerate\Config.arxml", and the target application obtains the system description file Config.arxml based on the first instruction parameter; the second instruction parameter is "PduR,Os,Com", and the module configuration information, including the PduR module, Os module, and Com module, is obtained based on the second instruction parameter; it is determined whether the system description file Config.arxml includes the PduR module, Os module, and Com module. If any module does not exist in the system description file Config.arxml, an error is reported, indicating that the module does not exist. If the PduR module, Os module, and Com module are all included in the system description file Config.arxml, then the module configuration data corresponding to the module configuration information in the system description file Config.arxml is obtained based on the second instruction parameter, that is, the module configuration data corresponding to the PduR module, Os module, and Com module in the system description file Config.arxml is obtained, based on Classic The AUTOSAR standard document verifies whether the module configuration data corresponding to the PduR module, Os module, and Com module conforms to the standard. If it does not conform to the standard, an error is reported and a prompt is made to check the system description file. If it conforms to the standard, code generation processing is performed on the PduR module, Os module, and Com module based on the xpand code template to obtain the target control code file.
[0077] Each software provider has its own Basic Software Layer (BSW) configuration tool. Although they all conform to the Classic AUTOSAR standard, the generated system description files, such as general configuration files or database files, still have some minor differences and are not very compatible with each other. The Classic AUTOSAR standard does not fully support the various protocol stacks and subordinate modules. However, by using code generation data to automatically generate code, it is possible to verify the configuration module data corresponding to the configuration module information based on the preset standard documents. If it does not conform to the standard, it can promptly and specifically report errors, notify users to correct the errors in time, and improve the accuracy of the generated code.
[0078] Please see Figure 4 In some embodiments, before obtaining the configuration module data corresponding to the configuration module information if the system module information matches the configuration module information included in the second instruction parameter, the method further includes:
[0079] S1032. Detect the parameter status of the second instruction parameter and obtain the parameter status detection result;
[0080] S1034. If the parameter status detection result is that the parameter status is not empty, trigger the step of obtaining the configuration module data corresponding to the configuration module information if the system module information matches the configuration module information included in the second instruction parameter.
[0081] Specifically, the second instruction parameter needs to be checked to determine if it is empty. If the second instruction parameter is not empty, the configuration module information in the second instruction parameter is retrieved and matched with the system module information. This ensures that code can be generated correctly based on the code generation data, improving the accuracy of generating target control code files.
[0082] Please see Figure 5 In some embodiments, the method further includes:
[0083] S201. If the parameter status detection result is that the parameter status is empty, obtain the configuration module data corresponding to the system module information;
[0084] S202. Verify whether the configuration module data corresponding to the system module information is normal based on the preset standard document;
[0085] S203. If normal, the system module information corresponding to the configuration module data is processed by code generation based on the preset code template to obtain the target control code file.
[0086] Specifically, if the second instruction parameter is empty, meaning it does not specify the configuration module information required to generate the target control code file, then the configuration module data corresponding to the system module information in the system description file is retrieved. Based on a preset standard document, the configuration module data corresponding to all system module information is verified to ensure compliance with the standard. If it does not comply, the target application reports an error and prompts the user to check the system description file. If the configuration module data corresponding to the system module information all comply with the standard, then code generation processing is performed on the configuration module data corresponding to the system module information based on a preset code template to obtain the target control code file.
[0087] For example, the default standard document can be the Classic AUTOSAR standard document. As long as the configuration module data in the system description file conforms to the requirements of the Classic AUTOSAR standard document, it can be parsed and generated accordingly. It does not require a lot of computing power to process the graphics. It can focus on the core logic of code generation, making more reasonable use of system resources and ensuring the normal operation of other system functions.
[0088] In some embodiments, the code generation data further includes a third instruction parameter, which represents the target path information of the target control code file. After code generation processing is performed based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain at least one set of target control code files for each set of code generation data, the data further includes:
[0089] S104. Based on the third instruction parameter, store the target control code file to the storage location corresponding to the target path information.
[0090] Specifically, the code generation data also includes a third instruction parameter, which includes the target path information of the target control code file. After the target control code file is generated, it is stored in the storage location corresponding to the target path information. This ensures that the generated target control code file is stored in the user-specified location for user convenience.
[0091] For example, the third instruction parameter is "D:\cmdgenerate\output", which stores the generated target control code file in the output folder under the cmdgenerate folder on drive D.
[0092] In some embodiments, the code generation data further includes a fourth instruction parameter, which includes application information, and after receiving at least one set of code generation data from the vehicle control unit based on the target function interface, it further includes:
[0093] S301. Determine the target application corresponding to the fourth instruction parameter based on the application information;
[0094] S302, Start the target application;
[0095] The code generation data includes a fourth instruction parameter. The target function interface receives the fourth instruction parameter, starts the target application corresponding to the fourth instruction parameter, and sends the code generation data to the target application. The target application analyzes the code generation data and obtains the first instruction parameter, the second instruction parameter, and the third instruction parameter.
[0096] For example, the code generates the following data:
[0097] The command `Eclipsec.exe –nosplash –application com.caic.bs.cp.CodeGen "D:\cmdgenerate\Config.arxml" "D:\cmdgenerate\output" "PduR,Os,Com"` separates each instruction parameter with a space. The first instruction parameter is "D:\cmdgenerate\Config.arxml", the second is "PduR,Os,Com", the third is "D:\cmdgenerate\output", and the fourth is `Eclipsec.exe –nosplash –application com.caic.bs.cp.CodeGen`. `eclipsec.exe` supports launching Eclipse from the console. The `--nosplash` parameter controls the execution without displaying the startup page. The `--application` parameter points to the actual application of the `com.caic.bs.cp.CodeGen` code generation tool. `com.caic.bs.cp.CodeGen` is the target application and the core tool for generating code. When code generation is performed, the target application obtains the code generation data and parses out: the system description file corresponding to the first instruction parameter, the storage location of the target control code file corresponding to the third instruction parameter, and the configuration module information required to generate the target control code file.
[0098] Based on the system description file corresponding to the first instruction parameter and the second instruction parameter, code generation processing is performed to obtain at least one set of target control code files for each set of code generation data, including:
[0099] S401. The target application performs code generation processing on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain at least one set of target control code files for each set of code generation data.
[0100] The target application performs code generation processing on the system description file corresponding to the first instruction parameter and the second instruction parameter based on the preset code template, to obtain at least one set of target control code files for each set of code generation data, and outputs the target control code files to the storage location corresponding to the third instruction parameter.
[0101] By receiving code generation data once through the target function interface, it is very convenient to generate code using scripts, operation manuals, or design documents, which avoids the complexity of graphical interfaces that require dozens of clicks and step-by-step screenshots.
[0102] Please see Figure 6 In some embodiments, the method further includes:
[0103] S501. Detect the path status of the file path corresponding to the target path information of the third instruction parameter, and obtain the path status detection result.
[0104] S502. If the path status detection result is normal, trigger the step of obtaining the system description file corresponding to the first instruction parameter.
[0105] Before step S103, it is necessary to check whether the target path of the target control code file pointed to by the third instruction parameter exists. If it does not exist, the target application will report an error and indicate that the command is unrecognized. If the target path of the target control code file exists, then step S103 will continue to be executed to generate the target control code file.
[0106] After the target application is launched, it acquires the code generation data and analyzes it to derive the first, second, and third instruction parameters. The first and third instruction parameters are then verified to determine the existence of an input system description file and the storage location of an output target control code file. Once the storage location of these two files is confirmed, code generation proceeds. If any issues arise with the first or third instruction parameters, the user is promptly notified of the unrecognized command, allowing for timely error correction and ensuring the program's proper functioning, thus improving the efficiency and accuracy of code generation.
[0107] Please see Figure 7 According to a second aspect of this disclosure, an automatic vehicle control code generation apparatus is provided, the apparatus comprising:
[0108] The code generation data receiving module 10 is used to receive at least one set of code generation data from the vehicle control unit based on the target function interface. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter is used to characterize the storage information of the system description file of the vehicle control unit. The second instruction parameter includes the configuration module information required to generate the target control code file. The system description file is used to describe the system module information corresponding to the vehicle control unit.
[0109] System description file acquisition module 20 is used to acquire the system description file corresponding to the first instruction parameter;
[0110] The code generation module 30 is used to perform code generation processing based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain at least one set of target control code files for each set of code generation data.
[0111] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0112] This application provides a vehicle control code automatic generation device, which can be a terminal or a server. The vehicle control code automatic generation device includes a processor and a memory. The memory stores at least one instruction or at least one program. The at least one instruction or at least one program is loaded and executed by the processor to implement the vehicle control code automatic generation method provided in the above method embodiments.
[0113] Memory is used to store software programs and modules. The processor executes these stored software programs and modules to perform various functional applications and data processing. Memory can primarily consist of a program storage area and a data storage area. The program storage area stores the operating system, application programs required for functionality, etc.; the data storage area stores data created based on device usage, etc. Furthermore, memory can include high-speed random access memory (RAM) and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory can also include a memory controller to provide the processor with access to the memory.
[0114] The methods and embodiments provided in this application can be executed in electronic devices such as mobile terminals, computer terminals, servers, or similar computing devices. Figure 8 This is a hardware structure block diagram of an electronic device for an automatic vehicle control code generation method provided in an embodiment of this application. For example... Figure 8As shown, the electronic device 900 can vary significantly due to differences in configuration or performance. It may include one or more central processing units (CPUs) 910 (CPUs 910 may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), a memory 930 for storing data, and one or more storage media 920 (e.g., one or more mass storage devices) for storing application programs 923 or data 922. The memory 930 and storage media 920 may be temporary or persistent storage. The program stored in the storage media 920 may include one or more modules, each module may include a series of instruction operations on the electronic device. Furthermore, the CPU 910 may be configured to communicate with the storage media 920 and execute the series of instruction operations in the storage media 920 on the electronic device 900. Electronic device 900 may also include one or more power supplies 960, one or more wired or wireless network interfaces 950, one or more input / output interfaces 940, and / or one or more operating systems 921, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0115] The input / output interface 940 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the electronic device 900. In one example, the input / output interface 940 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 940 may be a radio frequency (RF) module for wireless communication with the Internet.
[0116] Those skilled in the art will understand that Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 900 may also include... Figure 8 The more or fewer components shown, or having the same Figure 8 The different configurations shown.
[0117] Embodiments of this application also provide a computer-readable storage medium, which can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a vehicle control code automatic generation method in the method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the vehicle control code automatic generation method provided in the above method embodiment.
[0118] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0119] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
Claims
1. A method for automatically generating vehicle control codes, characterized in that, The method includes: The system receives at least one set of code generation data from the vehicle control unit based on the target function interface. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter is used to characterize the storage information of the system description file of the vehicle control unit. The second instruction parameter includes the configuration module information required to generate the target control code file. The configuration module information includes modules contained in the CAN communication protocol stack, diagnostic protocol stack, calibration protocol stack, system protocol stack, memory protocol stack, system service protocol stack, and communication service protocol stack based on the Classic AUTOSAR standard. The system description file is used to describe the system module information corresponding to the vehicle control unit. Obtain the system description file corresponding to the first instruction parameter. The system description file includes system module information corresponding to the vehicle control unit configured based on user requirements and the Classic AUTOSAR standard document. The system description file is parsed to obtain the system module information included in the system description file; If the system module information matches the configuration module information included in the second instruction parameter, obtain the configuration module data corresponding to the configuration module information; The configuration module data corresponding to the configuration module information is verified to be normal based on a preset standard document, wherein the preset standard document includes the Classic AUTOSAR standard document; If normal, the configuration module data is processed to generate code based on the preset code template to obtain the target control code file.
2. The method according to claim 1, characterized in that, Before obtaining the configuration module data corresponding to the configuration module information if the system module information matches the configuration module information included in the second instruction parameter, the method further includes: The parameter status of the second instruction parameter is detected to obtain the parameter status detection result; If the parameter status detection result indicates that the parameter status is not empty, the step of obtaining the configuration module data corresponding to the configuration module information is triggered if the system module information matches the configuration module information included in the second instruction parameter.
3. The method according to claim 2, characterized in that, The method further includes: If the parameter status detection result is that the parameter status is empty, obtain the configuration module data corresponding to the system module information; Verify whether the configuration module data corresponding to the system module information is normal based on the preset standard document; If normal, the system module information corresponding to the configuration module data is processed by code generation based on the preset code template to obtain the target control code file.
4. The method according to claim 1, characterized in that, The code generation data further includes a third instruction parameter, which represents the target path information of the target control code file. After performing code generation processing based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code files for each of the at least one set of code generation data, the process further includes: Based on the third instruction parameter, the target control code file is stored in the storage location corresponding to the target path information.
5. The method according to claim 1, characterized in that, The code generation data also includes a fourth instruction parameter, which includes application information. After receiving at least one set of code generation data from the vehicle control unit based on the target function interface, the data further includes: The target application corresponding to the fourth instruction parameter is determined based on the application information; Launch the target application; The code generation process based on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code files for each of the at least one set of code generation data includes: The target application performs code generation processing on the system description file corresponding to the first instruction parameter and the second instruction parameter to obtain the target control code file for each of the at least one set of code generation data.
6. The method according to claim 4, characterized in that, The method further includes: The path status of the file path corresponding to the target path information of the third instruction parameter is detected to obtain the path status detection result; If the path status detection result is normal, the step of obtaining the system description file corresponding to the first instruction parameter is triggered.
7. A vehicle control code automatic generation device, characterized in that, The device includes: The code generation data receiving module is used to receive at least one set of code generation data from the vehicle control unit based on the target function interface. The code generation data includes a first instruction parameter and a second instruction parameter. The first instruction parameter is used to characterize the storage information of the system description file of the vehicle control unit. The second instruction parameter includes the configuration module information required to generate the target control code file. The configuration module information includes modules contained in the CAN communication protocol stack, diagnostic protocol stack, calibration protocol stack, system protocol stack, memory protocol stack, system service protocol stack, and communication service protocol stack based on the Classic AUTOSAR standard. The system description file is used to describe the system module information corresponding to the vehicle control unit. The system description file acquisition module is used to acquire the system description file corresponding to the first instruction parameter. The system description file includes system module information corresponding to the vehicle control unit configured based on user requirements and the Classic AUTOSAR standard document. The parsing module is used to parse the system description file to obtain the system module information included in the system description file; The data acquisition module is used to acquire configuration module data corresponding to the configuration module information if the system module information matches the configuration module information included in the second instruction parameter. The verification module is used to verify whether the configuration module data corresponding to the configuration module information is normal based on a preset standard document, wherein the preset standard document includes the Classic AUTOSAR standard document; The code generation module is used to generate code from the configuration module data based on a preset code template, if normal operation is achieved, to obtain the target control code file. Based on the system description file corresponding to the first instruction parameter and the second instruction parameter, code generation processing is performed to obtain the target control code file for each of the at least one set of code generation data.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the automatic vehicle control code generation method as described in any one of claims 1-6.
9. An electronic device, characterized in that, The system includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the vehicle control code automatic generation method as described in any one of claims 1-6 by executing the instructions stored in the memory.
Citation Information
Patent Citations
Service code generation method and device and template configuration method and device
CN114461224A
Vehicle-mounted service code generating and compiling method based on DDS and readable storage medium
CN114546341A
Cited By
Code generation method for unmanned special vehicle control system
CN117055524A