Model code generation method and device

By acquiring template information from the target platform, the model code is automatically converted into a code file adapted to the target platform, solving the problem of low generation efficiency caused by manual code adjustment in existing technologies and achieving efficient model code generation.

CN121597174APending Publication Date: 2026-03-03BEIJING RUNKE GENERAL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511634115.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing technologies require extensive manual code adjustments when converting algorithm models into model code adapted to the target platform, resulting in low generation efficiency.

Method used

By acquiring target model information and the target platform's model framework template, code format template, and code integration template, the model information is automatically converted into code files suitable for the target platform, reducing the workload of manual adjustments.

Benefits of technology

It achieves automated conversion from model to code, significantly shortens code debugging time, and improves the efficiency of model code generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597174A_ABST
    Figure CN121597174A_ABST
Patent Text Reader

Abstract

The invention discloses a model code generation method and device, and relates to the technical field of model code generation. The method comprises the steps of displaying a first configuration interface; in response to a first operation of a user on the model configuration control, the integration type configuration control and the task starting control, obtaining first model information and an integration result type of the target model, and a model framework template, a code format template and a code integration template of the target platform; based on the model framework template, converting the first model information into a first model file of which the model configuration parameters are matched with the model framework template; based on the code format template, converting the first model file into a first code file of which the code format is matched with the code format template; and based on the code integration template, converting the first code file into a second code file matched with the integration result type. According to the invention, the generation efficiency of the model code can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of model code generation technology, and in particular relates to a model code generation method and apparatus. Background Technology

[0002] As the complexity of embedded systems continues to rise, the complexity of their software design, development, testing, and verification also increases accordingly. To address this significant challenge, algorithm-based design methods have emerged, which can greatly improve development efficiency. Simulation verification of the completed algorithm model on the target platform is undoubtedly a crucial step in ensuring system performance and reliability. Before simulating the algorithm model on the target platform, it is necessary to convert the algorithm model into model code adapted to the target platform.

[0003] Currently, the main approach relies on the toolchain provided by Matlab to automatically generate model code adapted to the target platform. However, for target platforms that lack corresponding toolchain support, developers need to first convert the model into code and then manually adjust the code to adapt it to the target platform.

[0004] However, this method requires a significant amount of code debugging time, resulting in low efficiency in generating model code. Summary of the Invention

[0005] This application provides a model code generation method and apparatus that can improve the efficiency of model code generation.

[0006] A first aspect of this application provides a model code generation method, the method comprising: Display the first configuration interface, which includes at least a model configuration control, an integration type configuration control, and a task start control; In response to the user's first operation on the model configuration control, integration type configuration control, and task start control, the system obtains the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform. The target platform is the platform for simulating and verifying the target model. Based on the model framework template, the first model information is converted into a first model file whose model configuration parameters match the model framework template. Based on the code format template, the first model file is converted into a first code file whose code format matches the code format template. Based on the code integration template, the first code file is converted into a second code file that matches the type of the integration result.

[0007] A second aspect of this application provides a model code generation apparatus, the apparatus comprising: The interface display module is used to display the first configuration interface, which includes at least a model configuration control, an integration type configuration control, and a task start control. The information acquisition module is used to respond to the user's first operation on the model configuration control, integration type configuration control and task start control, to acquire the first model information and integration result type of the target model, as well as the model framework template, code format template and code integration template of the target platform. The target platform is the platform for simulation verification of the target model. The file generation module is used to convert the first model information into a first model file whose model configuration parameters match the model framework template, based on the model framework template. The format conversion module is used to convert the first model file into a first code file whose code format matches the code format template, based on the code format template. The file integration module is used to convert a first code file into a second code file that matches the type of the integration result, based on a code integration template.

[0008] A third aspect of the embodiments of this application provides an electronic device, the device comprising: a memory and a program or instructions stored in the memory and executable on a processor, wherein when the program or instructions are executed by the processor, they implement the model code generation method provided in any of the embodiments of this application described above.

[0009] A fourth aspect of the embodiments of this application provides a readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, they implement the model code generation method provided by any aspect of the embodiments of this application described above.

[0010] A fifth aspect of the embodiments of this application provides a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the model code generation method provided in any aspect of the embodiments of this application described above.

[0011] The model code generation method provided in this application obtains the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform. Then, based on the model framework template, the first model information is converted into a first model file whose model configuration parameters match the model framework template; based on the code format template, the first model file is converted into a first code file whose code format matches the code format template; and based on the code integration template, the first code file is converted into a second code file that matches the integration result type. Thus, according to the model framework template, code format template, and code integration template, the first model information of the target model can be directly converted into a second code file suitable for the target platform, without requiring developers to manually adjust the code. In this way, this application utilizes three templates corresponding to the target platform to directly convert the target model into a second code file that can be simulated and verified on the target platform, achieving automated model-to-code conversion. This process greatly reduces the workload of manually adjusting the code, thereby significantly shortening the code debugging time and improving the efficiency of model code generation. Attached Figure Description

[0012] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart illustrating a model code generation method provided in one embodiment of this application; Figure 2 This is a schematic diagram of a first configuration interface provided in one embodiment of this application; Figure 3 This is a schematic diagram illustrating the workflow of simulation verification of a target model on a target platform according to an embodiment of this application; Figure 4 This is a schematic diagram of a second configuration interface provided in one embodiment of this application; Figure 5 This is a schematic diagram of the simulation process of an S-Function provided in one embodiment of this application; Figure 6 This is a schematic diagram of the structure of a model code generation apparatus provided in one embodiment of this application; Figure 7 This is a schematic diagram of the structure of a model code generation device provided in one embodiment of this application. Detailed Implementation

[0014] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0015] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0016] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.

[0017] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.

