RTE code generation method and device and electronic equipment
By obtaining the configuration file and RTE code template of NvBlock SWC, the configuration information in the configuration item tree is generated, which solves the problem of low RTE code development efficiency in the existing technology and realizes the rapid generation of NvBlock SWC to access the basic software non-volatile memory. RTE code, reducing development costs.
Patent Information
- Application Number
- CN202310257037.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2024-09-10
AI Technical Summary
In the existing technology, the development cost of RTE code used by the non-volatile storage block software component (NvBlock SWC) to access the non-volatile memory in the basic software is high and inefficient, requiring manual coding.
By obtaining the configuration file and RTE code template of NvBlock SWC, the configuration information in the configuration item tree is determined, and the RTE code is generated based on this information to realize the function of NvBlock SWC accessing the non-volatile memory in the basic software.
No need to manually write code, quickly generate RTE code that implements NvBlock SWC to access the non-volatile memory of basic software, reducing development costs and improving development efficiency.
Smart Images

Figure CN118626064A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle network technology, and in particular to a method, device and electronic device for generating an RTE code. Background Art
[0002] AUTOmotive Open System Architecture (AUTOSAR) is a standardized automotive software architecture, consisting of the application layer (Application Layer), runtime environment (AUTOSAR Runtime Environment, RTE), basic software (Basic SoftWare, BSW) and electronic control unit hardware (Electronic Control Unit hardware, ECU-Hardware). The functions of the application layer are implemented by multiple software components (SWC), and the RTE layer is responsible for the communication between SWCs in the application layer and the communication between SWC and BSW.
[0003] When the non-volatile storage block software component (Non Volatile Block Software Component, NvBlock SWC) in the application layer needs to access the non-volatile memory in the BSW, it is necessary to use the RTE code used to implement the NvBlockSWC access to the non-volatile memory in the BSW to implement the NvBlock SWC access to the non-volatile memory in the BSW.
[0004] In the related art, the RTE code for implementing NvBlock SWC to access the non-volatile memory in BSW is usually developed manually by developers based on development requirements. However, the development cost of developing the RTE code for implementing NvBlock SWC to access the non-volatile memory in BSW in this way is high, and the development efficiency is relatively low. Summary of the invention
[0005] To this end, the present disclosure proposes a method, device and electronic device for generating an RTE code.
[0006] An embodiment of the present disclosure provides a method for generating RTE code, the method comprising: obtaining a configuration file corresponding to a non-volatile storage block software component NvBlock SWC; obtaining a generation environment RTE code template for implementing NvBlock SWC access to a non-volatile memory in basic software; obtaining a configuration item tree corresponding to the RTE code template; determining, according to the configuration file, configuration information corresponding to each configuration item node in the configuration item tree; and generating RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
[0007] On the other hand, an embodiment of the present disclosure proposes a device for generating RTE code, the device comprising: a first acquisition module, used to acquire a configuration file corresponding to a non-volatile storage block software component NvBlock SWC; a second acquisition module, used to acquire a generation environment RTE code template for implementing NvBlock SWC access to a non-volatile memory in basic software; a third acquisition module, used to acquire a configuration item tree corresponding to the RTE code template; a determination module, used to determine, according to the configuration file, configuration information corresponding to each configuration item node in the configuration item tree; and a generation module, used to generate RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
[0008] Another aspect of the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for generating RTE code disclosed in the embodiment of the present disclosure is implemented.
[0009] Another aspect of the present disclosure is a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are executed by a processor to execute the method for generating RTE code disclosed in the embodiment of the present disclosure.
[0010] Another aspect of the present disclosure provides a computer program product, including computer instructions, which, when executed by a processor, implement the method for generating RTE code disclosed in the embodiment of the present disclosure.
[0011] The technical solution provided by the embodiments of the present disclosure has the following beneficial effects:
[0012] Combined with the configuration file corresponding to NvBlock SWC, the configuration information corresponding to each configuration item node in the configuration item tree corresponding to the RTE code template is quickly determined, and combined with the configuration information corresponding to each configuration item node and the RTE code template, the RTE code that can be used to implement NvBlock SWC access to the non-volatile memory in the basic software is quickly generated. As a result, there is no need to manually write code. Through the configuration file and code template, the RTE code required to implement NvBlock SWC access to the non-volatile memory in the basic software can be generated, which improves the development efficiency of the RTE code.
[0013] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0015] Figure 1 A schematic diagram of a flow chart of a method for generating RTE code provided in an embodiment of the present disclosure;
[0016] Figure 2 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure;
[0017] Figure 3 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure;
[0018] Figure 4 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure;
[0019] Figure 5 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure;
[0020] Figure 6 A schematic diagram of the structure of a device for generating RTE code provided in an embodiment of the present disclosure;
[0021] Figure 7 A schematic diagram of the structure of another RTE code generation device provided in an embodiment of the present disclosure;
[0022] Figure 8 A structural block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0024] The following describes the RTE code generation method, device and electronic device according to the embodiments of the present disclosure with reference to the accompanying drawings.
[0025] Figure 1 A flowchart of a method for generating RTE code provided in an embodiment of the present disclosure. It should be noted that the execution subject of the method for generating RTE code in this example is a device for generating RTE code, which can be implemented by hardware and / or software, and can be an electronic device, or can be configured in an electronic device. The electronic device may include but is not limited to a terminal device, a server, etc., and this embodiment does not specifically limit the electronic device.
[0026] like Figure 1 As shown, the method comprises the following steps:
[0027] Step 101, obtaining a configuration file corresponding to a non-volatile storage block software component NvBlock SWC.
[0028] Among them, the non-volatile storage block software component (NvBlock Software Component, NvBlock SWC) is a software component responsible for supporting the application layer to access the non-volatile memory (NVM).
[0029] In some exemplary embodiments, in order to facilitate the corresponding user to configure NvBlock SWC according to application requirements, the file type of the configuration file corresponding to NvBlock SWC in this example can be a text type, for example, the file type of the configuration file can be xlsx, that is, the configuration file in this example can be an excel file.
[0030] In some examples, in order to facilitate the configuration of the NvBlock SWC, the NvBlock SWC can be configured in an excel file. For example, the relevant configuration items corresponding to the non-volatile data port NvDataPort of the NvBlock SWC, the relevant configuration items of the connection information corresponding to the NvDataPort, the configuration items of the running entity associated with the NvDataPort, and the configuration items corresponding to the NvBlockDescriptor information associated with the NvDataPort can be configured in an excel file. The relevant configuration items corresponding to the non-volatile data port NvDataPort of the NvBlock SWC, the relevant configuration items of the connection information corresponding to the NvDataPort, the configuration items of the running entity associated with the NvDataPort, and the configuration items corresponding to the non-volatile storage block descriptor symbol NvBlockDescriptor information associated with the NvDataPort can be configured in four worksheets in the same excel file.
[0031] Among them, in the worksheet for configuring the non-volatile data port NvDataPort, the name information of the non-volatile data port NvDataPort of NvBlock SWC, the name of the software component to which it belongs, the component type, the name of the running entity runnable associated with NvDataPort, the port type, the write block strategy type triggered by the NvDataPort and other configuration items can be configured.
[0032] Among them, in the work table in which the configuration items of the connection information corresponding to the NvDataPort can be configured, the configuration items corresponding to the port to which the NvDataPort is to be connected can be configured.
[0033] In the worksheet that can configure the running entity associated with NvDataPort, the running entity name, the software component to which the running entity belongs, the trigger type corresponding to the running entity, the trigger period corresponding to the running entity and other configuration items can be configured in the worksheet. The trigger type corresponding to the running entity may include data reception event triggering and time event triggering.
[0034] Among them, in the work table that can configure the NvBlockDescriptor information associated with the NvDataPort, the NvBlockDescriptor name, the SWC to which the NvBlockDescriptor belongs, whether the DirtyFlag dirty flag mechanism is supported, whether the immediate write strategy is supported, whether the power-off write strategy is supported, whether the periodic write strategy is supported, the corresponding cycle time when the periodic write strategy is supported, the corresponding random access memory name, the Nv Port (including PPort and RPort) belonging to the Nv Block SWC and the mapping of the RAM Block data type and other configuration items can be configured in the work table.
[0035] Step 102 : Obtain a generation time environment (RTE) code template for implementing NvBlock SWC access to a non-volatile memory in basic software.
[0036] Step 103: Obtain the configuration item tree corresponding to the RTE code template.
[0037] The configuration item tree in this example is pre-built according to each configuration item in the RTE code template. That is, each configuration item node in the configuration item tree corresponds to each configuration item one by one, and the connection edges between each configuration item node are used to describe the relationship between each configuration item.
[0038] Step 104: Determine configuration information corresponding to each configuration item node in the configuration item tree according to the configuration file.
[0039] In some exemplary embodiments, a possible implementation method for determining the configuration information corresponding to each configuration item node in the configuration item tree according to the configuration file is: parsing the configuration file to parse out the configuration information of all configuration items in the configuration file; determining the configuration information of each configuration item node in the configuration item tree according to the configuration information of all the parsed configuration items, wherein each configuration item node in the configuration item tree corresponds one-to-one to each parsed configuration item. Thus, the configuration information of each configuration item node in the configuration item tree is accurately determined by the configuration information of the configuration items parsed from the configuration file.
[0040] Step 105: Generate RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
[0041] In some examples, the final RTE code may be generated through the code engine template according to the configuration information corresponding to each configuration item node and the RTE code template.
[0042] Among them, other possible implementation methods for generating RTE code according to the configuration information corresponding to each configuration item node and the RTE code template will be described in subsequent embodiments and will not be repeated here.
[0043] It should be noted that, in this example, the NvBlock SWC can access the non-volatile memory in the basic software through the RTE code. This makes it convenient for the NvBlock SWC to write the non-volatile data to be saved into the non-volatile memory in the basic software through the RTE code, and it is convenient for the NvBlock SWC to read the non-volatile data from the non-volatile storage memory in the basic software through the RTE code.
[0044] In this example, the RTE code template and the configuration information corresponding to the NvBlock SWC can be used to generate the RTE code that can be used to implement the NvBlock SWC access to the non-volatile memory in the basic software, which reduces the trouble of manual code writing, reduces the development cost, and improves the efficiency of obtaining the RTE code that can be used to implement the NvBlock SWC access to the non-volatile memory in the basic software.
[0045] The RTE code generation method of the disclosed embodiment, combined with the configuration file corresponding to the NvBlock SWC, quickly determines the configuration information corresponding to each configuration item node in the configuration item tree corresponding to the RTE code template, and combines the configuration information corresponding to each configuration item node and the RTE code template to quickly generate the RTE code that can be used to implement the NvBlock SWC access to the non-volatile memory in the basic software. Therefore, there is no need to manually write code, and the RTE code required to implement the NvBlock SWC access to the non-volatile memory in the basic software can be generated through the configuration file and the code template, thereby improving the development efficiency of the RTE code.
[0046] Figure 2 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure is provided. This embodiment is a further refinement of the above embodiment.
[0047] like Figure 2 As shown, the method may include:
[0048] Step 201, obtaining a configuration file corresponding to a non-volatile storage block software component NvBlock SWC.
[0049] Step 202 : Obtain a generation time environment (RTE) code template for implementing NvBlock SWC access to a non-volatile memory in basic software.
[0050] Step 203: Obtain the configuration item tree corresponding to the RTE code template.
[0051] It should be noted that, for the specific implementation of steps 201 to 203, reference may be made to the relevant description of the embodiments of the present disclosure, which will not be repeated here.
[0052] Step 204: parse the configuration file to obtain configuration information of all configuration items in the configuration file.
[0053] In some examples, the configuration file may be parsed according to a preset parsing rule to parse out configuration information corresponding to all configuration items in the configuration file.
[0054] Step 205: for each configuration item node in the configuration item tree, obtain the target configuration item corresponding to the configuration item node from all the parsed configuration items.
[0055] Among them, each configuration item node in the configuration item tree corresponds one-to-one to each parsed configuration item.
[0056] Step 206: Use the configuration information corresponding to the target configuration item as the configuration information of the configuration item node.
[0057] Step 207: Generate RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
[0058] In this example, combined with the parsing results of the configuration file, the configuration information of each configuration item node in the configuration item tree corresponding to the RTE code template is accurately determined, and based on the configuration information of each configuration item node and the RTE code template, the RTE code that can be used to implement NvBlock SWC access to the non-volatile memory in the basic software is automatically generated, which can efficiently generate RTE code and improve the development efficiency of RTE code.
[0059] Figure 3 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure.
[0060] like Figure 3 As shown, the method may include:
[0061] Step 301, obtaining a configuration file corresponding to the non-volatile storage block software component NvBlock SWC.
[0062] Step 302 : Obtain a generation time environment (RTE) code template for implementing NvBlock SWC access to a non-volatile memory in basic software.
[0063] Step 303: Obtain the configuration item tree corresponding to the RTE code template.
[0064] Step 304: Determine configuration information corresponding to each configuration item node in the configuration item tree according to the configuration file.
[0065] It should be noted that, for the specific implementation of steps 301 to 304, reference may be made to the relevant description of the embodiments of the present disclosure, which will not be repeated here.
[0066] Step 305: determine the location information of each configuration item node in the RTE code template.
[0067] In some examples, the location information of each configuration item node in the RTE code template may be determined according to a pre-stored correspondence between the configuration item node and the location information.
[0068] Step 306: Add the configuration information corresponding to each configuration item node to the RTE code template according to the location information to obtain the RTE code.
[0069] In this example, combined with the parsing results of the configuration file, the configuration information of each configuration item node in the configuration item tree corresponding to the RTE code template is accurately determined, and based on the location information of each configuration item in the RTE code template, the configuration information corresponding to the corresponding configuration item node is added to the RTE code template respectively, so that the RTE code required for implementing NvBlock SWC to access the non-volatile memory in the basic software can be quickly obtained, which improves the development efficiency of the RTE code and reduces the development cost.
[0070] Figure 4 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure.
[0071] like Figure 4 As shown, the method may include:
[0072] Step 401, obtaining a configuration file corresponding to the non-volatile storage block software component NvBlock SWC.
[0073] Step 402 : Obtain a generation time environment (RTE) code template for implementing NvBlock SWC access to a non-volatile memory in basic software.
[0074] Step 403: Obtain the configuration item tree corresponding to the RTE code template.
[0075] Step 404: Determine configuration information corresponding to each configuration item node in the configuration item tree according to the configuration file.
[0076] It should be noted that, for the specific implementation of steps 401 to 404, reference may be made to the relevant description of the embodiments of the present disclosure, which will not be repeated here.
[0077] Step 405: for each configuration item node, determine the code snippet corresponding to the configuration item node according to the configuration information corresponding to the configuration item node.
[0078] Step 406: Generate RTE code according to the code snippets corresponding to each configuration item node and the RTE code template.
[0079] In some examples, a possible implementation method for generating RTE code based on the code snippets corresponding to each configuration item node and the RTE code template is: according to each configuration item, determine the location information of the code snippets corresponding to each configuration item in the RTE code template; according to the location information, add the code snippets corresponding to each configuration item to the RTE code template to obtain the RTE code.
[0080] In this example, according to the configuration information corresponding to the configuration item node, the code snippet corresponding to the configuration item node is accurately determined. In addition, according to the code snippet and RTE code template corresponding to each configuration item node, the RTE code required for NvBlock SWC to access the non-volatile memory in the basic software can be generated efficiently and quickly, thereby reducing the development cost and improving the development efficiency of the RTE code.
[0081] In order to clearly understand the present disclosure, Figure 5 The method for generating the RTE code of this embodiment is described exemplarily.
[0082] Figure 5 A flowchart of another method for generating RTE code provided in an embodiment of the present disclosure.
[0083] like Figure 5 As shown, the method may include:
[0084] Step 501, obtaining a configuration file corresponding to the non-volatile storage block software component NvBlock SWC.
[0085] It should be noted that, for the specific implementation of step 501, reference may be made to the relevant description of the embodiment of the present disclosure, which will not be repeated here.
[0086] Step 502: parse the configuration file to obtain a parsing result.
[0087] The parsing result includes configuration information corresponding to each configuration item configured in the configuration file.
[0088] Step 503: integrate the analysis results to obtain an integrated result.
[0089] Step 504: Determine, based on the integration result, the configuration information corresponding to each configuration item node in the configuration item tree corresponding to the RTE code template.
[0090] Step 505: Generate the RTE code required for NvBlockSWC to access the non-volatile memory in the BSW according to the configuration information corresponding to each configuration item node and the RTE code template.
[0091] It should be noted that, for the specific implementation of step 505, reference may be made to the relevant description of the embodiment of the present disclosure, which will not be repeated here.
[0092] The configuration information corresponding to each configuration item node may be saved in a file in json format.
[0093] Specifically, according to the configuration information corresponding to each configuration item node and the RTE code template, the RTE code required for the NvBlock SWC to access the non-volatile memory in the BSW can be generated through the code template engine.
[0094] In order to implement the above embodiment, the present disclosure also proposes a device for generating an RTE code.
[0095] Figure 6 A schematic diagram of a structure of a device for generating RTE code provided in an embodiment of the present disclosure. It should be noted that the device for generating the RTE code in this example can be implemented in hardware and / or software, and the device for generating the RTE code can be an electronic device, or can be configured in an electronic device. The electronic device can include but is not limited to a terminal device, a server, etc., and this embodiment does not specifically limit the electronic device.
[0096] like Figure 6 As shown, the RTE code generation device 600 may include a first acquisition module 601, a second acquisition module 602, a third acquisition module 603, a determination module 604 and a generation module 605, wherein:
[0097] The first acquisition module 601 is used to acquire a configuration file corresponding to the non-volatile storage block software component NvBlock SWC.
[0098] The second acquisition module 602 is used to acquire a generation time environment RTE code template for implementing NvBlock SWC access to the non-volatile memory in the basic software.
[0099] The third acquisition module 603 is used to acquire the configuration item tree corresponding to the RTE code template.
[0100] The determination module 604 is used to determine the configuration information corresponding to each configuration item node in the configuration item tree according to the configuration file.
[0101] The generating module 605 is used to generate RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
[0102] In one embodiment of the present disclosure, Figure 6 Based on the device embodiment shown, Figure 7 As shown, the determination module 604 may include:
[0103] The parsing unit 6041 is used to parse the configuration file to parse out the configuration information of all configuration items in the configuration file;
[0104] The first determining unit 6042 is used to determine the configuration information of each configuration item node in the configuration item tree according to the configuration information of all the parsed configuration items, wherein each configuration item node in the configuration item tree corresponds one-to-one to each parsed configuration item.
[0105] In one embodiment of the present disclosure, the first determination unit 6042 is specifically used to: for each configuration item node in the configuration item tree, obtain the target configuration item corresponding to the configuration item node from all the parsed configuration items; and use the configuration information corresponding to the target configuration item as the configuration information of the configuration item node.
[0106] In one embodiment of the present disclosure, the generation module 605 may include:
[0107] The second determining unit 6051 is used to determine the location information of each configuration item node in the RTE code template;
[0108] The adding unit 6052 is used to add the configuration information corresponding to each configuration item node to the RTE code template according to the position information to obtain the RTE code.
[0109] In one embodiment of the present disclosure, the generation module 605 may include:
[0110] The third determining unit 6053 is used to determine, for each configuration item node, the code snippet corresponding to the configuration item node according to the configuration information corresponding to the configuration item node;
[0111] The generating unit 6054 is used to generate RTE code according to the code snippets and RTE code templates corresponding to each configuration item node.
[0112] In one embodiment of the present disclosure, the generation unit 6054 is specifically used to: determine the position information of the code snippet corresponding to each configuration item in the RTE code template according to each configuration item; and add the code snippet corresponding to each configuration item to the RTE code template according to the position information to obtain the RTE code.
[0113] It should be noted that the above explanation of the RTE code generation method embodiment is also applicable to the RTE code generation device of this embodiment, and will not be repeated here.
[0114] The RTE code generation device of the disclosed embodiment, in combination with the configuration file corresponding to the NvBlock SWC, quickly determines the configuration information corresponding to each configuration item node in the configuration item tree corresponding to the RTE code template, and in combination with the configuration information corresponding to each configuration item node and the RTE code template, quickly generates the RTE code that can be used to implement the NvBlock SWC access to the non-volatile memory in the basic software. Therefore, there is no need to manually write code, and the RTE code required to implement the NvBlock SWC access to the non-volatile memory in the basic software can be generated through the configuration file and the code template, thereby improving the development efficiency of the RTE code.
[0115] In order to implement the above embodiments, the present disclosure also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method of the above method embodiment is implemented.
[0116] In order to implement the above embodiments, the present disclosure further proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method of the above method embodiment is implemented.
[0117] In order to implement the above embodiments, the present disclosure further proposes a computer program product, on which a computer program is stored. When the computer program is executed by a processor, the method of the above method embodiment is implemented.
[0118] Figure 8 A structural block diagram of an electronic device provided in an embodiment of the present disclosure. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0119] like Figure 8 As shown, the electronic device 10 includes a processor 11, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 12 or a program loaded from a memory 16 to a random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 are also stored in the RAM 13. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0120] The following components are connected to the I / O interface 15: a memory 16 including a hard disk, etc.; and a communication part 17 including a network interface card such as a LAN (Local Area Network) card, a modem, etc., and the communication part 17 performs communication processing via a network such as the Internet; a drive 18 is also connected to the I / O interface 15 as needed.
[0121] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 17. When the computer program is executed by the processor 11, the above-mentioned functions defined in the method of the present disclosure are executed.
[0122] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 16 including instructions, and the instructions can be executed by the processor 11 of the electronic device 10 to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0123] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0124] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0125] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present disclosure includes additional implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present disclosure belong.
[0126] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0127] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0128] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0129] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0130] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present disclosure. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present disclosure.
Claims
1. A method for generating RTE code, characterized in that: The method comprises: Get the configuration file corresponding to the non-volatile storage block software component NvBlock SWC; Get the RTE code template for implementing NvBlock SWC access to non-volatile memory in the base software; Obtain the configuration item tree corresponding to the RTE code template; Determine, according to the configuration file, configuration information corresponding to each configuration item node in the configuration item tree; Generate RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
2. The method according to claim 1, characterized in that Determining, according to the configuration file, configuration information corresponding to each configuration item node of the configuration item tree includes: Parsing the configuration file to obtain configuration information of all configuration items in the configuration file; According to the configuration information of all the parsed configuration items, the configuration information of each configuration item node in the configuration item tree is determined, wherein each configuration item node in the configuration item tree corresponds one-to-one to each parsed configuration item.
3. The method according to claim 2, characterized in that The step of determining the configuration information of each configuration item node in the configuration item tree according to the parsed configuration information of all configuration items includes: For each configuration item node in the configuration item tree, obtaining a target configuration item corresponding to the configuration item node from all parsed configuration items; The configuration information corresponding to the target configuration item is used as the configuration information of the configuration item node.
4. The method according to any one of claims 1 to 3, characterized in that The generating the RTE code according to the configuration information corresponding to each configuration item node and the RTE code template includes: Determine the location information of each configuration item node in the RTE code template; According to the location information, the configuration information corresponding to each configuration item node is added to the RTE code template to obtain the RTE code.
5. The method according to any one of claims 1 to 3, characterized in that: The generating the RTE code according to the configuration information corresponding to each configuration item node and the RTE code template includes: For each configuration item node, determine the code snippet corresponding to the configuration item node according to the configuration information corresponding to the configuration item node; Generate RTE code according to the code snippets corresponding to each of the configuration item nodes and the RTE code template.
6. The method according to claim 5, characterized in that The generating the RTE code according to the code snippets corresponding to each of the configuration item nodes and the RTE code template includes: According to each of the configuration items, determine the position information of the code snippet corresponding to each of the configuration items in the RTE code template; According to the location information, the code snippets corresponding to the various configuration items are added to the RTE code template to obtain the RTE code.
7. A device for generating RTE code, characterized in that: The device comprises: A first acquisition module is used to acquire a configuration file corresponding to a non-volatile storage block software component NvBlock SWC; A second acquisition module is used to acquire a generation time environment RTE code template for implementing NvBlock SWC access to a non-volatile memory in basic software; A third acquisition module is used to acquire a configuration item tree corresponding to the RTE code template; A determination module, used to determine the configuration information corresponding to each configuration item node in the configuration item tree according to the configuration file; The generation module is used to generate RTE code according to the configuration information corresponding to each configuration item node and the RTE code template.
8. The device according to claim 7, characterized in that The determining module comprises: A parsing unit, used to parse the configuration file to parse out configuration information of all configuration items in the configuration file; The first determining unit is used to determine the configuration information of each configuration item node in the configuration item tree according to the configuration information of all the parsed configuration items, wherein each configuration item node in the configuration item tree corresponds one-to-one to each parsed configuration item.
9. The device according to claim 8, characterized in that The first determining unit is specifically configured to: For each configuration item node in the configuration item tree, obtaining a target configuration item corresponding to the configuration item node from all parsed configuration items; The configuration information corresponding to the target configuration item is used as the configuration information of the configuration item node.
10. The device according to any one of claims 7 to 9, characterized in that: The generating module comprises: A second determining unit, configured to determine location information of each configuration item node in the RTE code template; The adding unit is used to add the configuration information corresponding to each configuration item node to the RTE code template according to the location information to obtain the RTE code.
11. The device according to any one of claims 7 to 9, characterized in that: The generating module comprises: A third determining unit is used to determine, for each configuration item node, a code snippet corresponding to the configuration item node according to the configuration information corresponding to the configuration item node; A generating unit is used to generate RTE code according to the code snippets corresponding to each of the configuration item nodes and the RTE code template.
12. The device according to claim 11, characterized in that The generating unit is specifically used for: According to each of the configuration items, determine the position information of the code snippet corresponding to each of the configuration items in the RTE code template; According to the location information, the code snippets corresponding to the various configuration items are added to the RTE code template to obtain the RTE code.
13. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is performed.
Citation Information
Cited By
Automatic generation method, system and device for RTE code of Autosar CP
CN119148996A
