Configuration file processing method and device, terminal equipment, and computer program product
By comparing the standard configuration files and custom configuration files of automotive electronic control units (ECUs), generating differential files to update custom configuration files, solving the problem of inefficient development of BSW, achieving a more efficient development process and a lower error rate.
Patent Information
- Application Number
- CN202510066049.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-01-16
AI Technical Summary
The prior art is less efficient when developing basic software (BSW) for automotive electronic control units (ECUs), especially during iterative development and multi-version parallel development, where manual editing of configuration files leads to inefficiency and error-prone.
Reduce direct editing of custom configuration files by comparing the element trees of standard configuration files (StMD) and custom configuration files (VSMD), record the differences and generate differential files (ARXML format) to update custom configuration files.
Improves the efficiency of BSW development and reduces the complexity and error rate of manual editing, especially during iterative development and multi-version management.
Smart Images

Figure CN119512617B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of embedded development technology, and in particular to a method and apparatus for configuring a configuration file, a terminal device, and a computer program product. Background Art
[0002] The electronic control unit (ECU) is an important part of the automotive electronic system. The ECU can control various functions of the car by running specific software programs. The automotive open system architecture (AUTOSAR) provides a standardized software architecture for ECU development. In the AUTOSAR classic platform system, the ECU software is divided into three layers from top to bottom: application layer, runtime environment (RTE) and basic software (BSW).
[0003] Currently, BSW development faces the problem of low efficiency. Summary of the invention
[0004] The present application provides a configuration file processing method and apparatus, terminal equipment, and computer program product, which can improve the development efficiency of BSW.
[0005] In a first aspect, a configuration file processing method is applied to basic software development of an electronic control unit, the processing method comprising:
[0006] Acquire a first standard configuration file and a first custom configuration file; the first custom configuration file matches the first standard configuration file; the first standard configuration file includes a first element tree, and the first custom configuration file includes a second element tree;
[0007] Compare the first element tree with the second element tree, and record the first difference between the first element tree and the second element tree in a third element tree;
[0008] Based on the third element tree, a first difference file is determined; the first difference file is used to update the first custom configuration file.
[0009] In this way, by comparing the element tree of the first standard configuration file and the element tree of the first custom configuration file, the difference between the two element trees is recorded in the newly created element tree, which can be used to generate a difference file (also called a change file). The difference file can be used to update the first custom configuration file. The difference file is exported from the element tree (that is, the difference file conforms to the ARXML format). During the iterative development process, there is no need to edit the first custom configuration file to update it. Instead, the first difference content is directly modified or adjusted by editing the difference file, which optimizes the development process and improves efficiency.
[0010] In one implementation, the first element tree includes a first element, the second element tree includes a second element, and the first element and the second element are used to indicate the same configuration content.
[0011] Comparing the first element tree with the second element tree, and recording the first difference between the first element tree and the second element tree in a third element tree, includes:
[0012] When the first element and the second element are different, and both the first element and the second element include sub-elements, determining whether the preset configuration tag set includes a tag of the first element or a tag of the second element;
[0013] When the preset configuration tag set includes the tag of the first element or the second element, the second element and elements of all levels in the second element are recorded in the third element tree.
[0014] In this way, the first element and the second element are compared using a preset configuration tag set. When the preset configuration tag set includes the tag of the current comparison element, all sub-elements of the element are compared as a whole, and when differences occur, the element and its sub-elements are recorded as a whole. In this way, not only the difference itself (for example, one or more elements in the element tree where the difference occurs) can be recorded, but also the context of the difference can be recorded. Compared with only recording the difference itself, this way of outputting the difference as a whole can reflect the correlation between the difference and the context, thereby reducing errors in the subsequent BSW development process.
[0015] In one implementation, the processing method further includes:
[0016] When the preset configuration tag set does not include the tag of the first element or the second element, the sub-elements of the first element and the second element are compared one by one, and the third element is recorded in the third element tree or the third element and the elements at all levels in the third element are recorded in the third element; the third element includes the sub-elements that are inconsistent between the first element and the second element.
[0017] In one implementation, the processing method further includes:
[0018] When the third element tree does not include the second element, the second element is recorded in the third element tree as a parent element of the fourth element.
[0019] When one or more elements in the third element tree are missing parent elements, the corresponding parent elements can be added to the third element tree. In this way, the completeness of the difference content is improved and errors are reduced by adding parent elements.
[0020] In one implementation, the processing method further includes:
[0021] When neither the first element nor the second element includes a sub-element, comparing the text contents of the first element and the second element;
[0022] When the text contents of the first element and the second element are different, recording the second element in the third element tree;
[0023] And / or, when the first element includes the fourth element and the second element does not include the fourth element, a first error message is generated; the fourth element is a sub-element of the first element.
[0024] In one implementation, the processing method further includes:
[0025] Comparing the first file information with the second file information; the first file information includes the module information and version information of the first standard configuration file, and the second file information includes the module information and version information of the first custom configuration file;
[0026] When the first file information and the second file information are consistent, determining that the first custom configuration file matches the first standard configuration file;
[0027] When the first file information and the second file information are inconsistent, second error information is generated.
[0028] In one implementation, the processing method further includes:
[0029] Obtaining a second difference file; the second difference file is determined based on a second standard configuration file and a second custom configuration file, the second custom configuration file matches the second standard configuration file; the second standard configuration file matches the first standard configuration file;
[0030] The second difference file and the first difference file are merged to determine a third difference file; the third difference file is used to update the first custom configuration file or the second custom configuration file.
[0031] In one implementation, the second standard configuration file includes a third element tree, the second custom configuration file includes a fourth element tree, and the processing method further includes:
[0032] Comparing the third element tree with the fourth element tree, and recording the second difference content between the third element tree and the fourth element tree in the fifth element tree;
[0033] Based on the fifth element tree, a second difference file is determined.
[0034] In one implementation, the first difference file includes a fifth element, the second difference file includes a sixth element, and the labels of the fifth element and the sixth element are the same.
[0035] When the version of the second standard configuration file is higher than the version of the first standard configuration file, updating the text content of the fifth element in the third difference file according to the text content of the sixth element;
[0036] When the version of the second standard configuration file is lower than the version of the first standard configuration file, the text content of the sixth element is updated in the third difference file according to the text content of the fifth element.
[0037] In a second aspect, a configuration file processing device is provided, including a processor for calling instructions stored in a memory, wherein when the instructions are called by the processor, the processor executes the processing method of the above first aspect or any one of the implementations of the first aspect.
[0038] In a third aspect, a terminal device is provided, comprising the processing device of the second aspect.
[0039] According to a fourth aspect, a computer program product is provided, comprising instructions, wherein when the instructions are called by a processor, the processing method according to the first aspect or any one implementation of the first aspect is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The following is a brief introduction to the drawings used in describing the embodiments of the present application:
[0041] Figure 1 A schematic diagram of a processing method provided in some embodiments of the present application;
[0042] Figure 2 A schematic diagram of a process for updating a first custom configuration file provided in some embodiments of the present application;
[0043] Figure 3 A schematic diagram of the structure of an element tree provided in some embodiments of the present application;
[0044] Figure 4 A schematic diagram of a process for comparing first file information and second file information provided in an embodiment of the present application;
[0045] Figure 5 A schematic diagram of a process of comparing a first element and a second element provided in an embodiment of the present application;
[0046] Figure 6 A schematic diagram of the structure of another element tree provided in an embodiment of the present application;
[0047] Figure 7 A schematic diagram of a process for updating VSMD files of different versions provided in an embodiment of the present application;
[0048] Figure 8 This is a schematic diagram of the structure of a processing device provided in some embodiments of the present application. DETAILED DESCRIPTION
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the specific implementation methods of the present application will be described below with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other accompanying drawings and other embodiments can be obtained based on these accompanying drawings without creative work. Adjustments and improvements made without departing from the concept of the present application are all within the scope of protection of the present application.
[0050] In order to simplify the drawings, each of the drawings schematically shows only the parts related to the corresponding embodiments, and they do not represent the actual structure of the product, and there may be more or fewer structures or components in reality. In addition, in order to simplify the drawings and facilitate understanding, for the structures or components shown in the drawings, there may be more or fewer similar structures or components in reality.
[0051] In this application, unless otherwise clearly specified and limited, ordinal numbers, such as "first", "second", etc., are only used to distinguish and describe associated objects, and cannot be understood as indicating or implying the relative importance or order between associated objects. In addition, ordinal numbers do not represent the number of associated objects. For example, "first element" may include one element or multiple elements, and "first label" may include one label or multiple labels, etc. "Multiple" includes two or more, and other quantifiers are similar. " / " is used to describe the relationship between associated objects, which represents the "or" relationship between associated objects. "And / or" is used to describe the relationship between associated objects, which includes any combination relationship between associated objects, for example "a and / or b" includes: "a alone", "b alone", or "a and b". "One or more" or "at least one" in multiple objects refers to any object or any combination of multiple objects, for example, "one or more of a1, a2, a3" or "at least one of a1, a2, a3" includes: "a1 alone", "a2 alone", "a3 alone", "a1 and a2", "a1 and a3", "a2 and a3", or "a1, a2 and a3".
[0052] The electronic control unit (ECU) is an important part of the automotive electronic system. The ECU can control various functions of the car by running specific software programs. The automotive open system architecture (AUTOSAR) provides a standardized software architecture for ECU development. In the AUTOSAR classic platform system, the ECU software is divided into three layers from top to bottom: application layer, runtime environment (RTE) and basic software (BSW).
[0053] The AUTOSAR architecture allows each layer to be developed and updated independently. For BSW, AUTOSAR predefines multiple modules and configuration specifications of these modules for BSW. Modules predefined by AUTOSAR can be called standard modules. The StMD file provides a standardized configuration framework for BSW modules. Standard modules and their configuration specifications (such as the name and value of configuration parameters in standard modules, etc.) can be described through the standardized module definition (StMD) file. The StMD file can also be called a standard configuration file. The StMD file provides a common configuration method. Different chip manufacturers can modify or adjust the StMD file according to the actual characteristics or requirements of the ECU being developed, so as to obtain a vendor specific module definition (VSMD) file that meets the actual product situation. The VSMD file can also be called a custom configuration file. StMD files or VSMD files can be applied to the BSW development process.
[0054] In one implementation, AUTOSAR publishes StMD files in ARXML format. ARXML is a specific format defined for AUTOSAR based on the extensible markup language (XML) specification. Therefore, files in ARXML format also conform to the XML format. For example, the content of StMD files and VSMD files conform to the XML format. XML files consist of a series of elements, and an element can contain one or more other elements, thus forming a tree-like hierarchical structure (also called an element tree).
[0055] When developing a VSMD file, you can modify or add XML elements to the StMD file to get the VSMD file. However, in the actual development process, the editing of the VSMD file is not done in one go, and there are usually many iterations. Most of the StMD files of the BSW standard module are lengthy, and there are many XML element levels, which is not conducive to manual editing. When iteratively developing VSMD files, lengthy files will significantly reduce editing efficiency. In one implementation, you can use a text comparison tool (such as Beyond Compare or Git diff, etc.) to compare the differences between the StMD file and the VSMD file. The text comparison tool can compare the differences between each line of the StMD file and the VSMD file. However, the comparison results output by the file comparison tool cannot reflect the differences alone, and need to be combined with the original VSMD file for manual line-by-line inspection and editing, so it cannot be directly integrated with the ARXML format. This will also reduce development efficiency, and it is too dependent on manual inspection, which is prone to omissions or errors. In addition, there are many AUTOSAR versions. The StMD files of different versions of AUTOSAR are also different. Facing customers with different needs, suppliers may need to develop or maintain multiple versions of BSW in parallel. This will make the problem of low efficiency and error-proneness of manual editing more serious. Therefore, it is very important to improve the development efficiency of BSW.
[0056] Based on this, the embodiments of the present application provide a method and device for processing configuration files, and by comparing the StMD file and the VSMD file, the content in the VSMD file that has changed relative to the StMD file is exported as a difference file. The difference file is in ARXML format, which can directly reflect the difference between the StMD file and the VSMD file and is easy to edit. In this way, when multiple iterations or multiple versions are developed in parallel, the difference file can be used to update the VSMD file without making tedious modifications or adjustments to the VSMD file, thereby improving the development efficiency of BSW and reducing errors.
[0057] The following is a description with reference to the accompanying drawings.
[0058] Please refer to Figure 1 , which is a flow chart of a method for processing a configuration file provided in an embodiment of the present application. Figure 1 As shown, the processing method at least includes the following steps:
[0059] S110: Acquire a first standard configuration file and a first custom configuration file; the first custom configuration file matches the first standard configuration file; the first standard configuration file includes a first element tree, and the first custom configuration file includes a second element tree;
[0060] S120: Compare the first element tree with the second element tree, and record the difference between the first element tree and the second element tree in a third element tree;
[0061] S130: Determine a first difference file based on the third element tree; the first difference file is used to update the first custom configuration file.
[0062] The above processing method compares the element tree of the StMD file with the element tree of the VSMD file, and records the difference between the two element trees in a newly created element tree, which can be used to generate a difference file (also called a change file). The difference file can be used to update the VSMD file. For example, Figure 2 As shown, by modifying or adjusting the difference file (for example, the first difference file), the iteration of the difference file can be achieved and a new difference file (for example, a new first difference file) can be determined. The difference file is exported from the element tree (that is, the difference file conforms to the ARXML format), and the iterated difference file can be merged with the StMD file (for example, the first standard configuration file) to obtain an updated VSMD file (for example, a new first custom configuration file). In this way, during the iterative development process, there is no need to edit the VSMD file for updating. Instead, the difference content between the StMD file and the VSMD file is directly modified or adjusted by editing the difference file, thereby optimizing the development process and improving efficiency. The present application does not limit the method of merging ARXML format files, and can be implemented using any ARXML merging tool.
[0063] Please refer to Figure 3 , which is a schematic diagram of an element tree provided in an embodiment of the present application.
[0064] For example, an element may include a tag. The tag may represent the name of the element. Figure 3 As shown in the figure, angle brackets indicate tags, and the content in the angle brackets indicates the name of the element. For example, " <parameters>" can represent an element used to define or describe a parameter. For example, " <ecuc-integer-param-def>" can represent an element used to define an integer parameter. For example, an element can also include text content, which can represent the actual data or information of the element. The text content can be located between the start tag and the end tag of the element. For example, " <short-name>" can represent an element that is used to define a short name to facilitate identification or differentiation of different elements in the element tree. For example, Figure 3 middle" <short-name> (name of parameter 1)< / short-name> "For example." <short-name> " is the start tag, "< / short-name> " is the end tag. "(name of parameter 1)" is the text content, which is used to indicate that the SHORT-NAME element can identify parameter 1. For another example, " <max> 255< / max> "middle," <max> " is the start tag,< / max> is the end tag, "255" is the text content, and the MAX element can define the maximum value of the parameter. For example, the element can also include information such as attributes or UUID.
[0065] For example, an element may include other elements. The included elements may be called child elements, and the element that includes other elements may be called a parent element. For a parent element, multiple child elements may be arranged in parallel or nested in a hierarchical manner to form a tree structure. The element tree includes a root element, which is the top-level element of the element tree. All elements other than the root element in the element tree are child elements of the root element. For example, Figure 3 middle" <containers>" is the root element of the element tree, which means container. The container is used to represent a collection of parameters, and several configuration parameters can be aggregated in one container. That is, the CONTAINERS element may include one or more elements for defining or describing parameters. For example, a container may also include other containers. For example, Figure 3 The CONTAINERS element also includes SUB-CONTAINERS elements.
[0066] It should be noted that Figure 3 The element tree in is only an example. The embodiment of the present application does not limit the hierarchical relationship between the elements in the element tree, nor does it limit the number or type of elements in the element tree. The element tree can be obtained by parsing a StMD file or a VSMD file. For example, a file in ARXML format is parsed based on an XML file parsing library. The XML file parsing library may include various open source or free parsing libraries, such as Python's xml library or lxml library. In this way, dependence on commercial tools can be reduced and development costs can be reduced.
[0067] Both the StMD file and the VSMD file include an element tree. For different BSW modules, there are corresponding different StMD files. StMD files and VSMD files that match each other can be compared. Mutual matching means that the file information of the StMD file is the same as the file information of the VSMD file. In one implementation, the file information includes module information and version information. Among them, the module information is used to indicate the BSW module configured by the StMD file or VSMD file. The version information is used to indicate the current version of the StMD file or VSMD. StMD files and VSMD files with the same version and used to configure the same BSW module can be considered to match each other.
[0068] In one implementation, the configuration file processing method may further include a file information comparison process. Figure 4 , which is a flow chart of comparing first file information and second file information provided in an embodiment of the present application. Figure 4 As shown, the method for processing the configuration file also includes the steps of:
[0069] S410: Compare the first file information with the second file information; the first file information includes module information and version information of the first standard configuration file, and the second file information includes module information and version information of the first custom configuration file;
[0070] S420: When the first file information and the second file information are consistent, determining that the first custom configuration file matches the first standard configuration file;
[0071] S430: When the first file information and the second file information are inconsistent, generate second error information.
[0072] In this way, by comparing the first file information and the second file information, it can be determined whether the first standard configuration file and the first custom configuration file match. When at least one of the module information and the version information in the two file information is inconsistent, it is determined that the first file information and the second file information do not match, and an error message (for the sake of distinction, it can be called the second error message) is generated. When the module information and the version information in the two file information are consistent, it is determined that the first custom configuration file and the first standard configuration file match each other.
[0073] By way of example, the element tree may also include file information. For example, the element tree may include an element for indicating module information (hereinafter referred to as module element) or an element for indicating version information (hereinafter referred to as version element). In the first element tree of the first standard configuration file and the second element tree of the first custom configuration file, the module elements or version elements contained in the respective element trees may be searched and compared. The module element may include one or more elements. By way of example, the module element may include a SHORT-NAME sub-element of the root element of the element tree, such as a SHORT-NAME sub-element of an AR-PACKAGE element. By way of example, the module element may also include a SHORT-NAME sub-element of an ECUC-MODULE-DEF element. The version element may include a REVISION-LABEL element. Neither the version element nor the module element includes sub-elements.
[0074] When at least one of the module elements and version elements in the first element tree and the second element tree is inconsistent, it means that the first custom configuration file and the first standard configuration file do not match. At this time, an error message is generated. When the module elements and version elements in the first element tree and the second element tree are consistent, it means that the first custom configuration file and the first standard configuration file match each other. For two elements that do not include sub-elements, element consistency means that the labels and text contents of the elements are consistent, and element inconsistency means that the labels or text contents of the elements are inconsistent. For example, search for the SHORT-NAME sub-element of the AR-PACKAGE element, the SHORT-NAME sub-element of the ECUC-MODULE-DEF element, and the text content of the REVISION-LABEL element in the first element tree and the second element tree respectively. If the text contents of these three elements are not completely consistent in the first element tree and the second element tree, an error message is generated and the process is terminated.
[0075] In one implementation, by comparing the element tree of StMD and the element tree of VSMD, the difference content between the two configuration files can be extracted to form a difference file. For example, the first element tree is compared with the second element tree, and the difference content between the first element tree and the second element tree is recorded in the third element tree. The third element tree can be used to generate a difference file in ARXML format. For ease of distinction, the difference content between the first element tree and the second element tree can be referred to as the first difference content, and the difference file generated based on the third element tree can be referred to as the first difference file.
[0076] The following describes the comparison process of the first element tree and the second element tree and the recording process of the difference contents (step S120 ).
[0077] Regarding the comparison of element trees, the elements in the first element tree and the second element tree can be compared one by one according to the level of the elements. For example, assume that the first element tree includes element A and element B, and the parent elements of these two elements are the root elements of the first element tree. The second element tree includes element C, element D and element E, and the parent elements of these three elements are the root elements of the second element tree. In this way, when comparing element trees, an element in the first element tree can be compared with an element in the second element tree in turn. Or, an element in the second element tree can be compared with an element in the first element tree in turn. For example, element A can be compared with element C, element D, and element E in turn; for another example, element C can be compared with element A and element B. And so on, the element comparison process is looped until all elements in the second element tree and the second element tree are compared. In the process of element comparison, the difference content can be recorded in the third element tree (i.e., the newly created element tree) according to the comparison results, which is used to determine the first difference file.
[0078] The following describes the process of comparing two elements, taking the above-mentioned element A and element C as an example. For the sake of distinction, element A can be called the first element, and element C can be called the second element.
[0079] First, determine whether the first element and the second element are used to indicate the same configuration content. When any two elements meet any of the following conditions, the two elements can be considered to be used to indicate the same configuration content: (1) Both elements do not include sub-elements and the labels of the two elements are the same; (2) Both elements include SHORT-NAME sub-elements and the text content of the SHORT-NAME sub-elements is the same, and the labels of the two elements are the same. If none of the above conditions are met, the two elements can be considered to be used to indicate different configuration contents, for example, the two elements contain different numbers of sub-elements, the two elements have different labels, the two elements contain the same sub-elements but the text content of the sub-elements is different, etc.
[0080] When the first element and the second element are used to indicate different configuration contents, the difference is not recorded. For example, when comparing element A with element C, element A and element C indicate different configuration contents. At this time, although element A and element C are different, element A may indicate the same configuration contents as other elements in the second element tree. In this case, the difference between the two is not recorded, but it is then determined whether element A and element D are used to indicate the same configuration contents.
[0081] When the first element and the second element are used to indicate the same configuration content, the difference content between the first element and the second element may be recorded in the third element tree.
[0082] In some embodiments, the difference content can be recorded based on the element's label. Assume that the first element tree includes the first element and the second element tree includes the second element. The first element and the second element are used to indicate the same configuration content. The element label refers to the element's own label, and does not include the label of the element's sub-elements. Please refer to Figure 5 , which is a schematic diagram of a process of comparing a first element and a second element provided in an embodiment of the present application. Figure 5 As shown, the difference between the first element tree and the second element tree is recorded in the third element tree, including:
[0083] When the first element and the second element are different, and both the first element and the second element include sub-elements, determining whether the preset configuration tag set includes a tag of the first element or a tag of the second element;
[0084] When the preset configuration tag set includes the tag of the first element or the second element, the second element and elements of all levels in the second element are recorded in the third element tree.
[0085] At this time, the first difference content includes the second element and elements of all levels in the second element. In this way, the first element and the second element are compared using a preset configuration tag set. When the preset configuration tag set includes the tag of the current comparison element, all sub-elements of the element are compared as a whole, and when differences occur, the element and its sub-elements are recorded as a whole. In this way, not only the difference itself (for example, one or more elements in the element tree where the difference occurs) can be recorded, but also the context of the difference can be recorded. Compared to only recording the difference itself, this way of outputting the difference as a whole can reflect the correlation between the difference and the context, thereby reducing errors in the subsequent BSW development process.
[0086] On the premise that the first element and the second element are used to indicate the same configuration content, the first element and the second element can be considered different when they meet any of the following conditions:
[0087] (1) The number of sub-elements in the first element is less than the number of sub-elements in the second element. For example, assuming that S represents the first element and V represents the second element, element S includes sub-elements s1 and s2, and element V includes sub-elements v1, v2, v3, and v4. In this case, the first element and the second element can be considered different. In this case, if the preset configuration label set includes the label of the second element or the label of the first element (in fact, when the first element and the second element are used to indicate the same configuration content, the labels of the two elements are the same), the second element and its sub-elements can be taken as a whole, and element V and elements v1-v4 can be recorded in the third element tree. For another example, when the first element does not include sub-elements and the second element includes sub-elements, the second element and its sub-elements can be recorded in the third element tree.
[0088] (2) Both the first element and the second element include sub-elements, and one or more of the label, text content, and included sub-elements of at least one sub-element of the first element are different from those of the second element. For example, assume that element S includes sub-elements s1, s2, and s3, and element V includes sub-elements v1, v2, and v3. For example, if the labels of element s1 and element v1 are different, element S can be considered different from element V. For another example, if element s1 and element v1 have the same label but different text content, element S can be considered different from element V. For another example, if element s1 and element v1 have the same label and further include sub-elements, then the labels and text content of sub-elements at each level are compared, and so on. In this case, if the preset configuration label set includes the label of the second element or the label of the first element, the second element and its sub-elements can be taken as a whole, and element V and elements v1-3 can be recorded in the third element tree.
[0089] For example, in conjunction with reference Figure 3 and Figure 6 , assuming Figure 3 is a schematic diagram of the first element tree. Figure 6 This is a schematic diagram of the second element tree. Figure 6 and Figure 3 The difference is that the text content of the MIN element (used to define the minimum value of parameter 2) and the MAX element (used to define the maximum value of parameter 2) of parameter 2 is different, and Figure 6 A new DEFAULT-VALUE sub-element is added under parameter 2 (used to define the default value of parameter 2). Figure 6 A new parameter 3 is added. In one implementation, Figure 6 The PARAMETERS element and the elements under PARAMETERS (such as parameters 1-3) are recorded in the third element tree. In one implementation, you can compare them one by one. Figure 6 and Figure 3 The elements in Figure 6 Compared to Figure 3 The modified or newly added content is recorded as the first difference content in the third element tree. For example, the third element tree may include parameter 3 and may also include Figure 6 Elements at all levels under parameter 2.
[0090] The embodiment of the present application does not limit the name and number of tags in the preset configuration tag set. If the element represented by the tag is missing (for example, missing sub-elements or text content, etc.), which may affect the BSW development, the tag can be set as a preset configuration tag in the preset configuration tag set. For example, the preset configuration tag set can include one or more of the following tags defined in the AUTOSAR specification: MULTIPLICITY-CONFIG-CLASSES, VALUE-CONFIG-CLASSES, SUPPORTED-CONFIG-VARIANTS.
[0091] In one implementation, Figure 5 As shown, the difference between the first element tree and the second element tree is recorded in the third element tree, and it also includes: when the first element and the second element both include sub-elements and the preset configuration label set does not include the label of the first element or the second element, the sub-elements of the first element and the second element are compared one by one, and the third element is recorded in the third element tree or the third element and the elements at all levels in the third element are recorded in the third element; the third element includes sub-elements that are inconsistent between the first element and the second element.
[0092] Assume that the second element includes the third element, and the third element is a sub-element of the second element. When the first element does not include the third element (that is, when the third element exists in the second element tree but not in the first element tree), if the third element does not include sub-elements, the third element can be recorded in the third element tree; if the third element includes sub-elements, the third element and all levels of elements in the third element can be recorded in the third element tree. For example, Figure 3 The PARAMETERS element can be used as the first element, Figure 6 The PARAMETERS element can be used as the second element. For the PARAMETERS element, Figure 6 includes parameter 3, and Figure 3 Parameter 3 is not included, at this time, the third element includes parameter 3. In this case, parameter 3 can be recorded in the third element tree.
[0093] Furthermore, when one or more elements in the third element tree lack parent elements, the corresponding parent elements can be added to the third element tree. For example, when the third element tree does not include the second element, the second element is recorded in the third element tree as the parent element of the third element. In this way, the integrity of the difference content is improved and errors are reduced by adding parent elements.
[0094] In one implementation, recording the difference between the first element tree and the second element tree in a third element tree also includes: when neither the first element nor the second element includes a sub-element, comparing the text content of the first element and the second element; when the text content of the first element and the second element is different, recording the second element in the third element tree.
[0095] Further, when one or more sub-elements of the second element exist only in the first element tree but not in the second element tree, an error message is generated (for the sake of distinction, it can be referred to as the first error message). For example, the first element includes the fourth element, and the fourth element is a sub-element of the first element. When the first element includes the fourth element and the second element does not include the fourth element, an error message is generated. For example, Figure 6 The PARAMETERS element can be used as the first element, Figure 3 The PARAMETERS element can be used as the second element. Figure 6 The PARAMETERS element includes a SHORT-NAME element that defines parameter 3, and Figure 3 This element is not included in the , and can be used as the fourth element. In this case, an error message is generated and the process is terminated.
[0096] In the above embodiments, the first element and the second element can be parent elements other than the root element. In other embodiments, the child elements of any level under the parent element can also be compared using the methods mentioned in the above embodiments. Recording elements in the element tree mentioned in the embodiments of the present application refers to recording the element's label and / or text content.
[0097] In one implementation, the processing method of the present application can also update VSMD files of different versions. The processing method of any of the above configuration files can also include:
[0098] Obtaining a second difference file; the second difference file is determined based on a second standard configuration file and a second custom configuration file, the second custom configuration file matches the second standard configuration file; the second standard configuration file matches the first standard configuration file;
[0099] The second difference file and the first difference file are merged to determine a third difference file; the third difference file is used to update the first custom configuration file or the second custom configuration file.
[0100] Please refer to Figure 7 , which is a schematic diagram of a process for updating different versions of VSMD files provided in an embodiment of the present application. Figure 7 As shown, the second difference file can be modified to generate a new second difference file, which can be used to update the second custom configuration file. Furthermore, the second difference file can also be merged with the first difference file to form a third difference file. The second standard configuration file matches the first standard configuration file, that is, the first standard configuration file and the second standard configuration file are used to configure the same BSW module. The versions of the first standard configuration file and the second standard configuration file may be different. The content in the first custom configuration file can be synchronously updated to the second custom configuration file through the third difference file, or the content in the second custom configuration file can be synchronously updated to the first custom configuration file. For example, assume that the first standard configuration file is the StMD file of the source version, the first custom configuration file is the VSMD file of the source version, the second standard configuration file is the StMD file of the target version, and the second custom configuration file is the VSMD file of the target version. As Figure 2 As shown, the old VSMD file (the first custom configuration file) can be compared with the source version StMD file (the first standard configuration file) to obtain a source version difference file (the first difference file). Figure 7 As shown, the target version VSMD file (the second custom configuration file) is compared with the target version StMD file (the second standard configuration file) to obtain the target version difference file (the second difference file). Using the ARXML merge tool, the source version difference file and the target version difference file can be merged to obtain a new difference file (the third difference file), which can be used to update the target version VSMD file or the source version VSMD file.
[0101] In one implementation, for elements with the same label in the first difference file and the second difference file, when merging the first difference file and the second difference file, the text content of the element can be replaced according to the version of the StMD file corresponding to the difference file to update the corresponding element, thereby further improving development efficiency. For example, suppose that the first difference file includes the fifth element, the second difference file includes the sixth element, and the labels of the fifth element and the sixth element are the same. When the version of the second standard configuration file is higher than the version of the first standard configuration file, the text content of the fifth element is updated in the third difference file according to the text content of the sixth element. When the version of the second standard configuration file is lower than the version of the first standard configuration file, the text content of the sixth element is updated in the third difference file according to the text content of the fifth element.
[0102] In one implementation, according to the difference between the two versions of StMD, the new difference file of the target version is checked and adjusted to improve reliability and prevent errors.
[0103] The above method for determining the second difference file is similar to that for the first difference file. For example, the second standard configuration file includes a third element tree, and the second custom configuration file includes a fourth element tree. The configuration file processing method also includes: comparing the third element tree with the fourth element tree, and recording the difference between the third element tree and the fourth element tree in a fifth element tree; based on the fifth element tree, determining the second difference file. The comparison process of the third element tree and the fourth element tree can refer to the comparison process of the first element tree and the second element tree (for example, the comparison can be based on the label of the element tree or the comparison can be performed element by element, etc.), which is not repeated here.
[0104] Based on the same technical concept, this application also provides a configuration file processing device. Figure 8 , which is a schematic diagram of the structure of a configuration file processing device provided in an embodiment of the present application. Figure 8 As shown, the processing device 800 includes a processor 810, which is used to call instructions stored in a memory 820. When the instructions are called by the processor 810, the processor 810 executes the processing method in any of the above embodiments.
[0105] The embodiment of the present application also provides a terminal device, including the processing device of the above configuration file. The embodiment of the present application does not limit the type of the terminal device, for example, the terminal device includes a personal computer or a mobile terminal. The embodiment of the present application also provides a computer program product, including instructions, wherein when the instructions are executed by a processor, the processing method in any of the above embodiments is executed.
[0106] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. In addition, the above embodiments can be freely combined as needed.< / containers> < / parameters>
Claims
1. A method for processing a configuration file, characterized in that: Applied to the basic software development of electronic control units, the processing method includes: Acquire a first standard configuration file and a first custom configuration file; the first custom configuration file matches the first standard configuration file; the first standard configuration file includes a first element tree, and the first custom configuration file includes a second element tree; Comparing the first element tree with the second element tree, and recording first difference content between the first element tree and the second element tree in a third element tree; Based on the third element tree, a first difference file is determined; the first difference file is used to update the first custom configuration file; and the iteration of the first difference file is achieved by modifying or adjusting the first difference file; The first element tree includes a first element, the second element tree includes a second element, the first element and the second element are used to indicate the same configuration content, and recording the first difference content between the first element tree and the second element tree in a third element tree includes: When the first element and the second element are different, and both the first element and the second element include sub-elements, determining whether the preset configuration tag set includes a tag of the first element or a tag of the second element; When the preset configuration tag set includes the tag of the first element or the second element, recording the second element and elements of each level in the second element in the third element tree; When the preset configuration label set does not include the label of the first element or the second element, the sub-elements of the first element and the second element are compared one by one, and the third element is recorded in the third element tree or the third element and the elements at all levels in the third element are recorded in the third element; the third element includes the sub-elements that are inconsistent between the first element and the second element.
2. The processing method according to claim 1, characterized in that: The processing method also includes: When the third element tree does not include the second element, the second element is recorded in the third element tree as a parent element of the third element.
3. The processing method according to claim 1, characterized in that: Also includes: When neither the first element nor the second element includes a sub-element, comparing the text contents of the first element and the second element; When the text contents of the first element and the second element are different, recording the second element in the third element tree; and / or, When the first element includes a fourth element and the second element does not include the fourth element, a first error message is generated; the fourth element is a sub-element of the first element.
4. The processing method according to claim 1, characterized in that: Also includes: Comparing the first file information with the second file information; the first file information includes the module information and version information of the first standard configuration file, and the second file information includes the module information and version information of the first custom configuration file; When the first file information and the second file information are consistent, determining that the first custom configuration file and the first standard configuration file match; When the first file information and the second file information are inconsistent, second error information is generated.
5. The processing method according to any one of claims 1 to 4, characterized in that: Also includes: Acquire a second difference file; the second difference file is determined based on a second standard configuration file and a second custom configuration file, the second custom configuration file matches the second standard configuration file; the second standard configuration file matches the first standard configuration file; The second difference file and the first difference file are combined to determine a third difference file; the third difference file is used to update the first custom configuration file or the second custom configuration file.
6. The processing method according to claim 5, characterized in that: The second standard configuration file includes a third element tree, the second custom configuration file includes a fourth element tree, and the processing method further includes: Comparing the third element tree with the fourth element tree, and recording the second difference between the third element tree and the fourth element tree in a fifth element tree; Based on the fifth element tree, the second difference file is determined.
7. The processing method according to claim 5, characterized in that: The first difference file includes a fifth element, the second difference file includes a sixth element, the fifth element and the sixth element have the same label, When the version of the second standard configuration file is higher than the version of the first standard configuration file, updating the text content of the fifth element in the third difference file according to the text content of the sixth element; When the version of the second standard configuration file is lower than the version of the first standard configuration file, the text content of the sixth element is updated in the third difference file according to the text content of the fifth element.
8. A configuration file processing device, characterized in that: The method comprises a processor for calling instructions stored in a memory, wherein when the instructions are called by the processor, the processor executes the processing method according to any one of claims 1 to 7.
9. A terminal device, characterized in that: Comprising the processing device as claimed in claim 8.
10. A computer program product, characterized in that The method comprises instructions, and when the instructions are called by a processor, the processing method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Configuration file updating method and device, equipment and computer medium
CN117873548A