[0018] As embedded systems become increasingly complex, the complexity of their software across all stages—design, development, testing, and verification—is also showing a significant upward trend. To effectively address this challenge, algorithm-based design methods have emerged and demonstrated strong potential, significantly improving development efficiency. After the algorithm model is designed, simulation verification on the target platform becomes a core step in ensuring system performance and reliability. However, before simulation verification, the algorithm model must first be converted into model code compatible with the target platform.

[0019] Currently, MATLAB's toolchain is typically used to automatically generate model code adapted to the target platform. However, when dealing with target platforms lacking dedicated toolchain support, developers must first manually convert the model into initial code, and then meticulously adjust the code to ensure perfect compatibility with the target platform. This manual code adjustment method has significant drawbacks: it requires a considerable amount of time for code debugging, which greatly reduces the efficiency of model code generation.

[0020] The purpose of this application is to provide a model code generation method, apparatus, device, medium, and product. The model code generation method provided in this application involves obtaining first model information and integration result type of a target model, as well as a model framework template, code format template, and code integration template for the target platform. Then, based on the model framework template, the first model information is converted into a first model file whose model configuration parameters match the model framework template; based on the code format template, the first model file is converted into a first code file whose code format matches the code format template; and based on the code integration template, the first code file is converted into a second code file that matches the integration result type. Thus, according to the model framework template, code format template, and code integration template, the first model information of the target model can be directly converted into a second code file suitable for the target platform without requiring manual code adjustments by the developer. In this way, this application utilizes three templates corresponding to the target platform to directly convert the target model into a second code file that can be simulated and verified on the target platform, achieving automated model-to-code conversion. This process greatly reduces the workload of manually adjusting the code, thereby significantly shortening the code debugging time and improving the efficiency of model code generation.

[0021] The following describes specific embodiments of the model code generation method and apparatus provided in this application. The model code generation method will be described first.

[0022] Figure 1 A flowchart of a model code generation method is provided. This model code generation method can be applied to the server side and may include the following steps S101 to S105.

[0023] S101, Display the first configuration interface, which includes at least a model configuration control, an integration type configuration control, and a task start control.

[0024] In this embodiment, the model configuration control refers to an interactive component used by the user to configure the target model that needs to be simulated and verified on the target platform. Specifically, it can be implemented using a drop-down menu, text box, or file upload component, and is used to directly obtain configuration information such as the model structure, input and output parameters of the target model.

[0025] Integration type configuration controls are interactive components used to select code integration methods. They can be implemented using radio buttons or checkboxes. By pre-setting options for executable file generation types or non-executable file types, the manual definition of integration types by users can be reduced.

[0026] As an example, such as Figure 2 The diagram illustrates a first configuration interface. The server first displays this first configuration interface, which includes a model configuration control 210, an integration type configuration control 220, and a task startup control 230. Users can input necessary configuration parameters or commands by manipulating these controls.

[0027] Specifically, the model configuration control is used to select the target model that needs to be simulated and verified on the target platform. The integration type configuration control is used to select whether to generate an executable file or a non-executable file. The task initiation control is used to trigger the code generation process.

[0028] As another example, the first configuration interface may also include hardware configuration controls. These controls can be used to configure hardware information such as debuggers and connections, thereby ensuring that the target platform can provide the hardware environment for simulation verification.

[0029] S102, in response to the user's first operation on the model configuration control, integration type configuration control and task start control, obtains the first model information and integration result type of the target model, as well as the model framework template, code format template and code integration template of the target platform, the target platform being the platform for simulation verification of the target model.

[0030] In this embodiment, the model framework template refers to a configuration file that defines the model structure supported by the target platform. This file informs the target platform which functions it supports, the generation language type, and other model configuration parameters to meet the requirements of the target platform's execution environment. Examples include code interface parameters, target hardware parameters, word length, and byte order.

[0031] A code formatting template is a configuration file that defines the code style for a target platform. It can use preset indentation rules, naming conventions, or header file reference rules, eliminating the time spent manually adjusting code formatting through automatic formatting. Specifically, the code formatting template specifies the format of the generated main.c file, including header files, the main function, and single-step execution functions.

[0032] Taking the DSP6713 target platform as an example, the header file contains the system initialization and peripheral interface functions required by the DSP6713 target platform. The main function includes functions for chip initialization, clock configuration, interface initialization, and chip release. The code generated according to the code format template contains resource call functions and peripheral interface functions on the DSP6713.

[0033] A code integration template is a configuration file that defines the integration logic between code and the target platform environment. It can use compilation directives, library linking rules, or environment variable settings to automatically handle platform dependencies and avoid manual modification of the integration logic. Specifically, a code integration template can include information such as address allocation, interrupts, timers, and peripheral interface function implementations on the target platform.

[0034] The first model information is the initial descriptive information about the target model. It includes various attributes of the model, such as the definitions of the model's input and output interfaces, and the functional logic description of the model. This information is usually represented in some data structure or file format to fully characterize the model's features and behavior, and serves as the basis for subsequent model processing and transformation.

[0035] As an example, when the user completes the configuration and clicks the task start control, the server responds to this operation by reading the first model information of the target model from the preset storage location, and at the same time obtaining the integration result type selected by the user.

[0036] The server also reads model framework templates, code format templates, and code integration templates corresponding to the target platform from the template library. These templates are pre-configured and stored according to the characteristics of the target platform.

[0037] S103, based on the model framework template, converts the first model information into a first model file whose model configuration parameters match the model framework template.

[0038] In this embodiment, the server uses a model framework template to transform the first model information. The model framework template defines the interface specifications, data type mappings, and other information for the models supported by the target platform.

[0039] Based on these rules, the server maps the variables, functions, and other elements in the first model information of the target model to the form supported by the platform, and generates the first model file.

[0040] S104, based on the code format template, converts the first model file into a first code file whose code format matches the code format template.

