CODESYS runtime software transplantation method, device and storage medium

By obtaining specific macro definitions and header files in the Makefile script, converting the source code and linking the library files, the CODESYS runtime software is implemented under the Xenomai framework, solving the problem that it cannot run on the system and expanding the application scenarios.

CN115878178BActive Publication Date: 2025-08-19ZHONGKE TIMES (SHENZHEN) COMPUTER SYST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211371171.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-03
Publication Date
2025-08-19
Estimated Expiration
2042-11-03

AI Technical Summary

Technical Problem

The CODESYS runtime software cannot run on the system under the Xenomai framework, which limits its application scenarios and leads to the inability to widely promote.

Method used

By obtaining the specific macro definition in the Makefile script, obtaining the libcobalt library header file and the Xenomai header file, converting the source code file into a binary target file, obtaining static library files and real-time related library files, and linking them through a local linker to realize the execution of CODESYS runtime software under the Xenomai framework.

Benefits of technology

The CODESYS runtime software was successfully ported to the system under the Xenomai framework, expanding its application scenarios and facilitating widespread promotion and use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115878178B_ABST
    Figure CN115878178B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, and storage medium for porting CODESYS runtime software, relating to the technical field of software porting. The method includes obtaining specific macro definitions in a Makefile script; obtaining a libcobalt library header file and a Xenomai header file based on compilation parameters within the Makefile script; locating a source code file of a specified format within the path where the Makefile script is located, and converting the source code file of the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file; obtaining a static library file; obtaining library files for a real-time-related library, libcobalt, and a memory management library; passing a main function wrapper parameter to a local linker; and linking the binary target file, the static library file, the library files for the real-time-related library, libcobalt, and the memory management library via the local linker to obtain a target file executable within the Xenomai framework. The method, device, and storage medium disclosed in the present invention can port CODESYS runtime software to a system within the Xenomai framework.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software transplantation, and in particular relates to a method, device and storage medium for transplanting CODESYS runtime software. Background Art

[0002] CODESYS (Controlled Development System) is a paid PLC development software released by the German company 3S. It includes a software interface (Development System, IDE) for programming and runtime software (Runtime System). The two are usually installed in different locations. The IDE is generally installed on the user's development computer, and the CODESYS runtime software is a typical real-time application deployed on the hardware device that performs the control function.

[0003] At present, the running environment of CODESYS runtime software is limited to standard Linux systems. For some systems under the Xenomai framework, CODESYS runtime software cannot run on them, resulting in limited usage scenarios of CODESYS runtime software, which is not conducive to the widespread promotion and application of CODESYS runtime software.

[0004] Therefore, how to provide an effective solution so that CODESYS runtime software can be applied to systems under the Xenomai framework has become a problem that needs to be solved urgently in the existing technology. Summary of the Invention

[0005] The purpose of the present invention is to provide a method, device and storage medium for transplanting CODESYS runtime software to solve the above-mentioned problems existing in the prior art.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a method for porting CODESYS runtime software to a system under the Xenomai framework, the method comprising:

[0008] Call the local compiler to obtain the specific macro definition in the pre-compiled Makefile script, which defines the COBALT kernel code and symbol packaging of the CODESYS runtime software to take effect in the system under the Xenomai framework;

[0009] Obtain the libcobalt library header file and the Xenomai header file based on the compilation parameters in the Makefile script, wherein the compilation parameters include the libcobalt library header file path and the Xenomai header file path;

[0010] Find a source code file in a specified format under the path where the Makefile script is located, and convert the source code file in the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file. The specified format includes .c format and .cpp format.

[0011] Obtaining the static library file of the CODESYS runtime software;

[0012] Obtaining the storage paths of the real-time related library libcobalt and the memory management library of the CODESYS runtime software so that the local linker can obtain the library files of the real-time related library libcobalt and the library files of the memory management library, wherein the memory management library is used for memory management and the real-time related library libcobalt is used to implement the system call of the COBALT kernel;

[0013] Passing in the symbol packaging rule file path so that the local linker obtains the symbol packaging rules in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software;

[0014] Passing the packaging parameters of the main function to the local linker to implement the main function after the CODESYS runtime software is packaged;

[0015] The binary target file, the static library file, the library file of the real-time related library libcobalt and the library file of the memory management library are linked by a local linker to obtain a target file that can be executed under the Xenomai framework.

