LIN protocol communication configuration code generation method, system and device based on AUTOSAR architecture and storage medium
By parsing ARXML files and generating LIN protocol configuration codes that comply with the AUTOSAR standard, the problem of failing to automatically generate code in the existing technology is solved, and efficient and automated development of on-board software is realized, and the AUTOSAR architecture system is adapted.
Patent Information
- Application Number
- CN202411958005.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-27
AI Technical Summary
The prior art failed to use the AUTOSAR standard ARXML communication matrix to automatically generate LIN protocol configuration code, resulting in inadvertent automation and efficient development of on-board software.
By parsing ARXML files, extracting structured XML format data and converting it into a structure array, and configuring the code template according to the LIN protocol to generate C language code that complies with the AUTOSAR standard to realize the initialization and management of LIN communication.
It realizes better adaptation of in-vehicle software development under the AUTOSAR architecture system, improves the efficiency and quality of software code development, provides an automated development model for LIN software modules, and improves product software development efficiency.
Smart Images

Figure CN120045168A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication protocols, and particularly to a LIN protocol communication code generation system based on the AUTOSAR architecture. Background Art
[0002] AUTOSAR (Automotive Open System Architecture) is an open standard in the global automotive industry, aiming to create and standardize automotive electronic architectures to improve software reusability and interoperability.
[0003] In the AUTOSAR architecture, the Lin (Local Interconnect Network) bus is an important communication protocol, mainly used for low-cost and low-rate communication requirements inside vehicles.
[0004] Lin frames (LIN Frames) and SDB communication matrices (Signal Data Byte communication matrices) are important concepts in Lin bus communication, and they are configured and described through ARXML (AUTOSAR XML) files in the AUTOSAR architecture.
[0005] The SDB communication matrix is a method for describing how signals and data bytes in the Lin network are mapped to specific Lin frames. In AUTOSAR, this mapping relationship is usually defined in ARXML files.
[0006] Through the SDB communication matrix, system designers can precisely control the data transmission method in the Lin network to ensure data consistency and accuracy.
[0007] The current technology (CN104503767A) mainly generates Lin protocol configuration code automatically according to the description information of LDF files, rather than automatically generating code according to the description information of the ARXML communication matrix of the AUTOSAR standard. ARXML is part of the AUTOSAR standard, aiming to support the modular and standardized development of automotive electronic systems; LDF is specifically for the LIN bus and is not directly related to the AUTOSAR standard. Summary of the Invention
[0008] To solve the above technical problems, the present invention provides a method for generating LIN protocol communication configuration code based on the AUTOSAR architecture.
[0009] The present invention is achieved through the following technical solutions.
[0010] The LIN protocol communication configuration code generation method based on the AUTOSAR architecture provided by the present invention includes processing an ARXML file to generate data conforming to the AUTOSAR standard, and after compiling the data, burning it into hardware. The method for processing the ARXML file includes:
[0011] Parsing the ARXML file, parsing the ARXML file according to the AUTOSAR specification, and converting the structured XML format data in the ARXML file into a structure array;
[0012] Obtaining information related to LIN communication configuration, identifying the structure array, extracting information related to LIN communication configuration, and obtaining the information by analyzing the ARXML file;
[0013] Generating configuration code according to a template, and converting the information related to LIN communication configuration into C language code using the LIN protocol configuration code template;
[0014] Calling the constant array and signal packetizing function and signal unpacking function in the configuration code to initialize and manage LIN communication.
[0015] Furthermore, converting the structured XML format data in the ARXML file into a structure array includes the following method: According to the XML specification, using python code to parse the structured XML format data in the ARXML file to generate a structure array.
[0016] Furthermore, the information related to LIN communication configuration includes the name of the frame, frame id, frame length, frame direction, signal name, signal value, and signal length.
[0017] Furthermore, converting the information related to LIN communication configuration into C language code using the LIN protocol configuration code template includes the following method: Importing the information related to LIN communication configuration into a code generator, and the code generator exports the information as C language code according to the LIN protocol configuration code template.
[0018] The present invention also provides a LIN protocol communication configuration code generation system based on the AUTOSAR architecture, including an ARXML file parsing module and a code generation module. The ARXML file parsing module includes a judgment unit and a parsing unit. The code generation module includes a LIN protocol configuration code template, a code generator, and a verification unit. Among them, the ARXML file parsing module extracts the information related to LIN communication configuration from the ARXML file and transmits the information to the code generation module, and the code generation module outputs code according to the LIN protocol configuration code template for the information.
[0019] Further, the judgment unit in the ARXML file parsing module reads the ARXML file, determines whether the ARXML file is a standard ARXML file, and sends the judgment result to the parsing unit. The parsing unit extracts LIN communication configuration related information from the ARXML file in combination with the mapping configuration of the LIN protocol corresponding hardware channels.
[0020] Further, the code generator in the code generation module receives the LIN communication configuration related information, and generates C language code after compilation and parsing according to the LIN protocol configuration template.
[0021] The present invention also provides a LIN protocol communication configuration code generation device based on the AUTOSAR architecture, including a module for executing the method, including a processor and an interface circuit. The interface circuit is used to receive signals from other devices outside the device that executes the kernel state command and transmit them to the processor, or send signals from the processor to other devices outside the device that executes the kernel state command. The processor uses logic circuits or executes code instructions to implement the method.
[0022] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method is implemented.
[0023] The beneficial effects of the present invention are as follows: it better adapts to the in-vehicle software development work under the AUTOSAR architecture system, can efficiently and high-quality complete the development of software code that meets the AUTOSAR standard in a short time, provides an automated development mode for the development of LIN software modules, and improves the software development efficiency of products. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a schematic flow chart of the method of the present invention;
[0025] Figure 2 is a schematic diagram of the connection relationship of the system modules of the present invention;
[0026] Figure 3 is a screenshot of the experimental result interface. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0027] The technical solutions of the present invention will be further described below, but the scope of protection claimed is not limited thereto.
[0028] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be described in detail below with reference to the drawings and specific embodiments.
[0029] Embodiment 1
[0030] The application scenario of this embodiment is in a vehicle-mounted system, using the Infineon chip TC399;
[0031] Read the ARXML file stored in the hard disk or other storage media into the memory. The ARXML file adopts the XML format in text form and details the AUTOSAR configuration information; Parse the content of the ARXML file according to the AUTOSAR specification, and use python code to parse the structured XML format data in the ARXML file. In this embodiment, the configuration information tags and associated attributes under the following LIN protocol communication are parsed: LIN unconditional frame and its attributes <lin-unconditional-frame> :
[0032] <frame-length> 、 <pdu-ref> 、 <start-position>; PDU Trigger and Its Attributes <pdu-triggering> : <i-pdu-port-refs> 、
[0033] <i-signal-triggerings> 、 <i-pdu-ref>;
[0034] LIN frame trigger and its attributes <lin-frame-triggering> : <identifier> 、 <lin-checksum>;
[0035] LIN Scheduling Table and Its Attributes <lin-schedule-table> : <delay> 、
[0036] <position-in-table> 、 <frame-triggering-ref>;
[0037] Extract the attribute information in the above configuration information tags in the ARXML file. In this embodiment, parsing the above tags can meet the requirements. The following describes the LIN template code analysis process. Import the above parsed file and its attributes into the code generator. The code generator outputs the corresponding C language files in sequence according to the LIN template code. After parsing, the associated file linif_Linif_ScheduleTable.h and Linif_Lcfg.c are generated, and the demonstration uuid of the associated ARXML node is <lin-schedule-table>, and
[0038] linif_Linif_ScheduleTable.h requires the name and quantity of the data unit ScheduleTable; the demonstration uuids of the ARXML nodes associated with the LIN schedule file linif_Lcfg.c are lin-frame: <lin-frame-triggering>, scheduletable: <lin-schedule-table>, pdu-frame: <lin-unconditional-frame>, the required data unit is the hexadecimal Linid (IDENTIFIER), LIN_ENHANCED_CS
[0039] (LIN-CHECKSUM), LIN_MASTER_RESPONSE or LIN_SLAVE_RESPONSE, length (corresponding to the length of the associated pdu-frame), delay (corresponding to the length of the scheduletable); Since one lin includes multiple scheduletables, the ScheduleTableList array is generated;
[0040] The generated C code also includes a PDU reception table, which is used to record
[0041] / Communication / Frame / LIN-UNCONDITIONAL-FRAME's reception and transmission frames; The transmission involves the channel configuration of lin (related to mcal), and the required data units: Linid (hexadecimal), LinChannel (related to mcal), message length, upper layer processing (LINIF_UL_COM), and pduid. The demonstration uuid of the associated arxml node is: lin-frame: <lin-frame-triggering>, scheduletable: <lin-schedule-table>, pdu-frame: <lin-unconditional-frame>;
[0042] As Figure 3 shown, after the code file generated according to the above configuration is compiled and burned together with the application code, LIN protocol frames can be correctly sent and received on the Infineon chip TC399.
[0043] The above embodiments are the preferred solutions for the implementation of the present invention. It should be noted that any obvious replacements and minor changes are within the protection scope of the present invention without departing from the concept of the present invention. < / position-in-table> < / delay> < / lin-schedule-table> < / identifier> < / lin-frame-triggering> < / i-signal-triggerings> < / i-pdu-port-refs> < / pdu-triggering> < / pdu-ref> < / frame-length> < / lin-unconditional-frame>
Claims
1. A method for generating LIN protocol communication configuration code based on AUTOSAR architecture, comprising processing ARXML files, generating data that complies with AUTOSAR standards, compiling the data and burning it into hardware, characterized in that The method for processing an ARXML file includes: Parse the ARXML file according to the AUTOSAR specification and convert the structured XML format data in the ARXML file into a structure array; Obtain information related to LIN communication configuration, identify the structure array, extract information related to LIN communication configuration, and obtain the information by analyzing the ARXML file; Generate configuration code according to the template, and use the LIN protocol configuration code template to convert LIN communication configuration related information into C language code; Call the constant array and signal packaging function and signal unpacking function in the configuration code to initialize and manage LIN communication.
2. The configuration code generation method according to claim 1, characterized in that: The method of converting the structured XML format data in the ARXML file into a structure array includes the following: according to the XML specification, the structured XML format data in the ARXML file is parsed using Python code to generate a structure array.
3. The configuration code generation method according to claim 1, characterized in that: The LIN communication configuration related information includes frame name, frame ID, frame length, frame direction, signal name, signal value, and signal length.
4. The configuration code generation method according to claim 1, characterized in that: Converting LIN communication configuration related information into C language code using a LIN protocol configuration code template includes the following method: importing LIN communication configuration related information into a code generator, and the code generator exports the information into C language code according to the LIN protocol configuration code template.
5. LIN protocol communication configuration code generation system based on AUTOSAR architecture, characterized by include: ARXML file parsing module and code generation module, the ARXML file parsing module includes a judgment unit and a parsing unit, the code generation module includes a LIN protocol configuration code template, a code generator and a verification unit, wherein the ARXML file parsing module extracts LIN communication configuration related information from the ARXML file and transmits the information to the code generation module, and the code generation module outputs the code according to the LIN protocol configuration code template.
6. The configuration code generation system according to claim 1, characterized in that: The judgment unit in the ARXML file parsing module reads the ARXML file, judges whether the ARXML file is a standard ARXML file, and sends the judgment result to the parsing unit. The parsing unit extracts LIN communication configuration related information from the ARXML file in combination with the mapping configuration of the LIN protocol corresponding to the hardware channel.
7. The configuration code generation system according to claim 1, characterized in that: The code generator in the code generation module receives LIN communication configuration related information, and generates C language code after compiling and parsing according to the LIN protocol configuration template.
8. A LIN protocol communication configuration code generation device based on AUTOSAR architecture, comprising a module for executing the method according to any one of claims 1 to 4, characterized in that: It includes a processor and an interface circuit, wherein the interface circuit is used to receive signals from other devices other than the device for executing kernel mode commands and transmit them to the processor or send signals from the processor to other devices other than the device for executing kernel mode commands, and the processor is used to implement the method as described in any one of claims 1 to 4 through logic circuits or execution code instructions.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
System and method for automatically generating codes based on LIN protocol
CN104503767A