[0041] In this embodiment, the server uses a code format template to process the first model file. The code format template defines the code style specifications for the target platform, including indentation, naming conventions, etc. The server reformatts the code according to the template rules, converting the first model file into a first code file that conforms to the requirements of the target platform.

[0042] S105, based on the code integration template, converts the first code file into a second code file that matches the integration result type.

[0043] In this embodiment, the server uses a code integration template to process the first code file. Specifically, the server first determines whether an executable file needs to be generated based on the integration result type selected by the user. If so, the server adds the necessary compilation instructions and linking information. If not, the server generates the integrated source code file. The processed code is then saved as the second code file.

[0044] As an example of a scenario, such as Figure 3 The diagram illustrates a workflow for simulating and verifying a target model on a target platform. The server first uses the S301, along with the Matlab / Simulink tool 310 and hardware driver library 320, to perform offline modeling and simulation based on the model framework template, ensuring the target model meets the requirements of the target platform's execution environment.

[0045] Then, using S302, the Matlab / Simulink tool 310 and hardware driver library 320 are used to automatically generate code based on the code format template and code integration template, converting the target model into a code file that can run on the target platform.

[0046] Then, through S303, the hardware driver library 320 is used for compilation, linking, and downloading to convert the code file into an executable file type.

[0047] Finally, using S304 and with the help of the target platform processor 330, the target model was simulated in real time on the target platform.

[0048] The model code generation method provided in this embodiment obtains the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform. Then, based on the model framework template, the first model information is converted into a first model file whose model configuration parameters match the model framework template; based on the code format template, the first model file is converted into a first code file whose code format matches the code format template; and based on the code integration template, the first code file is converted into a second code file that matches the integration result type. Thus, according to the model framework template, code format template, and code integration template, the first model information of the target model can be directly converted into a second code file suitable for the target platform, without requiring developers to manually adjust the code. In this way, this application utilizes three templates corresponding to the target platform to directly convert the target model into a second code file that can be simulated and verified on the target platform, realizing automated model-to-code conversion. This process greatly reduces the workload of manually adjusting the code, thereby significantly shortening the code debugging time and improving the efficiency of model code generation.

[0049] As an optional embodiment, some of the solutions described above in this application propose a technical means to convert the first model information into a first model file adapted to the target platform based on a model framework template. However, when there are protocol differences between the model interface and the target platform driver interface, the directly converted model file cannot be compatible with the interface specification of the target platform, resulting in an interface driver mismatch problem during the simulation verification process.

[0050] Specifically, S103 may include: From the driver interface library, obtain the first graphical driver interface and the second graphical driver interface corresponding to the input interface and output interface in the first model information, respectively; The input and output interfaces in the first model information are replaced with the first graphical driver interface and the second graphical driver interface, respectively, to obtain the second model information of the target model; Based on the information from the second model, a pre-compilation operation is performed on the target model to obtain the second model file; Based on the model framework template, the second model file is converted into a first model file whose model configuration parameters match the model framework template.

[0051] In this embodiment, the driver interface library is a collection that stores various driver interfaces for interacting with hardware or other software components. These interfaces exist in some form (which may be graphical or other recognizable forms) and are used to enable data transfer and function calls between the model and external systems or components. It provides the model with the ability to access underlying hardware or specific functions, enabling the model to run in a real-world environment and interact with external entities.

[0052] The input interface is the channel through which the model receives external data or signals. It defines the data types, formats, and data transmission methods that the model can accept. Within the model, the input interface serves as the entry point for interaction with external data sources or other models. Through the input interface, the model can obtain the necessary information to execute its internal functional logic.

[0053] The output interface is the channel through which the model sends data or signals to the outside world. It specifies the data type, format, and output method of the model's output. The output interface enables the model to pass its processing results to external systems or other models, realizing interaction and information sharing between the model and the external environment.

[0054] The first graphical driver interface is a graphical representation of the driver interface obtained from the driver interface library, corresponding to the input interface in the first model information. It is presented in an intuitive graphical format, facilitating user operation and configuration within a graphical environment. This interface establishes the connection between the input interface and the underlying driver or external system, converting the data received from the input interface into a form that the underlying system can understand and process, and then passing it to the target model.

[0055] The second graphical driver interface is a graphical representation of the driver interface obtained from the driver interface library, corresponding to the output interface in the first model information. Also graphically displayed, it converts the data output by the target model into a format suitable for external systems to receive, and transmits the processing results to external systems or other components through the output interface. It acts as a bridge between the output interface and the underlying driver or external system.

[0056] The second model information is a new model description obtained after processing the first model information. Specifically, it is the model information obtained by replacing the input and output interfaces in the first model information with the first and second graphical driver interfaces, respectively. It reflects the state of the target model after adaptation at the interface level, providing a foundation for subsequent operations such as pre-compiling the target model.

[0057] Pre-compilation is a preprocessing step performed on the target model. Based on the second model information, a series of operations are performed on the target model, including syntax checking, code optimization, and resource allocation, transforming the model into an intermediate form or a form closer to executable code. The purpose of pre-compilation is to improve the compilation efficiency of the model, reduce errors during final compilation, and prepare for the subsequent generation of model files.

[0058] The second model file is the file obtained after pre-compilation. It contains the code and data information of the target model after pre-compilation. The second model file has a certain structure and format, which facilitates further processing and conversion.

[0059] As an example, when the server converts the first model information into a first model file adapted to the target platform based on the model framework template, it first retrieves the first and second graphical driver interfaces corresponding to the input and output interfaces in the first model information from the driver interface library. For example, for a target model with two input interfaces and one output interface, two graphical driver interfaces of input type and one graphical driver interface of output type can be retrieved from the driver interface library.

[0060] Next, the input and output interfaces in the first model information are replaced with the first and second graphical driver interfaces, respectively, to obtain the second model information of the target model. Specifically, the input interfaces in the original model can be replaced with input-type graphical driver interfaces obtained from the driver interface library, and the output interfaces can be replaced with output-type graphical driver interfaces.