[0016] Based on the above disclosed content, the present invention obtains specific macro definitions in a pre-compiled Makefile script, which defines the COBALT kernel code and symbol packaging of the CODESYS runtime software in the system under the Xenomai framework; obtains the libcobalt library header file and the Xenomai header file based on the compilation parameters in the Makefile script; finds the source code file of the specified format under the path where the Makefile script is located, and converts the source code file of the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file; obtains the static library file of the CODESYS runtime software; obtains the The storage paths of the real-time related library libcobalt and the memory management library are provided so that the local linker can obtain the library files of the real-time related library libcobalt and the memory management library; the symbol packaging rule file path is passed in so that the local linker can obtain the symbol packaging rules in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software; the packaging parameters of the main function are passed in to the local linker to implement the main function after the CODESYS runtime software is packaged; and the binary target file, the static library file, the library file of the real-time related library libcobalt, and the library file of the memory management library are linked by the local linker to obtain the target file that can be executed under the Xenomai framework. During this process, by passing in the symbol packaging rule file path, the local linker can obtain the symbol packaging rules to package the POSIX interface referenced in the CODESYS runtime software. By passing in the packaging parameters of the main function to the local linker, the main function of the CODESYS runtime software after packaging can be implemented, and the local linker can link the converted binary target files that can be executed by the system under the Xenomai framework, the static library files for executing the business functions of the CODESYS runtime software, the memory management library for memory management, and the system call real-time related library libcobalt for implementing the COBALT kernel, so that the linked target files can be executed by the system under the Xenomai framework, thereby porting the CODESYS runtime software to the system under the Xenomai framework, expanding the application scenarios of the CODESYS runtime software, and facilitating the widespread promotion and use of the CODESYS runtime software.

[0017] In one possible design, before calling the native compiler, the method further includes:

[0018] The pre-written Makefile script is loaded and the local compiler is searched.

[0019] In a possible design, obtaining the libcobalt library header file and the Xenomai header file based on the compilation parameters in the Makefile script includes:

[0020] Passing the compilation parameters in the Makefile script into the local compiler;

[0021] Based on the libcobalt library header file path and the Xenomai header file path in the compilation parameters, the libcobalt library header file and the Xenomai header file are found by the local compiler.

[0022] In one possible design, after converting the source code file in the specified format into a binary target file, the method further includes:

[0023] The path of the binary object file is passed to the local linker.

[0024] In one possible design, obtaining the static library file of the CODESYS runtime software includes:

[0025] Pass the file path of the static library file into the local linker;

[0026] The static library file is found by the local linker according to the file path.

[0027] In a possible design, the packaging parameters of the main function passed to the local linker include:

[0028] Passing initialization module parameters to the local linker, wherein the initialization module parameters include a file path of a designated file for implementing a main function after the CODESYS runtime software is packaged;

[0029] Obtain the specified file based on the file path of the specified file;

[0030] The main function packaging parameters for packaging the main function in the designated file are passed into the local linker through the Makefile script.

[0031] In one possible design, the symbol packaging rule file includes a cobalt.wrappers file and a modechk.wrappers file.

[0032] In a second aspect, the present invention provides a CODESYS runtime software transplantation device for transplanting the CODESYS runtime software to a system under the Xenomai framework. The CODESYS runtime software transplantation device includes:

[0033] The first acquisition unit is used to call the local compiler to obtain a specific macro definition in a pre-compiled Makefile script, wherein the specific macro definition defines the COBALT kernel code and symbol packaging of the CODESYS runtime software to be effective in the system under the Xenomai framework;

[0034] A second obtaining unit is configured to obtain a libcobalt library header file and a Xenomai header file based on compilation parameters in the Makefile script, wherein the compilation parameters include a path of the libcobalt library header file and a path of the Xenomai header file;

[0035] A search and conversion unit is used to find a source code file in a specified format under the path where the Makefile script is located, and convert the source code file in the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file. The specified format includes .c format and .cpp format;

[0036] A third acquisition unit is used to acquire the static library file of the CODESYS runtime software;

[0037] a fourth acquisition unit, configured to acquire storage paths of a real-time related library libcobalt and a memory management library of the CODESYS runtime software, so that a local linker can acquire library files of the real-time related library libcobalt and the memory management library, wherein the memory management library is used for memory management and the real-time related library libcobalt is used to implement system calls of the COBALT kernel;

