An embedded framework generation method and device, electronic equipment and storage medium
By dividing the vehicle controller into functional modules and binding event state relationships, a general code framework is generated, which solves the problems of low versatility and efficiency in vehicle controller development and enables efficient development across language systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies for vehicle controllers suffer from low versatility and development efficiency. The lack of standardized software frameworks means that vehicle controllers developed using different programming languages still require custom architecture design, resulting in low development efficiency.
By acquiring the development requirements of the vehicle controller, functional modules are divided, module rule tables and event state relationships are determined, module framework files are generated, and a general code framework structure is established to adapt to the development of vehicle controllers using multiple language systems.
It improves the development efficiency and versatility of vehicle controllers, reduces errors in handwritten framework files, and shortens the development cycle.
Smart Images

Figure CN116483331B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of new energy vehicle technology, specifically to an embedded frame generation method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the rapid development of new energy vehicles, more and more automotive equipment is incorporating intelligent features. As the technological level of various industrial chains within the automotive industry continues to advance, consumers' demands for automotive intelligence are also constantly increasing. The vehicle definition model has evolved from the initial "mechanical definition" to "electrical and electronic definition," and now to the era of "software definition" and "intelligent vehicles." With the increasing application of electronic and electrical products in vehicles, the number of vehicle controllers has rapidly increased from dozens to over a hundred. The more vehicle controllers there are, the greater the human and time costs for automotive companies, posing a significant challenge to the overall vehicle development cycle. In the current environment where various emerging car manufacturers are rapidly rising and seizing market share, the speed of vehicle development may determine the survival of a car company. In other words, the development efficiency of vehicle controllers is extremely important for a car company.
[0003] For example, CN112394937A discloses an embedded code generation method and apparatus. This embedded code generation method includes: obtaining the system configuration file of the project to be generated; obtaining, based on the system configuration file, a set of modules and a set of configuration interfaces corresponding to the project to be generated from a pre-set module pool and configuration interface pool; obtaining a user configuration file; and generating the embedded code of the project to be generated based on the user configuration file and the module set. The above solutions initialize the controller itself using DBC or EXCEL configuration files, improving the efficiency and accuracy of software development under the new energy vehicle controller software architecture. However, this method and apparatus focus more on initializing and configuring various vehicle controllers at the initial stage of the project, solving the problem of manually editing a large number of vehicle signal quantities during vehicle controller development. It is only applicable to controllers developed using the C language architecture, and developers still need to manually code and design the software framework in subsequent business development. In the development process of vehicle controllers, related technologies lack universality and cannot well adapt to vehicle controllers using multiple language systems. The development of some vehicle controllers still requires developers to develop them themselves. There is a lack of a complete software framework; vehicle controllers using different language systems need to design their own architectures based on software logic. The lack of a standardized software framework leads to low development efficiency. Summary of the Invention
[0004] In view of the shortcomings of the prior art described above, the present invention provides an embedded framework generation method, apparatus, electronic device and storage medium to solve the above-mentioned technical problems of low versatility and low development efficiency in vehicle controller development.
[0005] This invention provides an embedded framework generation method, comprising: acquiring development requirement information of a vehicle controller; dividing the vehicle controller into functional modules according to the development requirement information to obtain functional information of multiple functional modules, and determining a module rule table for each functional module based on module attributes in the functional information; determining module working state information and module event information of each functional module based on the functional information, and determining an event state relationship of each functional module based on the module working state information and the module event information; generating a module framework file for each functional module based on the module event information, the module rule table, and the event state relationship, and generating an embedded framework file for the vehicle controller based on the module framework file of each functional module.
[0006] In one embodiment of the present invention, the switching relationship of the working state is determined according to the module working state information to obtain state transition information; the module event information and the state transition information are bound together to obtain the event state relationship of the functional module.
[0007] In one embodiment of the present invention, an initial framework file is generated based on the module rule table and the event state relationship, and the initial framework file is placed in the folder path of the module rule table. The initial framework file includes a main task function file, an event state matrix function file, and an event processing interface function file. The main task function file is used to receive messages passed through the preset message module and distribute them to the event state matrix function file. The event processing interface stored in the event state matrix function file calls the event processing interface function file to process the external messages. The preset message module file is used to pass through messages between multiple functional modules. The interface of the initial framework file is configured according to the module event information to obtain a module framework file of the functional module. A controller entry file is generated based on the main task function files of the module framework files of all functional modules. An embedded framework file of the vehicle controller is generated based on the controller entry file and the module framework files of all functional modules.
[0008] In one embodiment of the present invention, a function name is generated by concatenating the module rule table and the event state relationship; an initial framework file is generated based on the function name and a preset language format template. In another embodiment of the present invention, an interface definition file is generated based on the main task function file, the event state matrix function file, and the event handling interface function file; interface parameters of the function interface definition file are configured according to the event types of the module event information; and interface parameters of the main task function file, the event state matrix function file, and the event handling interface function file are configured based on the configured function interface definition file to obtain a module framework file for the functional module.
[0009] In one embodiment of the present invention, the preset message sending and receiving template is modified based on the module rule table of each functional module to obtain the module message sending and receiving function; the interface of the module message sending and receiving function is stored in the preset message module file.
[0010] In one embodiment of the present invention, the event processing content is filled into the event processing interface function file of each of the modules based on the event information of each module; the interface of the controller entry file of multiple vehicle controllers is placed in the preset source project call entry function for embedded framework file call, so that the vehicle processes the messages received by multiple vehicle controllers through the preset source project call entry function.
[0011] This invention provides an embedded framework generation device, comprising: an information acquisition module for acquiring development requirement information of a vehicle controller; a function partitioning module for partitioning the vehicle controller according to the development requirement information to obtain function information of multiple function modules, and determining a module rule table for each function module based on module attributes in the function information; a relationship determination module for determining module working state information and module event information of each function module based on the function information, and determining an event state relationship of each function module based on the module working state information and the module event information; and a framework generation module for generating a module framework file for each function module based on the module event information, the module rule table, and the event state relationship, and generating an embedded framework file for the vehicle controller based on the module framework file of each function module.
[0012] The present invention also provides an electronic device, the electronic device comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device enables the embedded framework generation method as described in any of the above embodiments.
[0013] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer processor, causes the computer to perform the embedded framework generation method as described in any of the above embodiments.
[0014] Beneficial effects of the invention: This invention provides an embedded framework generation method, apparatus, electronic device, and storage medium. In this invention, the vehicle controller is divided into multiple functional modules according to development requirements, and the module's working state and event category are determined for each functional module, simplifying the design process. Furthermore, the module's working state and event category are bound and combined to obtain event state relationships. A complete embedded framework can be generated through these event state relationships, allowing developers to focus on processing the corresponding event states, improving development efficiency and shortening the development cycle. Simultaneously, naming rules can be defined for multiple functional modules using a rule table, and embedded framework files are generated based on the event state relationships and naming rules, reducing potential errors in hand-written framework files and improving development versatility.
[0015] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0017] Figure 1 A flowchart illustrating an embedded framework generation method according to an embodiment of the present invention is shown;
[0018] Figure 2 A flowchart illustrating the implementation of an embedded framework generation method according to an embodiment of the present invention is shown.
[0019] Figure 3 A schematic diagram of an embedded frame design according to an embodiment of the present invention is shown;
[0020] Figure 4 A block diagram of an embedded frame generation apparatus according to an embodiment of the present invention is shown;
[0021] Figure 5 A schematic diagram of a computer system suitable for implementing embodiments of the present invention is shown. Detailed Implementation
[0022] The embodiments of the present invention will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention and not for limiting the scope of protection of the present invention.
[0023] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0024] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0025] Please see Figure 1 , Figure 1 A flowchart illustrating an embedded framework generation method according to an embodiment of the present invention is shown. Figure 1 As shown, in an exemplary embodiment, the embedded framework generation method includes at least steps S110 to S140, which are described in detail below:
[0026] Step S110: Obtain the development requirements information for the vehicle controller.
[0027] In one embodiment of the present invention, the development requirements information of the vehicle controller includes, but is not limited to, the requirements of the vehicle controller at the next higher level (such as the functional requirements of the whole vehicle), the functional requirements and safety requirements of the vehicle controller at this level, and the functional requirements of the sub-controllers in the vehicle controller.
[0028] Step S120: The vehicle controller is functionally divided according to the development requirements information to obtain the functional information of multiple functional modules, and a module rule table of a functional module is determined based on the module attributes in the functional information.
[0029] In one embodiment of the present invention, based on the development requirements of the vehicle controller, the entire vehicle controller system can be divided into multiple functional modules, yielding functional information for each module. This functional information includes, but is not limited to, module functions and module attributes. For example, the development of the T-Box can be broken down into more than twenty modules, such as a power module, a serial external device interface module (SPI module), a configuration module, a remote control module, a positioning module, and a diagnostic module. This detailed decomposition of development requirements further allows for the modular approach to be planned and implemented from the initial stages of the project.
[0030] In one embodiment of the present invention, the refined functional modules are sequentially filled into a preset rule table according to their module attributes to obtain a module rule table. Module attributes include, but are not limited to, the hierarchical level and module name of a functional module. The rule table includes, but is not limited to, the code level of the functional module, module name, module abbreviation interface prefix, and code language; interface prefixes include, but are not limited to, filenames, external interface names, internal interface names, and static variable names, among more than ten other prefix names. Unified naming management can improve code readability for both developers and managers during later code reviews and development, resulting in clearer functional logic and easier code management.
[0031] Step S130: Determine the module working status information and module event information of a functional module based on the functional information, and determine the event status relationship of a functional module based on the module working status information and module event information.
[0032] In one embodiment of the present invention, module operating status information and module event information are obtained based on the module functions in the functional information. The module operating status information includes the operating state of a functional module, such as idle state, initialization state, running state, and stopped state. The module event information includes the event signal category and message category of a functional module. Event signals can be abstract signal changes, such as pin changes and temperature changes; for example, a power supply module of our controller may handle events such as over-temperature, high voltage, and low voltage, and we need to define an interface for each type of event.
[0033] In one embodiment of the present invention, after an event signal enters a functional module, it is mainly divided into state transition events and message events. State transition events are responsible for switching the working state of the functional module, while message events are responsible for the actual function corresponding to the functional module.
[0034] In one embodiment of the present invention, the switching relationship of the working state is determined based on the module working state information. For example, when the system starts, the functional module is initially in an idle state. After receiving a start signal, it will switch to the initialization state. After initialization is completed, it will switch to the running state. In the normal running state, if a "stop" electrical signal is received, it will switch to the stop state to shut down the relevant services.
[0035] In one embodiment of the present invention, module event information and state transition information are bound together to obtain the event state relationship of a functional module. This event state relationship can be represented by an event state matrix structure. Even if the same event is triggered in different module operating states, different tasks can be handled under this event state matrix structure.
[0036] In one embodiment of the present invention, the working states of n functional modules are included in a state set M1, M1 = {m1, m2, ..., m n}; Include the i module events that the functional module may process into the event set M2.
[0037] M2={m1,m2,...,m i} where n, i≥2. The i*n event state relationships are generated through M1×M2. By designing and editing the workflow diagram, the state transitions of functional modules are bound to module events. For example, when multiple module working states receive events such as service start events, service stop events, over-temperature events, and over-pressure events, the module working states and module events are switched, forming a complete data linked list. Finally, files in formats including but not limited to wsd, pu, puml, and plantuml are generated and placed in the corresponding functional module's folder directory.
[0038] Step S140: Generate a module framework file for a functional module based on module event information, module rule table and event state relationship, and generate an embedded framework file for the vehicle controller based on the module framework file of each functional module.
[0039] In one embodiment of the present invention, the vehicle controllers for new energy vehicles mainly involve coding languages such as C / C++, Java, and Python. A common code framework structure is established for each coding language, including but not limited to preset language format templates and preset message sending / receiving templates. By generating different types of common code frameworks for different vehicle controllers, different programming languages are generated, further adapting to the different languages used in the development of different vehicle controllers, thereby establishing a complete and sound software development framework architecture for new energy vehicle controllers.
[0040] In one embodiment of the present invention, function names are generated by concatenating the module rule table and event state relationships; an initial framework file is generated based on the function names and a preset language format template. A running script is written using a server-side scripting language to iteratively read code levels, module names, module abbreviations, and interface prefixes from the module rule table, along with interface and file naming definitions. Then, all workflow diagrams are polled from the folder of each functional module to obtain the module working states, module events, and event state switching relationships for that functional module. The module abbreviation, interface prefix, module working state, and module events are concatenated to generate function names, and an initial framework file is generated based on the function names and the preset language format template. The initial framework file is placed in the folder path of the module rule table. The initial framework file includes a main task function file, an event state matrix function file, and an event processing interface function file. The main task function file receives messages passed through the preset message module and distributes them to the event state matrix function file. The event processing interface file stored in the event state matrix function file calls the event processing interface function file to process messages from outside the module. The preset message module file is used to pass through messages between multiple functional modules.
[0041] In one embodiment of the present invention, to handle communication issues between functional modules, an additional message module is generated outside the divided functional modules to handle message sending and receiving. Messages include, but are not limited to, operational data generated during vehicle controller operation and external command messages. For different languages, message sending and receiving templates, such as message queues and ZMQ protocols, are preset in the general code framework. A message delivery and publish-subscribe mechanism is established based on the number of modules. Within the framework, message serialization and deserialization are performed, and preset message module transmission files are generated using the preset message sending and receiving templates to complete message pass-through. This allows developers to focus solely on the messages themselves, without needing to overly concern themselves with the message delivery process, and to concentrate on developing functionalities related to event states.
[0042] In one embodiment of the present invention, the preset message sending and receiving template is modified based on the module rule table of each functional module to obtain the module message sending and receiving function; the interface of the module message sending and receiving function is stored in the preset message module file.
[0043] In one embodiment of the present invention, an interface configuration is performed on an initial framework file based on module event information to obtain a module framework file for a functional module. An interface definition file is generated based on the main task function file, the event state matrix function file, and the event handling interface function file. This interface definition file stores the standardized function names, and the interface parameters of the functions in the function interface definition file are configured according to the event types in the module event information. By running a script and configuring the interface parameters of the main task function file, the event state matrix function file, and the event handling interface function file using the configured function interface definition file, a module framework file for a functional module is obtained.
[0044] In one embodiment of the present invention, a controller entry file is generated based on the main task function file of the module framework file in all functional modules; and an embedded framework file of the vehicle controller is generated based on the controller entry file and the module framework files of all functional modules.
[0045] In one embodiment of the present invention, event processing content is filled into the event processing interface function file based on the event information of each module to obtain event processing capability; the interface of the controller entry file of multiple vehicle controllers is placed in the preset source project call entry function for embedded framework file call, so that the vehicle processes the messages received by multiple vehicle controllers through the preset source project call entry function, where the preset source project is the entry project of multiple vehicle controllers.
[0046] In one embodiment of the present invention, please refer to Figure 2 , Figure 2 A schematic flowchart illustrating the implementation of an embedded framework generation method according to an embodiment of the present invention is shown. Figure 2As shown, step S210 involves requirement input, decomposing functional modules, and formulating a module rule table: Based on the obtained development requirement information of the vehicle controller, the vehicle controller is functionally divided to obtain functional information of multiple functional modules. A module rule table for a functional module is determined based on this functional information. The module rule table is mainly used to formulate naming rules. Step S220 involves formulating a workflow diagram for module working states and module events: Based on the functional information, the module working state information and module event information of a functional module are determined. The switching relationship between working states is determined based on the module working state information to obtain state transition information. The module event information and state transition information are bound together to obtain the event state relationship of a functional module. A workflow diagram is obtained through the event state relationship. Step S230 involves obtaining the event state relationship from the workflow diagram and obtaining the naming rules from the module rule table. Then, generate the initial framework file: Function names are generated by concatenating the event state relationships and module rule tables. The initial framework file is generated based on the function names and a preset language format template. Step S240: Set interface parameters for the initial framework file to obtain the module framework file: Generate an interface definition file based on the initial framework file. The interface definition file stores the standardized function names. Configure the interface parameters of the functions in the function interface definition file according to the event types of the module event information. The interface parameter configuration of the initial framework file is completed uniformly through the function interface location file. Step S250: Generate an embedded framework file based on the module framework file: Generate the controller entry file based on the main task function files in the module framework files of all functional modules. Generate the vehicle controller's embedded framework file based on the controller entry file and the module framework files of all functional modules.
[0047] In one embodiment of the present invention, please refer to Figure 3 , Figure 3 A schematic diagram of an embedded frame design according to an embodiment of the present invention is shown. Figure 3 As shown, messages from multiple functional modules are sent and received through a message pipe (i.e., a message module). The functional module completes the event status processing by listening to the messages passed through the message module.
[0048] Please see Figure 4 , Figure 4 A block diagram of an embedded frame generation apparatus according to an embodiment of the present invention is shown. Figure 4 As shown, an embedded framework generation device 400 according to an embodiment of the present invention includes: an information acquisition module 401, a rule determination module 402, a relationship determination module 403, and a framework generation module 404.
[0049] The system includes: an information acquisition module 401 for acquiring development requirements information for the vehicle controller; a rule determination module 402 for dividing the vehicle controller into functional modules based on the development requirements information, obtaining functional information for multiple functional modules, and determining a module rule table for a functional module based on the module attributes in the functional information; a relationship determination module 403 for determining the module working status information and module event information of a functional module based on the functional information, and determining the event status relationship of a functional module based on the module working status information and module event information; and a framework generation module 404 for generating a module framework file for a functional module based on the module event information, module rule table, and event status relationship, and generating an embedded framework file for the vehicle controller based on the module framework file of each functional module.
[0050] It should be noted that the embedded framework generation device and the embedded framework generation method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments, and will not be repeated here. In practical applications, the embedded framework generation device provided in the above embodiments can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not a limitation here.
[0051] Embodiments of the present invention also provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device enables the embedded framework generation method provided in the above embodiments.
[0052] Figure 5 A schematic diagram of a computer system suitable for implementing embodiments of the present invention is shown. It should be noted that... Figure 5 The computer system 500 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0053] like Figure 5As shown, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes, such as executing the methods provided in the various embodiments above, based on a program stored in Read-Only Memory (ROM) 502 or a program loaded from storage portion 508 into Random Access Memory (RAM) 503. The RAM 503 also stores various programs and data required for system operation. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0054] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 510 as needed so that computer programs read from them can be installed into storage section 508 as needed.
[0055] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs various functions defined in the system of the present invention.
[0056] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0057] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0058] The units described in the embodiments of the present invention can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0059] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer's processor, causes the computer to perform the embedded framework generation method provided in the above embodiments. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.
[0060] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. An embedded framework generation method, characterized by, The embedded framework generation method comprises: obtaining development requirement information of a vehicle controller; dividing functions of the vehicle controller according to the development requirement information, obtaining function information of a plurality of function modules, and determining a module rule table of the function module based on module attributes in the function information; determining module working state information and module event information of the function module based on the function information, and determining an event state relationship of the function module according to the module working state information and the module event information; generating a module framework file of the function module according to the module event information, the module rule table and the event state relationship, and generating an embedded framework file of the vehicle controller based on the module framework file of each function module; specifically comprising: generating an initial framework file based on the module rule table and the event state relationship, and placing the initial framework file in a folder path of the module rule table; wherein generating the initial framework file based on the module rule table and the event state relationship comprises: splicing a function name according to the module rule table and the event state relationship; and generating the initial framework file based on the function name and a preset language format template.
2. The method of claim 1, wherein, determining an event state relationship of the function module based on the module working state information and the module event information comprises: determining a switching relationship of working states according to the module working state information, to obtain state transition information; binding the module event information and the state transition information to obtain the event state relationship of the function module.
3. The method of claim 2, wherein, generating a module framework file of the function module according to the module event information, the module rule table and the event state relationship, and generating an embedded framework file of the vehicle controller based on the module framework file of each function module comprises: the initial framework file comprises a main task function file, an event state matrix function file and an event processing interface function file, the main task function file is used for receiving a message transmitted by a preset message module and distributing the message to the event state matrix function file, event processing of an external message of the module is performed by calling the event processing interface function file through an event processing interface stored in the event state matrix function file, and the preset message module file is used for transmitting messages between a plurality of function modules; performing interface configuration on the initial framework file according to the module event information, to obtain a module framework file of the function module; generating a controller entry file based on the main task function file of the module framework file in all function modules; generating the embedded framework file of the vehicle controller according to the controller entry file and the module framework file of all function modules.
4. The method of claim 3, wherein, performing interface configuration on the initial framework file according to the module event information, to obtain a module framework file of the function module comprises: generating an interface definition file according to the main task function file, the event state matrix function file and the event processing interface function file; configuring an interface parameter of the function interface definition file according to an event type of the module event information; Based on the configured function interface definition file, interface parameters of the main task function file, the event state matrix function file and the event processing interface function file are configured to obtain a module framework file of the function module.
5. The method of claim 3-4, wherein, After generating the initial framework file based on the module rule table and the event state relationship, the embedded framework generation method further includes: Based on the module rule table of each function module, a preset message transmission template is modified to obtain a module message transmission function; The interface of the module message transmission function is stored in the preset message module file.
6. The method of claim 3-4, wherein, After generating the embedded framework file of the vehicle controller based on the module framework file of each function module, the embedded framework generation method further includes: Based on the module event information, the event processing interface function file is filled with event processing content; The interface of the controller entry file of the plurality of vehicle controllers is placed in the preset source project calling entry function for embedded framework file calling, so that the vehicle processes the messages received by the plurality of vehicle controllers through the preset source project calling entry function.
7. An embedded framework generation apparatus, characterized by, The embedded framework generation device includes: An information acquisition module configured to acquire development requirement information of a vehicle controller; A function division module configured to divide the vehicle controller into a plurality of function modules according to the development requirement information to obtain function information of the function modules, and determine a module rule table of the function module based on a module attribute in the function information; A relationship determination module configured to determine module working state information and module event information of the function module based on the function information, and determine an event state relationship of the function module according to the module working state information and the module event information; A framework generation module configured to generate a module framework file of the function module according to the module event information, the module rule table and the event state relationship, and generate an embedded framework file of the vehicle controller based on the module framework file of each function module; specifically including: generating an initial framework file based on the module rule table and the event state relationship, and placing the initial framework file in a folder path of the module rule table; wherein generating the initial framework file based on the module rule table and the event state relationship includes: generating a function name according to the module rule table and the event state relationship; and generating the initial framework file based on the function name and a preset language format template.
8. An electronic device, comprising: The electronic device includes: One or more processors; A storage device configured to store one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the embedded framework generation method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A computer program is stored thereon, which, when executed by a processor of a computer, causes the computer to execute the embedded framework generation method of any one of claims 1 to 6.
Citation Information
Patent Citations
Method, device and equipment for generating control tool, and storage medium
CN110888628A
Automatic driving scheme generation method and device, electronic equipment and storage medium
CN115543297A