[0061] Then, based on the second model information, a pre-compilation operation is performed on the target model to obtain the second model file. The pre-compilation operation may include steps such as syntax checking, interface consistency verification, and intermediate code generation.

[0062] Finally, based on the model framework template, the second model file is converted into a first model file whose model configuration parameters match the model framework template. This step involves parsing the second model file, extracting key configuration parameters, and filling and organizing these parameters according to the requirements of the model framework template to generate the final first model file.

[0063] This embodiment addresses the compatibility issue between the target platform's interface protocol and the original model interface. By introducing a graphical driver interface from the driver interface library to replace the original model interface, it ensures that the replaced interface fully complies with the target platform's communication protocol specifications, avoiding driver layer adaptation errors. The added pre-compilation stage allows the model structure to adapt to the target platform's interface calling method during the pre-compilation phase, reducing the complexity of subsequent conversion stages. The pre-compilation operation performs syntax optimization and intermediate code generation on the second model information, eliminating incompatible syntax elements in the original model information, thereby ensuring that the final generated first model file fully matches the model framework template at the model configuration parameter level, improving the reliability of the code conversion process.

[0064] As an optional embodiment, some of the solutions described above in this application propose obtaining a graphical driver interface from a driver interface library to replace the model interface and generate a model file. However, in this process, the construction of the driver interface library requires pre-configuration of driver interfaces for different hardware platforms. Existing solutions lack the ability to dynamically generate driver interface libraries, resulting in an inability to flexibly adapt to the interface requirements of different target platforms according to user needs.

[0065] Therefore, before retrieving the first graphical driver interface and the second graphical driver interface corresponding to the input interface and output interface in the first model information from the driver interface library, the model code generation method may further include: Display a second configuration interface, which includes at least a driver interface configuration control. In response to the user's second operation on the driver interface configuration control, obtain the driver interface configuration information; Based on the driver interface configuration information, generate corresponding system function files and language compiler files; By integrating the system function files with the language compiler files, a graphical driver interface corresponding to the driver interface configuration information is obtained; A driver interface library is generated based on each graphical driver interface.

[0066] In this embodiment, the second configuration interface is a graphical user interface for users to perform specific configuration operations. For example... Figure 4 The diagram illustrates a second configuration interface. This second configuration interface includes at least a driver interface configuration control 410, providing users with an intuitive way to set and modify parameters or options related to the driver interface.

[0067] The driver interface configuration control 410 is an interactive element on the second configuration interface. Users can input or select driver interface configuration information by operating these controls. These controls can be in the form of drop-down menus, text boxes, check boxes, sliders, etc.

[0068] Driver interface configuration information is a collection of parameters and options set by the user on the second configuration interface. This information defines the specific characteristics and behaviors of the driver interface, such as the driver type, interface parameters, and communication protocol. Driver interface configuration information forms the basis for subsequently generating system function files and language compiler files.

[0069] As an example, the server first displays a second configuration interface, which includes driver interface configuration controls. These controls can take the form of drop-down menus, text input boxes, or selection buttons.

[0070] Then, responding to the user's second operation on the driver interface configuration control, the driver interface configuration information is obtained. For example, the user can select the target hardware platform type through a drop-down menu, enter interface parameters through a text input box, or select the required interface functions through a selection button.

[0071] Then, based on the driver interface configuration information, corresponding system function files (sfunction files) and language compiler files (Target Language Compiler, TLC files) are generated. The system function files contain low-level driver functions related to the hardware platform, and the language compiler files contain the interface syntax rules and compilation instructions.

[0072] The system function files are then integrated with the language compiler files to obtain a graphical driver interface corresponding to the driver interface configuration information. This integration process may involve establishing function call relationships and mapping interface parameters.

[0073] Finally, a driver interface library is generated based on each graphical driver interface. The driver interface library can be a collection of multiple graphical driver interfaces for subsequent calling and management.

[0074] Specifically, the graphical driver interface needs to be written using S-Function. For example... Figure 5 The diagram illustrates a simulation flow for an S-Function. Specifically, S501 initializes the size; in this stage, the S-Function defines the quantity and size of its inputs, outputs, parameters, and states, and Simulink allocates memory for the S-Function based on this information. Then, S502 initializes the sampling time; in this stage, the S-Function specifies its sampling time, which determines when the S-Function will be invoked during the simulation. Next, S503 initiates the simulation. Then, S504 performs output calculations; Simulink calls the `mdloutputs` routine at each sampling time point. This routine calculates the S-Function's output based on the current inputs and states. Finally, S505 terminates the simulation flow.

[0075] This embodiment enables the dynamic generation and configuration of a driver interface library. Users can customize driver interface parameters through a visual interface, and the server can automatically generate driver interfaces adapted to different hardware platforms based on user input. This method improves the flexibility and scalability of the driver interface library, allowing the model code generation process to better adapt to the needs of different target platforms. Simultaneously, the automated interface generation process reduces the workload of manually writing interface code, improving development efficiency. Furthermore, by encapsulating the generated interfaces into a standardized driver interface library, a unified interface resource is provided for subsequent model conversion, simplifying the model code generation process.

[0076] As an optional embodiment, some of the solutions described above in this application propose converting a first code file into a second code file that matches the integration result type based on a code integration template. However, when the integration result type is not an executable file, the existing solutions lack a differentiated processing mechanism for the integration process of non-executable files, which makes it impossible to effectively adapt to verification scenarios that only require code-level integration, resulting in low code integration efficiency.

[0077] Specifically, S105 may include: If the integration result type is not to generate an executable file, the first code file is integrated with the base code file of the target platform based on the code integration template to obtain the second code file.

[0078] In this embodiment, when the integration result type is not an executable file type, the server integrates the first code file with the target platform's basic code file based on the code integration template to obtain the second code file.