[0038] The first input unit is used to input the symbol packaging rule file path so that the local linker obtains the symbol packaging rule in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software;

[0039] The second input unit is used to input the packaging parameters of the main function to the local linker, so as to realize the main function after the CODESYS runtime software is packaged;

[0040] The link unit is used to link the binary target file, the static library file, the library file of the real-time related library libcobalt and the library file of the memory management library through a local linker to obtain a target file that can be executed under the Xenomai framework.

[0041] In a third aspect, the present invention provides a device for porting CODESYS runtime software, comprising a memory, a processor, and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the CODESYS runtime software porting method as described in the first aspect above.

[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed on a computer, the method for porting the CODESYS runtime software described in the first aspect is executed.

[0043] In a fifth aspect, the present invention provides a computer program product comprising instructions, which, when executed on a computer, causes the computer to execute the CODESYS runtime software porting method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A flowchart of a method for porting CODESYS runtime software provided in an embodiment of the present application;

[0045] Figure 2 A schematic diagram of the structure of a device for transplanting CODESYS runtime software provided in an embodiment of the present application;

[0046] Figure 3 A schematic structural diagram of another CODESYS runtime software transplantation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly introduced below in conjunction with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.

[0048] To enable the CODESYS runtime software to be applied to systems running under the Xenomai framework, embodiments of the present application provide a CODESYS runtime software porting method, apparatus, and storage medium. These methods, apparatus, and storage medium can port the CODESYS runtime software to systems running under the Xenomai framework, expanding its application scenarios and facilitating its widespread promotion and use. The CODESYS runtime software porting method provided in these embodiments can be applied to hardware terminals running systems running under the Xenomai framework.

[0049] The following is a detailed description of the CODESYS runtime software transplantation method provided in the embodiment of the present application.

[0050] like Figure 1 As shown, a first aspect of this embodiment provides a CODESYS runtime software transplantation method for transplanting the CODESYS runtime software to a system under the Xenomai framework. The CODESYS runtime software transplantation method may include the following steps.

[0051] Step S101: Call the local compiler to obtain specific macro definitions in the pre-compiled Makefile script.

[0052] In an embodiment of the present application, a Makefile script is pre-written for porting the CODESYS runtime software to a system under the Xenomai framework. The Makefile script includes specific macro definitions, which define the COBALT kernel code and symbol packaging of the CODESYS runtime software to take effect in the system under the Xenomai framework.

[0053] During the CODESYS runtime software port, the pre-written Makefile script is loaded using the make tool, which searches for a local compiler and then invokes it to retrieve specific macro definitions from the Makefile script. The make tool is a system management tool in Linux systems, primarily used to manage C / C++ projects. It compiles the project's source code files using the rules defined in the Makefile script to generate an executable program.

[0054] Step S102: Based on the compilation parameters in the Makefile script, obtain the libcobalt library header file and the Xenomai header file.

[0055] The compilation parameters include the libcobalt library header file path and the Xenomai header file path.

[0056] Specifically, the compilation parameters in the Makefile script (i.e., the libcobalt library header file path and the Xenomai header file path) can be passed to the local compiler through the make tool, and the local compiler can find the libcobalt library header file and the Xenomai header file according to the libcobalt library header file path and the Xenomai header file path.

[0057] Step S103: Find the source code file in the specified format under the path where the Makefile script is located, and convert the source code file in the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file.

[0058] The specified formats include .c format and .cpp format. In the embodiment of the present application, the make tool can automatically check the .c format and .cpp format (CODESYS runtime software) source code files in the Makefile script path. Then, the .c format and .cpp format source code files are converted into binary target files using the libcobalt library header file and the Xenomai header file for subsequent linking.

[0059] Step S104: Obtain the static library file of the CODESYS runtime software.

[0060] In an embodiment of the present application, a local linker can be automatically searched through the make tool (a linker is a program used to link one or more target files plus libraries generated by a compiler or assembler into an executable file).

[0061] When obtaining the static library file of the CODESYS runtime software, the file path of the static library file can be passed to the local linker using the make tool. The local linker then searches for the static library file based on the file path. The static library file is the core file used by the CODESYS runtime software to execute services and implement the service functions of the CODESYS runtime software.

[0062] In an embodiment of the present application, after the source code file in the specified format is converted into a binary target file, the path of the binary target file can be passed to the local linker through the make tool so that the local linker can obtain the binary target file for subsequent linking.

[0063] Step S105: Obtain the storage paths of the real-time related library libcobalt and the memory management library of the CODESYS runtime software, so that the local linker can obtain the library files of the real-time related library libcobalt and the memory management library.

[0064] The memory management library is used for memory management, such as creating and reclaiming controllable dynamic memory, thereby avoiding memory fragmentation. The real-time related library libcobalt is used to implement system calls of the COBALT kernel.

[0065] In an embodiment of the present application, the storage paths of the real-time related library libcobalt and the memory management library can be automatically passed to the local linker through the make tool. The local linker obtains the library files of the real-time related library libcobalt and the memory management library according to the storage paths of the real-time related library libcobalt and the memory management library.

[0066] Step S106: The symbol packaging rule file path is passed in so that the local linker obtains the symbol packaging rules in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software.

[0067] Symbol wrapping rule files may include, but are not limited to, cobalt.wrappers and modechk.wrappers files. The path to the symbol wrapping rule file can be specified in the Makefile script. The symbol wrapping rule file defines symbol wrapping rules, which are used to wrap the POSIX interface names referenced in the CODESYS runtime software into new interface names so that it can run on a system running under the Xenomai framework.

[0068] Step S107: The packaging parameters of the main function are passed to the local linker to implement the main function after the CODESYS runtime software packaging.

[0069] Specifically, step S107 includes the following steps S1071-S1073.

[0070] Step S1071: Initialize module parameters to the local linker.

[0071] The initialization module parameters include the file path of a designated file for implementing the main function (main function) after the CODESYS runtime software is packaged.

[0072] Step S1072: Acquire the designated file based on the file path of the designated file.

[0073] Step S1073: The main function packaging parameters for packaging the main function in the designated file are passed to the local linker through the Makefile script.

[0074] Step S108: Link the binary target file, the static library file, the library file of the real-time related library libcobalt, and the library file of the memory management library through the local linker to obtain the target file that can be executed under the Xenomai framework.

[0075] The local linker can be used to link one or more target files plus libraries generated by a compiler or assembler into an executable file. The process of linking multiple files into an executable file through a local linker is a prior art and will not be described in detail in the embodiments of this application.

[0076] The transplantation method of CODESYS runtime software provided in the embodiment of the present application obtains the specific macro definition in the pre-compiled Makefile script, which defines the COBALT kernel code and symbol packaging of the CODESYS runtime software to be effective in the system under the Xenomai framework; obtains the libcobalt library header file and the Xenomai header file based on the compilation parameters in the Makefile script; finds the source code file of the specified format under the path where the Makefile script is located, and converts the source code file of the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file; obtains the static library file of the CODESYS runtime software; obtains the CODESYS The storage paths of the real-time related library libcobalt and the memory management library of the CODESYS runtime software are input, so that the local linker can obtain the library files of the real-time related library libcobalt and the memory management library; the symbol packaging rule file path is input, so that the local linker can obtain the symbol packaging rules in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software; the packaging parameters of the main function are input to the local linker to implement the main function after the CODESYS runtime software is packaged; and the binary target file, the static library file, the library file of the real-time related library libcobalt, and the library file of the memory management library are linked by the local linker to obtain the target file that can be executed under the Xenomai framework. During this process, by passing in the symbol packaging rule file path, the local linker can obtain the symbol packaging rules to package the POSIX interface referenced in the CODESYS runtime software. By passing in the packaging parameters of the main function to the local linker, the main function of the CODESYS runtime software after packaging can be implemented, and the local linker can link the converted binary target files that can be executed by the system under the Xenomai framework, the static library files for executing the business functions of the CODESYS runtime software, the memory management library for memory management, and the system call real-time related library libcobalt for implementing the COBALT kernel, so that the linked target files can be executed by the system under the Xenomai framework, thereby porting the CODESYS runtime software to the system under the Xenomai framework, expanding the application scenarios of the CODESYS runtime software, and facilitating the widespread promotion and use of the CODESYS runtime software.

[0077] Second, see Figure 2 The embodiment of the present application provides a CODESYS runtime software transplantation device for transplanting the CODESYS runtime software to a system under the Xenomai framework. The CODESYS runtime software transplantation device includes:

[0078] The first acquisition unit is used to call the local compiler to obtain a specific macro definition in a pre-compiled Makefile script, wherein the specific macro definition defines the COBALT kernel code and symbol packaging of the CODESYS runtime software to be effective in the system under the Xenomai framework;

[0079] A second obtaining unit is configured to obtain a libcobalt library header file and a Xenomai header file based on compilation parameters in the Makefile script, wherein the compilation parameters include a path of the libcobalt library header file and a path of the Xenomai header file;

[0080] A search and conversion unit is used to find a source code file in a specified format under the path where the Makefile script is located, and convert the source code file in the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file. The specified format includes .c format and .cpp format;

[0081] A third acquisition unit is used to acquire the static library file of the CODESYS runtime software;

[0082] a fourth acquisition unit, configured to acquire storage paths of a real-time related library libcobalt and a memory management library of the CODESYS runtime software, so that a local linker can acquire library files of the real-time related library libcobalt and the memory management library, wherein the memory management library is used for memory management and the real-time related library libcobalt is used to implement system calls of the COBALT kernel;

[0083] The first input unit is used to input the symbol packaging rule file path so that the local linker obtains the symbol packaging rule in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software;

[0084] The second input unit is used to input the packaging parameters of the main function to the local linker, so as to realize the main function after the CODESYS runtime software is packaged;

[0085] The link unit is used to link the binary target file, the static library file, the library file of the real-time related library libcobalt and the library file of the memory management library through a local linker to obtain a target file that can be executed under the Xenomai framework.

[0086] The working process, working details and technical effects of the device provided in the second aspect of this embodiment can be found in the first aspect of the embodiment and will not be repeated here.

[0087] like Figure 3 As shown, the third aspect of an embodiment of the present application provides a CODESYS runtime software transplantation device, comprising a memory, a processor and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the CODESYS runtime software transplantation method as described in the first aspect of the embodiment.

[0088] For example, the memory may include, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, first-in-first-out memory (FIFO) and / or first-in-last-out memory (FILO), etc.; the processor may be, but is not limited to, a microprocessor of the STM32 series, an ARM (Advanced RISC Machines), an X86 or other architecture processor, or a processor with an integrated NPU (neural-network processing units); the transceiver may be, but is not limited to, a WiFi (Wireless Fidelity) wireless transceiver, a Bluetooth wireless transceiver, a General Packet Radio Service (GPRS) wireless transceiver, a ZigBee protocol (a low-power local area network protocol based on the IEEE802.15.4 standard, ZigBee) wireless transceiver, a 3G transceiver, a 4G transceiver and / or a 5G transceiver, etc.

[0089] The working process, working details and technical effects of the device provided in the third aspect of this embodiment can be found in the first aspect of the embodiment and will not be described in detail here.

[0090] A fourth aspect of this embodiment provides a computer-readable storage medium storing instructions including the CODESYS runtime software migration method described in the first aspect of the embodiment. Specifically, the computer-readable storage medium stores instructions that, when executed on a computer, execute the CODESYS runtime software migration method described in the first aspect. The computer-readable storage medium refers to a data storage medium and may include, but is not limited to, a floppy disk, a CD, a hard disk, a flash memory, a USB flash drive, and / or a memory stick. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable device.

[0091] The working process, working details and technical effects of the computer-readable storage medium provided in the fourth aspect of this embodiment can be found in the first aspect of the embodiment and will not be repeated here.

[0092] A fifth aspect of this embodiment provides a computer program product comprising instructions, which, when executed on a computer, causes the computer to execute the CODESYS runtime software porting method as described in the first aspect of the embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0093] The multiple embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiments. Persons of ordinary skill in the art will be able to understand and implement the present embodiments without inventive effort.