[0079] Specifically, the process first checks whether the integration result type is "no executable file generated." If so, it triggers a code-level integration process based on the code integration template. The code integration template, as a structured interface specification, guides the integration process between the first code file and the target platform's base code. The base code file contains platform-specific driver layer code and hardware abstraction layer code.

[0080] Furthermore, the code integration process may include the following steps: 1) Parsing the code integration template to extract integration rules and interface definitions; 2) Analyzing the structure and interfaces of the first code file; 3) Mapping the interfaces in the first code file to the corresponding interfaces in the base code file; 4) Embedding the functional modules of the first code file into the appropriate locations in the base code file according to the integration rules; 5) Adjusting variable names and function calls to ensure consistency of the integrated code; 6) Generating the integrated second code file, which contains the functionality of the original model and conforms to the architectural requirements of the target platform.

[0081] This embodiment of the application implements differentiated processing for the integration process of non-executable files. Therefore, in scenarios where generating an executable file is not required, unnecessary compilation processes are avoided, improving code integration efficiency. Furthermore, through code-level integration, the functional integrity of the model code is preserved, while achieving deep adaptation to the target platform's runtime environment. In addition, this solution ensures the consistency and repeatability of the integration process through standardized code integration template guidance, reducing the risk of human error and improving the quality and reliability of code integration.

[0082] As an optional embodiment, some of the solutions described above in this application propose converting a first code file into a second code file that matches the integration result type based on a code integration template. However, in the application scenario of generating executable files, the existing solutions cannot directly form an executable program from the basic code file generated by the code integration template alone. Additional manual intervention is required for compilation, resulting in an efficiency bottleneck in the model code generation process.

[0083] Specifically, S105 may also include: When the integration result type is to generate an executable file, the first code file is integrated with the base code file of the target platform based on the code integration template to obtain the third code file; The third code file is compiled into an executable file type, resulting in the second code file.

[0084] In this embodiment, when the integration result type is to generate an executable file, the server first integrates the first code file with the target platform's base code file based on the code integration template to obtain a third code file. Specifically, the code integration template can define the target platform's code structure, function interfaces, and variable naming rules, etc. Through this template, the algorithm logic in the first code file can be matched and merged with the underlying interfaces in the target platform's base code file to generate a third code file that conforms to the target platform's architecture.

[0085] Next, the third code file is compiled into an executable file type, resulting in the second code file. The compilation process can use a compiler supported by the target platform, such as the GCC compiler. Based on the content of the third code file and the characteristics of the target platform, the compiler converts the source code into a machine-executable binary format. Thus, the final generated second code file is the executable file that can be run directly on the target platform.

[0086] This application achieves an automated conversion process from model code to executable files through this embodiment. This method eliminates the need for manual compilation, improving the efficiency of model code generation. Simultaneously, by decoupling code integration and compilation operations into independent steps, the flexibility and scalability of the solution are enhanced. This phased processing approach ensures both the standardization of code integration and the automation of the compilation process, forming a complete executable file generation pipeline. Therefore, this application effectively solves the problem in existing technologies where basic code files generated solely from code integration templates cannot directly form executable programs, avoiding additional manual intervention and thus eliminating efficiency bottlenecks in the model code generation process.

[0087] As an optional embodiment, some of the solutions described above in this application propose converting a first code file into an executable file type to obtain a second code file based on a code integration template. However, in the process of compiling the third code file into an executable file, the lack of flexible configuration of compilation parameters and file dependencies makes it impossible to customize the compilation process according to the specific needs of the target platform, which may affect the compatibility and execution efficiency of the generated code.

[0088] In this regard, the first configuration interface may also include a compilation template configuration control; The third code file is compiled into an executable file type to obtain the second code file, which may include: In response to a third user action on the compiler template configuration control, the target compiler template is obtained, which includes compiler parameters, linker parameters, and the relationships between source files in the third code file. Based on the compiler parameters, linker parameters, and the relationships between the source files in the third code file, the third code file is compiled into an executable file type, resulting in the second code file.

[0089] In this embodiment, as Figure 2 As shown, the first configuration interface includes a compiler template configuration control 240. This compiler template configuration control 240 can be in the form of a drop-down menu, radio button, or text input box, allowing users to select or input compilation-related parameters.

[0090] As an example, when compiling a third-party code file into an executable file, the server first responds to the user's actions regarding the compilation template configuration controls. For instance, the user can select a target compilation template from a list of preset compilation templates or manually enter compilation parameters.

[0091] The obtained target compilation template contains the following information: compiler parameters: such as optimization level, warning level, target architecture, etc.; linker parameters: such as output file name, library file path, linker script, etc.; and the relationship between the source files in the third-party code file: such as file dependency order, header file inclusion relationship, etc.

[0092] Based on the information obtained from the target compilation template, the system executes the compilation process: setting compilation options according to compiler parameters; determining the compilation order according to the relationship between source files; and performing the final linking operation using linker parameters.

[0093] In this way, the third code file is compiled into an executable file type, resulting in the second code file.

[0094] This embodiment enables flexible configuration of the compilation process. Users can select or customize compilation parameters according to the specific needs of the target platform, thereby generating a more suitable executable file. This method avoids the tedious steps of manually adjusting the code and improves the efficiency of code generation. At the same time, since the compilation parameters can be optimized for a specific platform, the generated executable file can run more efficiently on the target platform, improving code execution efficiency and platform compatibility.

[0095] As an optional embodiment, some of the solutions described above in this application propose a scheme for model code conversion based on preset model framework templates, code format templates, and code integration templates. However, since there are differences in model frameworks, code formats, and integration environments of different target platforms, if the template cannot be flexibly configured according to the target platform, the generated model code will have insufficient compatibility with the target platform, requiring developers to manually adjust the template parameters and reduce code generation efficiency.

[0096] Prior to S102, the model code generation method could also include: Display a second configuration interface, which includes at least a template configuration control; In response to the user's fourth operation on the template configuration control, obtain the target platform's model framework configuration information, code format configuration information, and integration environment configuration information; Generate a model framework template based on the model framework configuration information; Generate a code format template based on the code format configuration information; Based on the integrated environment configuration information, a code integration template is generated.

[0097] In this embodiment, as Figure 4 As shown, the server first displays a second configuration interface, which includes a template configuration control 420. The template configuration control can be in the form of a drop-down menu, input box, or selection box, and is used by the user to input or select template configuration parameters.

[0098] Then, in response to user actions on the template configuration control, the system retrieves the target platform's model framework configuration information, code format configuration information, and integration environment configuration information. For example, a user can select an ARM-based embedded system as the target platform in the template configuration control and input the specific configuration parameters for the platform's model framework, code format, and integration environment.

[0099] Then, based on the acquired model framework configuration information, a model framework template is generated. The model framework configuration information may include the data types supported by the target platform, function interface specifications, etc. Based on this information, the server generates a model framework template adapted to the target platform.

[0100] Then, based on the acquired code format configuration information, a code format template is generated. This configuration information may include the target platform's code indentation rules, naming conventions, etc. The server then generates a format template that conforms to the target platform's code style based on this information.

[0101] Then, based on the acquired integration environment configuration information, a code integration template is generated. The integration environment configuration information may include the target platform's file organization structure, compilation options, etc. The server then uses this information to generate a code integration template suitable for the target platform's integration environment.

[0102] Through this embodiment, this application achieves dynamic configuration and generation of templates, improving the adaptability of model code to the target platform. Since template parameters can be adjusted according to the characteristics of the target platform input by the user, the workload of developers manually modifying templates is reduced, thereby improving code generation efficiency. Furthermore, dynamically generated templates can better match the hardware architecture, code style, and integration requirements of the target platform, ensuring that the generated model code can run directly on the target platform, reducing subsequent debugging and adaptation time.

[0103] As an optional embodiment, some of the solutions described above in this application propose converting the model code into a second code file adapted to the target platform for simulation verification. However, the process of manually processing and burning the generated second code file to the target platform is cumbersome and has poor compatibility of the burning method, resulting in reduced model verification efficiency.

[0104] In this regard, the first configuration interface can also include a control for configuring the burning method; Following S105, the model code generation method may also include: In response to the user's fifth operation on the programming method configuration control, obtain the target programming method; Convert the second code file into a binary file; Based on the target burning method, the binary file is burned to the target platform so that the target platform can perform simulation verification of the target model.

[0105] In this embodiment, a programming method configuration control is set in the first configuration interface. This programming method configuration control provides three options in the form of a drop-down menu: serial port programming, network port programming, and custom protocol programming.

[0106] After the user selects the target programming method by clicking the programming method configuration control, the server automatically calls the protocol stack module corresponding to the target programming method. After the second code file is generated, the code conversion module compiles it into a binary file, and the format of this binary file is completely matched with the instruction set architecture of the target platform.

[0107] The programming execution module starts the corresponding communication interface according to the target programming method. For example, when serial port programming is selected, the server automatically configures the baud rate and parity parameters and establishes a physical connection with the target platform; when Ethernet port programming is selected, the server completes the handshake protocol and establishes a data transmission channel through TCP / IP. During the programming process, the server monitors the integrity of data transmission in real time. If a parity error is detected, a retransmission mechanism is triggered until the binary file is completely written to the target platform's memory area.

[0108] This embodiment achieves seamless integration of code generation and burning operations, eliminating the need for manual tool switching by integrating multiple burning protocol interfaces. An automated binary conversion mechanism ensures precise matching between the code format and the target platform's hardware architecture, preventing burning failures due to format errors. Multi-protocol adaptation effectively covers the burning needs of different hardware platforms, shortening the overall cycle from code generation to hardware verification, while a built-in verification mechanism enhances data reliability during the burning process.

[0109] As an optional embodiment, in some of the above-mentioned solutions of this application, when burning binary files to the target platform based on the target burning method to achieve simulation verification, if there are differences in the physical interface types between the target platform and external devices, the selection of the burning method lacks a clear adaptation standard, which may cause the burning process to fail due to interface protocol mismatch, affecting the simulation verification efficiency.

[0110] In this regard, this application proposes that the target programming method be any one of serial port programming, network port programming, and protocol programming.

[0111] In this embodiment, the serial port programming method realizes data transmission through a physical serial communication interface, adapting to target platforms with serial port hardware resources, such as RS-232 or RS-485 standard interfaces, with a baud rate range that can be set from 9600bps to 115200bps; the network port programming method is based on network communication protocols, utilizing the target platform's network interface to achieve high-speed batch data transmission, such as establishing a Socket connection through a TCP / IP protocol stack, supporting IPv4 or IPv6 address configuration; the protocol programming method interacts with the target platform through a custom protocol, such as encapsulating a private protocol frame structure based on a UART or SPI interface, supporting variable-length data packet transmission.

[0112] As an example, when establishing a physical connection between the target platform and an external device, the interface type of the target platform is first detected. If the target platform has a serial communication interface and the network function is not enabled, the serial port programming method is enabled, and the binary file is sent in segments to the target platform's buffer in asynchronous transmission mode via the UART protocol. Each frame of data includes a start bit, a parity bit, and a stop bit.

[0113] When the target platform supports Ethernet connection and the network status is normal, it automatically switches to the network port burning method, establishes a Socket connection based on the TCP / IP protocol, splits the binary file into fixed-size data packets for batch transmission, and each data packet contains a sequence number and a cyclic redundancy check code.