[0094] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a warehouse code merging device to execute the methods described in each embodiment or certain parts of the embodiment.

[0095] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A method for porting CODESYS runtime software to a system under the Xenomai framework, characterized in that: include: Call the local compiler to obtain the specific macro definition in the pre-compiled Makefile script, which defines the COBALT kernel code and symbol packaging of the CODESYS runtime software to take effect in the system under the Xenomai framework; Obtain the libcobalt library header file and the Xenomai header file based on the compilation parameters in the Makefile script, wherein the compilation parameters include the libcobalt library header file path and the Xenomai header file path; Find a source code file in a specified format under the path where the Makefile script is located, and convert the source code file in the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file. The specified format includes .c format and .cpp format. Obtaining the static library file of the CODESYS runtime software; Obtaining the storage paths of the real-time related library libcobalt and the memory management library of the CODESYS runtime software so that the local linker can obtain the library files of the real-time related library libcobalt and the library files of the memory management library, wherein the memory management library is used for memory management and the real-time related library libcobalt is used to implement the system call of the COBALT kernel; Passing in the symbol packaging rule file path so that the local linker obtains the symbol packaging rules in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software; Passing the packaging parameters of the main function to the local linker to implement the main function after the CODESYS runtime software is packaged; The binary target file, the static library file, the library file of the real-time related library libcobalt and the library file of the memory management library are linked by a local linker to obtain a target file that can be executed under the Xenomai framework.