[0114] If the target platform uses a custom communication standard, the protocol burning method is activated. The binary file is converted into a data stream that conforms to the target platform's instruction set according to the preset private protocol format. A frame header, instruction code, and checksum field are added at the sending end, and the data is reassembled at the receiving end according to the protocol parsing rules.

[0115] This embodiment effectively solves the physical interface compatibility problem. The serial port programming method ensures data integrity in low-speed scenarios through a standard serial communication mechanism; the network port programming method utilizes network protocols to achieve high-speed transmission and support remote operation; and the protocol programming method adapts to non-standard interfaces through custom data encapsulation rules. These three programming methods form a complete interface coverage system, avoiding programming interruptions due to protocol incompatibility, reducing manual debugging by users, and significantly improving the first-time success rate and execution efficiency of code programming under different hardware environments.

[0116] Based on the model code generation method provided in this application, correspondingly, this application also provides specific embodiments of the model code generation apparatus.

[0117] like Figure 6As shown, the model code generation device 600 provided in this application embodiment includes an interface display module 610, an information acquisition module 620, a file generation module 630, a format conversion module 640, and a file integration module 650.

[0118] The interface display module 610 is used to display the first configuration interface, which includes at least a model configuration control, an integration type configuration control, and a task start control. The information acquisition module 620 is used to respond to the user's first operation on the model configuration control, integration type configuration control and task start control, to acquire the first model information and integration result type of the target model, as well as the model framework template, code format template and code integration template of the target platform. The target platform is the platform for simulation verification of the target model. The file generation module 630 is used to convert the first model information into a first model file whose model configuration parameters match the model framework template based on the model framework template. The format conversion module 640 is used to convert the first model file into a first code file whose code format matches the code format template based on the code format template; File integration module 650 is used to convert a first code file into a second code file that matches the integration result type based on a code integration template.

[0119] The model code generation apparatus provided in this application acquires the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform. Then, based on the model framework template, the first model information is converted into a first model file whose model configuration parameters match the model framework template; based on the code format template, the first model file is converted into a first code file whose code format matches the code format template; and based on the code integration template, the first code file is converted into a second code file that matches the integration result type. Thus, according to the model framework template, code format template, and code integration template, the first model information of the target model can be directly converted into a second code file suitable for the target platform, without requiring manual code adjustments by the developer. In this way, this application utilizes three templates corresponding to the target platform to directly convert the target model into a second code file that can be simulated and verified on the target platform, achieving automated model-to-code conversion. This process greatly reduces the workload of manually adjusting the code, thereby significantly shortening the code debugging time and improving the efficiency of model code generation.

[0120] As an optional embodiment, the file generation module 630 is specifically used for: From the driver interface library, obtain the first graphical driver interface and the second graphical driver interface corresponding to the input interface and output interface in the first model information, respectively; The input and output interfaces in the first model information are replaced with the first graphical driver interface and the second graphical driver interface, respectively, to obtain the second model information of the target model; Based on the information from the second model, a pre-compilation operation is performed on the target model to obtain the second model file; Based on the model framework template, the second model file is converted into a first model file whose model configuration parameters match the model framework template.

[0121] As an optional embodiment, before obtaining the first graphical driver interface and the second graphical driver interface corresponding to the input interface and output interface in the first model information from the driver interface library, the file generation module 630 is further configured to: Display a second configuration interface, which includes at least a driver interface configuration control. In response to the user's second operation on the driver interface configuration control, obtain the driver interface configuration information; Based on the driver interface configuration information, generate corresponding system function files and language compiler files; By integrating the system function files with the language compiler files, a graphical driver interface corresponding to the driver interface configuration information is obtained; A driver interface library is generated based on each graphical driver interface.

[0122] As an optional embodiment, the file integration module 650 includes the following units: The file integration unit is used to integrate the first code file with the base code file of the target platform based on the code integration template to obtain the second code file when the integration result type is not an executable file type.

[0123] As an optional embodiment, the file integration module 650 further includes the following units: The file integration unit is used to integrate the first code file with the base code file of the target platform based on the code integration template when the integration result type is to generate an executable file, so as to obtain the third code file. The file compilation unit is used to compile the third code file into an executable file type, thus obtaining the second code file.

[0124] As an optional embodiment, the first configuration interface also includes a compilation template configuration control; The file compilation unit is specifically used for: In response to a third user action on the compiler template configuration control, the target compiler template is obtained, which includes compiler parameters, linker parameters, and the relationships between source files in the third code file. Based on the compiler parameters, linker parameters, and the relationships between the source files in the third code file, the third code file is compiled into an executable file type, resulting in the second code file.

[0125] As an optional embodiment, in response to the user's first operation on the model configuration control, integration type configuration control, and task start control, before obtaining the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform, the model code generation device 600 further includes the following modules: The interface display module 610 is also used to display a second configuration interface, which includes at least a template configuration control. The information acquisition module 620 is also used to respond to the user's fourth operation on the template configuration control and acquire the model framework configuration information, code format configuration information and integration environment configuration information of the target platform; The template generation module is used to generate model framework templates based on model framework configuration information. The template generation module is also used to generate code format templates based on code format configuration information; The template generation module is also used to generate code integration templates based on integrated environment configuration information.

[0126] As an optional embodiment, the first configuration interface also includes a burning method configuration control; After converting the first code file into a second code file that matches the type of the integration result based on the code integration template, the model code generation device 600 also includes the following modules: The programming method acquisition module is used to obtain the target programming method in response to the user's fifth operation on the programming method configuration control; The file conversion module is used to convert the second code file into a binary file; The file burning module is used to burn binary files to the target platform based on the target burning method, so that the target platform can perform simulation verification of the target model.

[0127] Based on the model code generation method provided in this application, correspondingly, this application also provides specific embodiments of the model code generation device.

[0128] Figure 7 A schematic diagram of the hardware structure of the model code generation device provided in an embodiment of this application is shown.

[0129] The model code generation device may include a processor 701 and a memory 702 storing computer program instructions.

[0130] Specifically, the processor 701 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0131] Memory 702 may include mass storage for data or instructions. For example, and not limitingly, memory 702 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 702 may include removable or non-removable (or fixed) media. Where appropriate, memory 702 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 702 is non-volatile solid-state memory.

[0132] The processor 701 reads and executes computer program instructions stored in the memory 702 to implement any of the model code generation methods in the above embodiments.

[0133] In one example, the model code generation device may also include a communication interface 703 and a bus 710. Wherein, as... Figure 7 As shown, the processor 701, memory 702, and communication interface 703 are connected through bus 710 and complete communication with each other.

[0134] The communication interface 703 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0135] Bus 710 includes hardware, software, or both, that couples components of the model code generation device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 710 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0136] Furthermore, in conjunction with the model code generation methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the model code generation methods in the above embodiments.

[0137] In addition, in conjunction with the model code generation method in the above embodiments, this application embodiment can provide a computer program product for implementation. When the instructions in the computer program product are executed by the processor of an electronic device, the electronic device executes the model code generation method provided by any aspect of the above embodiments of this application.

[0138] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0139] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0140] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0141] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0142] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A method for generating model code, characterized in that, The method includes: Display a first configuration interface, which includes at least a model configuration control, an integration type configuration control, and a task start control. In response to the user's first operation on the model configuration control, the integration type configuration control, and the task start control, the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform are obtained, wherein the target platform is a platform for simulating and verifying the target model; Based on the model framework template, the first model information is converted into a first model file whose model configuration parameters match the model framework template; Based on the code format template, the first model file is converted into a first code file whose code format matches the code format template. Based on the code integration template, the first code file is converted into a second code file that matches the integration result type.

2. The method according to claim 1, characterized in that, The step of converting the first model information into a first model file whose model configuration parameters match the model framework template, based on the model framework template, includes: From the driver interface library, obtain the first graphical driver interface and the second graphical driver interface corresponding to the input interface and output interface in the first model information, respectively; The input interface and output interface in the first model information are replaced with the first graphical driver interface and the second graphical driver interface, respectively, to obtain the second model information of the target model; Based on the second model information, a pre-compilation operation is performed on the target model to obtain a second model file; Based on the model framework template, the second model file is converted into the first model file whose model configuration parameters match the model framework template.

3. The method according to claim 2, characterized in that, Before obtaining the first graphical driver interface and the second graphical driver interface corresponding to the input interface and output interface in the first model information from the driver interface library, respectively, the method further includes: Display a second configuration interface, which includes at least a driver interface configuration control. In response to a second user operation on the driver interface configuration control, obtain driver interface configuration information; Based on the driver interface configuration information, corresponding system function files and language compiler files are generated; The system function file is integrated with the language compiler file to obtain a graphical driver interface corresponding to the driver interface configuration information; The driver interface library is generated based on each of the aforementioned graphical driver interfaces.

4. The method according to any one of claims 1-3, characterized in that, The step of converting the first code file into a second code file that matches the integration result type based on the code integration template includes: If the integration result type is "no executable file generated", the first code file is integrated with the base code file of the target platform based on the code integration template to obtain the second code file.

5. The method according to any one of claims 1-3, characterized in that, The step of converting the first code file into a second code file that matches the integration result type based on the code integration template includes: If the integration result type is an executable file, the first code file is integrated with the base code file of the target platform based on the code integration template to obtain a third code file. The third code file is compiled into the executable file type to obtain the second code file.

6. The method according to claim 5, characterized in that, The first configuration interface also includes a compilation template configuration control; The step of compiling the third code file into the executable file type to obtain the second code file includes: In response to a third operation by the user on the compilation template configuration control, a target compilation template is obtained, which includes compiler parameters, linker parameters, and the relationship between the source files in the third code file; Based on the compiler parameters, the linker parameters, and the relationship between the source files in the third code file, the third code file is compiled into the executable file type to obtain the second code file.

7. The method according to any one of claims 1-3, characterized in that, Before responding to the user's first operation on the model configuration control, the integration type configuration control, and the task launch control, and obtaining the first model information and integration result type of the target model, as well as the model framework template, code format template, and code integration template of the target platform, the method further includes: Display a second configuration interface, which includes at least a template configuration control; In response to the user's fourth operation on the template configuration control, the model framework configuration information, code format configuration information, and integration environment configuration information of the target platform are obtained; Based on the model framework configuration information, the model framework template is generated; Based on the code format configuration information, the code format template is generated; Based on the integrated environment configuration information, the code integration template is generated.

8. The method according to any one of claims 1-3, characterized in that, The first configuration interface also includes a burning method configuration control; After converting the first code file into a second code file matching the integration result type based on the code integration template, the method further includes: In response to the user's fifth operation on the programming method configuration control, the target programming method is obtained; Convert the second code file into a binary file; Based on the target burning method, the binary file is burned to the target platform so that the target platform can perform simulation verification of the target model.

9. The method according to claim 8, characterized in that, The target programming method can be any one of serial port programming, network port programming, and protocol programming.

10. A model code generation device, characterized in that, The device includes: The interface display module is used to display a first configuration interface, which includes at least a model configuration control, an integration type configuration control, and a task start control. The information acquisition module is used to respond to the user's first operation on the model configuration control, the integration type configuration control and the task start control, to acquire the first model information and integration result type of the target model, as well as the model framework template, code format template and code integration template of the target platform, wherein the target platform is a platform for simulating and verifying the target model; The file generation module is used to convert the first model information into a first model file whose model configuration parameters match the model framework template, based on the model framework template. The format conversion module is used to convert the first model file into a first code file whose code format matches the code format template, based on the code format template. The file integration module is used to convert the first code file into a second code file that matches the integration result type based on the code integration template.