2. The method according to claim 1, characterized in that Before calling the local compiler, the method further includes: The pre-written Makefile script is loaded and the local compiler is searched.

3. The method according to claim 1, characterized in that The compilation parameters in the Makefile script are used to obtain the libcobalt library header file and the Xenomai header file, including: Passing the compilation parameters in the Makefile script into the local compiler; Based on the libcobalt library header file path and the Xenomai header file path in the compilation parameters, the libcobalt library header file and the Xenomai header file are found by the local compiler.

4. The method according to claim 1, wherein After converting the source code file in the specified format into a binary target file, the method further includes: The path of the binary object file is passed to the local linker.

5. The method according to claim 1, wherein The obtaining of the static library file of the CODESYS runtime software includes: Pass the file path of the static library file into the local linker; The static library file is found by the local linker according to the file path.

6. The method according to claim 1, characterized in that The packaging parameters of the main function are passed to the local linker, including: Passing initialization module parameters to the local linker, wherein the initialization module parameters include a file path of a designated file for implementing a main function after the CODESYS runtime software is packaged; Obtain the specified file based on the file path of the specified file; The main function packaging parameters for packaging the main function in the designated file are passed into the local linker through the Makefile script.

7. The method according to claim 1, characterized in that The symbol packaging rule files include a cobalt.wrappers file and a modechk.wrappers file.

8. A CODESYS runtime software transplantation device for transplanting CODESYS runtime software to a system under the Xenomai framework, characterized in that: include: The first acquisition unit is used to call the local compiler to obtain a specific macro definition in a pre-compiled Makefile script, wherein the specific macro definition defines the COBALT kernel code and symbol packaging of the CODESYS runtime software to be effective in the system under the Xenomai framework; A second obtaining unit is configured to obtain a libcobalt library header file and a Xenomai header file based on compilation parameters in the Makefile script, wherein the compilation parameters include a path of the libcobalt library header file and a path of the Xenomai header file; A search and conversion unit is used to find a source code file in a specified format under the path where the Makefile script is located, and convert the source code file in the specified format into a binary target file based on the libcobalt library header file and the Xenomai header file. The specified format includes .c format and .cpp format; A third acquisition unit is used to acquire the static library file of the CODESYS runtime software; a fourth acquisition unit, configured to acquire storage paths of a real-time related library libcobalt and a memory management library of the CODESYS runtime software, so that a local linker can acquire library files of the real-time related library libcobalt and the memory management library, wherein the memory management library is used for memory management and the real-time related library libcobalt is used to implement system calls of the COBALT kernel; The first input unit is used to input the symbol packaging rule file path so that the local linker obtains the symbol packaging rule in the symbol packaging rule file to package the POSIX interface referenced in the CODESYS runtime software; The second input unit is used to input the packaging parameters of the main function to the local linker, so as to realize the main function after the CODESYS runtime software is packaged; The link unit is used to link the binary target file, the static library file, the library file of the real-time related library libcobalt and the library file of the memory management library through a local linker to obtain a target file that can be executed under the Xenomai framework.

9. A CODESYS runtime software transplantation device, characterized in that: The system comprises a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the CODESYS runtime software transplantation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the CODESYS runtime software migration method according to any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • Method for transplanting universal boot loader on specific hardware platform

    CN102520993A

  • Method used for cross-platform transplantation of software of PLC (Programmable Logic Controller) of wind power control system

    CN102830649A