CN117806651A - PLC software increment compiling method and device - Google Patents

PLC software increment compiling method and device Download PDF

Info

Publication number
CN117806651A
CN117806651A CN202311864133.9A CN202311864133A CN117806651A CN 117806651 A CN117806651 A CN 117806651A CN 202311864133 A CN202311864133 A CN 202311864133A CN 117806651 A CN117806651 A CN 117806651A
Authority
CN
China
Prior art keywords
file
pou
compiled
compiling
changed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311864133.9A
Other languages
Chinese (zh)
Inventor
张铎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kyland Technology Co Ltd
Original Assignee
Kyland Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kyland Technology Co Ltd filed Critical Kyland Technology Co Ltd
Priority to CN202311864133.9A priority Critical patent/CN117806651A/en
Publication of CN117806651A publication Critical patent/CN117806651A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The application provides a PLC software an incremental compiling method and device thereof, the method comprising the following steps: detecting a check code of the PLC software to be compiled, and determining a changed file; determining the PLC software to be compiled only when the POU file is changed, POU file to be changed compiling and generating a target file; and linking the generated target file with the original compiling file which is unchanged to generate an executable file. According to the method and the device, the type of the modified file in the PLC software to be compiled is confirmed, when only the POU file is changed, the changed POU file is compiled to generate the target file, and other files do not need to be compiled again, so that the software compiling efficiency is improved, and the software development progress is accelerated.

Description

PLC software increment compiling method and device
Technical Field
The present application relates to a program in the technical field of compiling, the method comprises the steps of, in particular to PLC software increment compiling method and device.
Background
In the age of rapid development of the internet industry, the development, delivery frequency and period of software products are shorter and shorter, and the requirements of software development on development efficiency and product quality are higher and higher.
With the lapse of time and the alternation of software versions, the software functions are continuously increased, so that the software scale is larger and larger, and the code quantity of the project is exponentially increased. Along with the increase of the code quantity, each sub-module in the project depends on more and more complicated, so that the cost of the compiling time is higher and higher, the progress of software development and testing is seriously influenced, and at present, when a plurality of software is subjected to function addition or function modification, full compiling is still required, so that the development efficiency is low, the original code or function is easy to operate by mistake, and the original function is lost or abnormal in operation, therefore, the function addition or modification of the software is realized on the premise of not carrying out full compiling, and the important direction of improving the development efficiency and ensuring the stability of the software operation is realized.
Disclosure of Invention
In view of this, the application proposes a method and a device for incremental compiling of PLC software, by confirming the type of the modified file in the PLC software to be compiled, when only the POU file changes, the changed POU file is compiled to generate the target file, and other files do not need to be compiled again, thereby improving the compiling efficiency of the software and accelerating the development progress of the software.
In a first aspect, the present application provides a PLC software incremental compiling method, which is characterized by comprising:
detecting a check code of the PLC software to be compiled, and determining a changed file;
when determining that only POU files in the PLC software to be compiled are changed, compiling the changed POU files and generating target files;
and linking the generated target file with the original compiling file which is unchanged to generate an executable file.
By the method, the check code of the PLC software to be compiled is detected, to determine that only POU (Programming Organisation Unit, program organization unit) files of the PLC software species to be compiled are changed, then compiling the POU file with the change to generate a compiled target file, and then linking the generated target file with other original compiled files which are unchanged to generate a final executable file. When other files except the POU file are changed, the corresponding compiling is not executed, so that the error in the execution process of the PLC software is avoided. By the incremental compiling method, corresponding incremental compiling tasks can be executed only for the changed POU files, and other files do not need to be compiled again, so that the software compiling efficiency is improved, and the software development progress is accelerated.
Optionally, the detecting the check code of the PLC software to be compiled, and determining the changed file includes:
detecting the file type of the modified content in the PLC software to be compiled according to the check code modified in the last time and the check code modified in the current time of the PLC software to be compiled;
when the check code of only the POU file changes, it is determined that only the POU file in the PLC software to be compiled is modified.
By the method, the corresponding check code can be regenerated after each modification of the PLC software to be compiled, the check code can be MD5 code, and by comparing and detecting the check code generated after the previous modification of the PLC software to be compiled and the generated check code after the current modification, the types of files in the PLC software to be compiled can be detected, and when the check code of only POU files changes, the fact that only the POU files in the PLC software to be compiled are modified can be determined, so that the compiling of the POU files is executed.
Optionally, the file to be compiled for determining whether the change occurs or not includes an algorithm part, equipment information and variable information;
the algorithm part comprises a POU file and a resource file, wherein the POU file comprises a program, a function block and a function, and the resource file comprises a local variable configuration file, a global variable configuration file and a task configuration file;
the device information includes a device configuration file;
the variable information includes shared variables and data structures.
From the above, the PLC software to be compiled may be classified into an algorithm part, device information and variable information according to file types, wherein the algorithm part includes a POU file and a resource file, the POU file includes a program, a function block and a function, the resource file includes a local variable configuration file, a global variable configuration file and a task configuration file, the device information may include a device configuration file, and the variable information may include shared variables and data structures. The incremental compiling method can be executed only when the POU file changes, and when the other files except the POU file are detected to change, the incremental compiling is not executed.
Optionally, the detecting the check code of the PLC software to be compiled, and determining the changed file includes:
the POU file, the resource file, the equipment information and the variable information are respectively provided with at least one corresponding check code;
respectively comparing the check codes corresponding to the resource file, the equipment information and the variable information for two times, and determining whether the resource file, the equipment information and the variable information are changed or not;
and when at least one of the check codes respectively corresponding to the program, the function block and the function is changed, determining that only the POU file in the PLC software to be compiled is modified.
Optionally, the method further comprises:
and when the change of the resource file, the equipment information and the variable information is determined, the detection of whether the POU file is changed is not executed.
By the above, according to the configured MD5 code generation rule, each file included in the POU file, the resource file, the device information and the variable information may have a corresponding MD5 code, when detecting the changed file type of the PLC software to be compiled, the check codes corresponding to the resource file, the device information and the variable information may be first compared and detected, to determine whether the resource file, the device information and the variable information are changed, if so, the condition of incremental compiling of the present application is not satisfied, if not, the detection of whether the POU file is changed is not executed any more, if not, the check codes corresponding to the program, the function block and the function included in the POU file are further compared and detected, and when any one or more of the check codes corresponding to the program, the function block and the function respectively are changed, it may be determined that only the POU file in the PLC software to be compiled is modified, and compiling of the POU file may be executed.
Optionally, compiling and generating the target file by the POU file to be changed includes:
dividing the POU file into a plurality of units according to a dividing strategy;
determining at least one target unit to be compiled in the plurality of units, and transmitting resources required by each target unit;
compiling the at least one target unit to generate a target file of the target unit.
Therefore, when compiling the POU file, only part of the content in the POU file may need to be compiled, and other content does not need to be compiled, based on the fact, the POU file can be divided into a plurality of units, and resources required by a target unit to be compiled are transferred according to resource calling relations among the plurality of units, so that the target unit can call the resources required by the compiling of the target unit, then the target unit is compiled, the target file after the compiling of the target unit is generated, only the unit to be compiled can be compiled independently by dividing the POU file, and other units do not need to be compiled, so that the software compiling efficiency is improved, and the software development progress is accelerated.
Optionally, the partitioning the POU file into a plurality of units according to a partitioning policy includes:
dividing the POU file into a program, a functional block and a function;
and taking each source code file contained in the program, the functional block and the function as a minimum unit, and dividing the program, the functional block and the function into a plurality of units respectively.
By dividing the POU file into the Program, the Function Block, and the Function (Function) from top to bottom, and then dividing the Program, the Function Block, and the Function into a plurality of units according to each source code file included in the Program, the Function Block, and the Function, each source code file corresponds to one Program, the Function Block, or the Function, for example, dividing the Program into the Program 1, the Program 2, and the like, dividing the Function Block into the Function 1, the Function 2, and the like, and dividing the Function into the Function 1, the Function 2, and the like, the software can be more easily expanded and modified by dividing the Program, the Function Block, and the Function into smaller parts.
Optionally, the delivering the resources required by each target unit includes:
according to the direct calling relation among the units, determining other units on which each target unit depends;
extracting the dependency information of other units depending on each target unit according to other units depending on each target unit, and putting the dependency information into a header file corresponding to the called unit, wherein the header file also comprises the description information of the called unit;
and transmitting the header file corresponding to the called unit to a target unit needing the header file.
In the compiling process, the calling relation among the units can occur, so that each target unit to be compiled needs to be ensured to be capable of independently acquiring the depended resources and independently compiling, other units depended on by each target unit are determined by identifying the direct calling relation among a plurality of units, then the depended information of each target unit is extracted and put into the header file corresponding to the called unit by extracting the depended information of the other units, the header file also comprises the description information of the called unit, such as function signature, function description, input and output information, calling convention and the like, and then the header file corresponding to the called unit is transferred to the target unit needing the header file.
Optionally, the method further comprises:
and determining the dependency information of each unit in the plurality of units on the target unit, putting the dependency information into a header file corresponding to the target unit, and transmitting the header file of the target unit to the unit needing the header file.
By determining the dependency information of other units in the units on the target unit, the dependency information is put into the header file corresponding to the target unit, and the header file is transferred to the unit needing the header file, so that the other units can normally call the target file in the running process.
In a second aspect, the present application provides a PLC software incremental compiling apparatus, including:
the detection module is used for detecting the check code of the PLC software to be compiled and determining a changed file;
the compiling module is used for determining that when only POU files in the PLC software to be compiled are changed, compiling the changed POU files and generating target files;
and the link module is used for linking the generated target file with the original compiling file which is unchanged to generate an executable file.
In a third aspect, the present application provides a computing device comprising:
a processor;
a memory for storing one or more programs;
when the one or more programs are executed by the processor, the processor is caused to implement a PLC software incremental compiling method as described above.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a computer, implements a PLC software incremental compiling method as described above.
These and other aspects of the application will be apparent from and elucidated with reference to the embodiment(s) described hereinafter.
Drawings
Fig. 1 is a flowchart of a PLC software incremental compiling method according to an embodiment of the present application;
fig. 2 is a schematic diagram of dividing a POU according to an embodiment of the present application;
FIG. 3 is a schematic diagram of generating an executable file according to an embodiment of the present application;
fig. 4 is a block diagram of a PLC software incremental compiling apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of a computing device according to an embodiment of the present application.
It should be understood that in the foregoing structural schematic diagrams, the sizes and forms of the respective block diagrams are for reference only and should not constitute an exclusive interpretation of the embodiments of the present application. The relative positions and inclusion relationships between the blocks presented by the structural diagrams are merely illustrative of structural relationships between the blocks, and are not limiting of the physical connection of the embodiments of the present application.
Detailed Description
The technical scheme provided by the application is further described below by referring to the accompanying drawings and examples. It should be understood that the system structures and service scenarios provided in the embodiments of the present application are mainly for illustrating possible implementations of the technical solutions of the present application, and should not be construed as the only limitation of the technical solutions of the present application. As one of ordinary skill in the art can know, with the evolution of the system structure and the appearance of new service scenarios, the technical scheme provided in the application is applicable to similar technical problems.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. If there is a discrepancy, the meaning described in the present specification or the meaning obtained from the content described in the present specification is used. In addition, the terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
The embodiment of the application provides a PLC software incremental compiling method which can be used for realizing incremental compiling applied to an IEC61131-3 language compiler, wherein the IEC61131-3 programming language is a standard software programming language which is researched and developed by the International electrotechnical Commission and comprises a 5-step programming language, and can be used for controlling industrial automation equipment. The IEC61131-3 standard defines five PLC programming languages, including Instruction List (IL), structured Text (ST), ladder Diagram (Ladder Diagram, LAD), functional block Diagram (Function Block Diagram, FBD), and sequential functional Diagram (Sequential Function Chart, SFC). According to the embodiment of the application, based on the IEC61131-3 standard, the type of the modified file in the PLC software to be compiled is confirmed, when only POU (Programming Organisation Unit, program organization unit) files are changed, the changed POU files are compiled to generate target files, other files do not need to be compiled again, the software compiling efficiency is improved, and the software development progress is accelerated.
Fig. 1 is a flowchart of a PLC software incremental compiling method according to an embodiment of the present application, and referring to fig. 1, the incremental compiling method includes:
s110: and detecting a check code of the PLC software to be compiled, and determining a changed file.
In this embodiment, before executing the incremental compiling process, it is necessary to detect files included in the PLC software to be compiled to determine which part of the files in the PLC software to be compiled changes. The files to be compiled for the PLC software to be compiled need to judge whether the change occurs comprise an algorithm part, equipment information and variable information, wherein the algorithm part comprises a POU file and a resource file, the POU file comprises a program, a functional block and a function, and the resource file comprises a local variable configuration file, a global variable configuration file and a task configuration file; the device information includes a device configuration file; the variable information includes shared variables and data structures.
In some embodiments, the PLC software to be compiled may have a complete check code, which may be an MD5 code, and each modification of the PLC software to be compiled regenerates a corresponding MD5 code, so that by comparing and detecting the MD5 code generated after the previous modification of the PLC software to be compiled with the MD5 code generated after the current modification, it is possible to detect which file types in the PLC software to be compiled are modified.
In some embodiments, each file included in the POU file, the resource file, the device information, and the variable information may have a corresponding MD5 code, so that it may be detected which part of the POU file, the resource file, the device information, and the variable information is modified by comparing and detecting the MD5 codes corresponding to the POU file, the resource file, the device information, and the variable information twice.
The method can comprise the steps of generating MD5 codes of partial files in software to be compiled after a user modifies the partial files each time, wherein the MD5 codes are also called MD5 information digest algorithms, and the method is a widely used password hash function. It should be noted that, when the generation and the storage of the MD5 code are performed, one MD5 code may be stored for each file in the software to be compiled, or one overall MD5 code may be stored for the whole software to be compiled. When the user modifies the file again and tries to compile, the MD5 code of the file is recalculated, the newly calculated MD5 code is compared with the previously saved MD5 code, and if the MD5 code of a certain file changes, the file is modified.
Based on this, in this embodiment, by comparing MD5 generated in two times before and after, it can be determined which files are modified by the user this time, when the user modifies only the POU file, incremental compiling of the POU file may be performed, and when the user modifies some configuration files, after the modification of the configuration files may cause a change in the call of a plurality of files, incremental compiling of the POU file is not performed, so as to avoid an abnormality in the call relationship between the POU file after compiling and the changed configuration file, and affect the normal operation of the whole software.
S120: when the fact that only POU files in the PLC software to be compiled are changed is determined, the changed POU files are compiled and target files are generated.
The incremental compiling method of the embodiment needs to be executed only when the POU file is changed, and when other files except the POU file are detected to be changed, such as a resource file, equipment information, variable information and the like, the resource file, the equipment information and the variable information may be modified to cause the change of the call of a plurality of files in the PLC software, so that the whole PLC software needs to be fully compiled to ensure the normal operation of the PLC software. Based on the above, when the PLC software to be compiled has a complete MD5 code, it can determine whether only the POU file is modified in the PLC software to be compiled by comparing and detecting the MD5 code generated after the previous modification of the PLC software to be compiled with the MD5 code generated after the current modification.
In some embodiments, when the POU file, the resource file, the device information and the variable information respectively have at least one corresponding check code, the check codes corresponding to the local variable configuration file, the global variable configuration file, the task configuration file, the device configuration file, the shared variable and the data structure in the resource file may be first compared and detected, whether the resource file, the device information and the variable information change or not may be determined, if the change does not satisfy the condition that the POU file is separately compiled in an incremental manner in the application, the detection of whether the POU file changes is not performed any more, if the change does not determine that the resource file, the device information and the variable information do not change, the check codes corresponding to the program, the function block and the function included in the POU file may be further compared and detected, and when any one or more of the check codes corresponding to the program, the function block and the function respectively change, it may be determined that only the POU file is modified in the PLC software to be compiled, and the incremental compilation of the POU file may be performed.
In some embodiments, compiling and generating the changed POU file may specifically only independently compile a program, a function block or a function in the POU file to generate a corresponding target file. Specifically, as shown in fig. 2, by dividing the POU file into a Program (Program), a Function Block (Function Block), and a Function (Function), wherein the Program is the highest-level division, a Program is usually an independent software application that can run independently and provide services or functions to users; a functional block is a set of related functions and operations in a program that are logically closely related and together perform a particular task or provide a related set of services; a function is a lower level division of functional blocks that describes a single operation or capability in a program, and is typically self-contained, meaning that it has an input, an output, and a clear definition and purpose.
According to the above-described divided programs, function blocks, and functions, each source code file included in each program, function block, and function is taken as an independent minimum unit, for example, the program may be embodied as a program P1, a program P2, or the like, the function block may be embodied as a function block FB1, a function block FB2, or the like, and the function may be embodied as a function F1, a function F2, or the like, and by dividing the program, the function block, and the function according to the source code files included therein, it is possible to facilitate compiling, expanding, and modifying of software.
Based on the divided programs, functional blocks and functions, one of the programs, functional blocks or functions can be determined to be a target unit to be compiled according to the incremental compiling requirement, and in the compiling process of the target unit, a calling relationship can occur, so that certain target units need to acquire information of other units in compiling. In order to ensure that independent compiling is performed smoothly, the present embodiment analyzes the source code file corresponding to each unit to determine other units on which each unit depends, and the analysis process can be completed by statically analyzing codes or constructing a dependency graph. For each target unit that needs to be compiled independently, relevant information of other units on which the target unit depends is extracted, and the information may include function signatures, data structure definitions, constant values and the like. And then, the extracted dependent information is placed into the header file by creating the header file, wherein the header file also contains description information of the called unit, such as function signature, function description, input and output information, calling convention and the like, and does not contain specific implementation details. Thus, when compiling, the compiling can be performed by only using the corresponding header file, and the complete code of the called unit is not needed. Based on the above, even if the compiling of the called unit is not completed, the target unit which depends on the called unit can be compiled by using the head file which depends on the called unit, so that each target unit can be independently compiled.
In some embodiments, the dependency information of other units in the plurality of units on the target unit may be determined according to other units on which each unit depends, the dependency information is put into a header file corresponding to the target unit, and the header file is transferred to a unit needing the header file, so that other units can call the target file normally in the operation process.
And compiling the target unit to be compiled through the compiling task, and generating a target file corresponding to the target unit. When the number of target units to be compiled is large, a plurality of compiling tasks can be constructed according to the allocable resources of the system, one target unit to be compiled is allocated to each compiling task, then compiling of the plurality of target units is executed through the plurality of compiling tasks in a parallel mode, and after compiling of source code files (usually. C or. Cpp files) corresponding to each target unit is completed, target files (usually. O files or. Obj files) are generated.
It should be noted that, in the compiling process, when a certain compiling task goes wrong, the compiling task may stop compiling the target unit being compiled, record the error information, and then reassign a target unit to be compiled for the compiling task. After compiling all target units, unified analysis can be carried out according to recorded error information, error reasons are determined, and related measures are taken to solve errors.
S130: and linking the generated target file with the original compiling file which is unchanged to generate an executable file.
After the independent compiling of the divided target units is completed, other units in the POU file are not compiled, so that the original target files can be continuously used, and then a linking strategy reverse to the dividing strategy is adopted to link the target files generated by compiling the target units with the original target files of the uncompiled units so as to generate final executable files.
For example, as shown in fig. 3, the present embodiment compiles the program 1 and the program 2 in the program to generate new o files, and if the program 3, the function blocks and the functions are not compiled, the old o files can be continuously used, and the new o files and the old o files are linked to generate final executable files, so that incremental compiling of the software to be compiled in the present embodiment is realized.
In summary, according to the incremental compiling method for PLC software provided in the embodiments of the present application, by detecting the check code after each change of the software to be compiled, it is determined whether the software to be compiled has only modified the POU file, when only the POU file is modified, the POU file is divided into a plurality of units, and the resources required by the target unit to be compiled are transferred according to the resource calling relationship between the plurality of units, so that the target unit can call the resources required by the compiling of the target unit, then the target unit is compiled, the target file compiled by the target unit is generated, and then the generated target file is linked with the original target files of other uncompiled units, so as to generate the final executable file. By the PLC software increment compiling method, only the minimum unit to be compiled can be compiled independently, other units do not need to be changed, so that the software compiling efficiency is improved, and the software development progress is accelerated.
As shown in fig. 4, the embodiment of the present application provides a PLC software incremental compiling apparatus, which may be used to implement any step of a PLC software incremental compiling method and alternative embodiments thereof as shown in fig. 1 to 3. Referring to fig. 4, the apparatus includes a detection module 410, a compiling module 420, and a linking module 430.
The detection module 410 is configured to detect a check code of the PLC software to be compiled, and determine a changed file; the compiling module 420 is configured to compile the changed POU file and generate a target file when determining that only the POU file in the PLC software to be compiled is changed; the linking module 430 is configured to link the generated target file with an original compiled file that has not changed, and generate an executable file.
It should be understood that the apparatus or module in the embodiments of the present application may be implemented by software, for example, by a computer program or instruction having the functions described above, and the corresponding computer program or instruction may be stored in a memory inside the terminal, and the processor reads the corresponding computer program or instruction inside the memory to implement the functions described above. Alternatively, the apparatus or module of the embodiments of the present application may be implemented by hardware. Still further, an apparatus or module in an embodiment of the present application may also be implemented by a combination of a processor and software modules.
It should be understood that, for details of processing of the apparatus or the module in the embodiments of the present application, reference may be made to the embodiments shown in fig. 1 to 3 and related expressions of related extended embodiments, and the embodiments of the present application will not be repeated here.
Fig. 5 is a block diagram of a computing device 500 provided in an embodiment of the present application. The computing device 500 includes: processor 510, memory 520, communication interface 530, bus 540.
It should be appreciated that the communication interface 530 in the computing device 500 shown in fig. 5 may be used to communicate with other devices.
Wherein the processor 510 may be coupled to a memory 520. The memory 520 may be used to store the program codes and data. Accordingly, the memory 520 may be a storage unit internal to the processor 510, an external storage unit independent of the processor 510, or a component including a storage unit internal to the processor 510 and an external storage unit independent of the processor 510.
Optionally, computing device 500 may also include a bus 540. The memory 520 and the communication interface 530 may be connected to the processor 510 via a bus 540. Bus 540 may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus 540 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one line is shown in fig. 5, but not only one bus or one type of bus.
It should be appreciated that in embodiments of the present application, the processor 510 may employ a central processing unit (central processing unit, CPU). The processor may also be other general purpose processors, digital signal processors (digital signal processor, DSP), application specific integrated circuits (application specific integrated circuit, ASIC), field programmable gate arrays (field programmable gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. Or the processor 510 may employ one or more integrated circuits for executing associated programs to carry out the techniques provided in embodiments of the present application.
The memory 520 may include read only memory and random access memory, and provides instructions and data to the processor 510. A portion of the processor 510 may also include non-volatile random access memory. For example, processor 510 may also store information of the device type.
When the computing device 500 is running, the processor 510 executes computer-executable instructions in the memory 520 to perform the operational steps of the method described above.
It should be understood that the computing device 500 according to the embodiments of the present application may correspond to a respective subject performing the methods according to the embodiments of the present application, and that the above-described other operations and/or functions of the respective modules in the computing device 500 are respectively for implementing the respective flows of the methods of the embodiments, and are not described herein for brevity.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present application also provide a computer-readable storage medium having stored thereon a computer program for performing the above-described method when executed by a processor, the method comprising at least one of the aspects described in the above-described embodiments.
Any combination of one or more computer readable media may be employed as the computer storage media of the embodiments herein. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It should be noted that the embodiments described in this application are only some embodiments of the present application, and not all embodiments. The components of the embodiments of the present application, as generally described and illustrated in the figures, may be arranged and designed in a wide variety of different configurations. Thus, the above detailed description of the embodiments of the present application, provided in the accompanying drawings, is not intended to limit the scope of the application as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
The terms first, second, third, etc. or module a, module B, module C, etc. in the description and in the claims, etc. are used solely for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order, as may be appreciated, if permitted, to interchange particular orders or precedence orders to enable embodiments of the present application described herein to be implemented in orders other than those illustrated or described herein.
In the above description, reference numerals indicating steps are not necessarily meant to be performed as such, but intermediate steps or replaced by other steps may be included, and the order of the steps may be interchanged or performed simultaneously where permitted.
The term "comprising" as used in the description and claims should not be interpreted as being limited to what is listed thereafter; it does not exclude other elements or steps. Thus, it should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to, but does not preclude the presence or addition of one or more other features, integers, steps or components, or groups thereof. Thus, the expression "a device comprising means a and B" should not be limited to a device consisting of only components a and B.
Reference in the specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment, but may. Furthermore, in the various embodiments of the application, where no special description or logic conflicts exist, the terms and/or descriptions between the different embodiments are consistent and may be mutually referenced, the technical features of the different embodiments may be combined to form a new embodiment according to their inherent logic relationships.
Note that the above is only the preferred embodiments of the present application and the technical principles applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the present application has been described in connection with the above embodiments, the present invention is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present invention, and the present invention is also within the scope of protection.

Claims (10)

1. The incremental compiling method for the PLC software is characterized by comprising the following steps of:
detecting a check code of the PLC software to be compiled, and determining a changed file;
when determining that only POU files in the PLC software to be compiled are changed, compiling the changed POU files and generating target files;
and linking the generated target file with the original compiling file which is unchanged to generate an executable file.
2. The method of claim 1, wherein detecting the check code of the PLC software to be compiled, determining the changed file comprises:
detecting the file type of the modified content in the PLC software to be compiled according to the check code modified in the last time and the check code modified in the current time of the PLC software to be compiled;
when the check code of only the POU file changes, it is determined that only the POU file in the PLC software to be compiled is modified.
3. The method according to claim 1, wherein the file for determining whether the change occurs in the PLC software to be compiled includes an algorithm part, device information and variable information;
the algorithm part comprises a POU file and a resource file, wherein the POU file comprises a program, a function block and a function, and the resource file comprises a local variable configuration file, a global variable configuration file and a task configuration file;
the device information includes a device configuration file;
the variable information includes shared variables and data structures.
4. A method according to claim 3, wherein detecting the check code of the PLC software to be compiled, determining the changed file comprises:
the POU file, the resource file, the equipment information and the variable information are respectively provided with at least one corresponding check code;
respectively comparing the check codes corresponding to the resource file, the equipment information and the variable information for two times, and determining whether the resource file, the equipment information and the variable information are changed or not;
and when at least one of the check codes respectively corresponding to the program, the function block and the function is changed, determining that only the POU file in the PLC software to be compiled is modified.
5. A method according to claim 3, further comprising:
and when the change of the resource file, the equipment information and the variable information is determined, the detection of whether the POU file is changed is not executed.
6. The method of claim 1, wherein compiling and generating the POU file that will change comprises:
dividing the POU file into a plurality of units according to a dividing strategy;
determining at least one target unit to be compiled in the plurality of units, and transmitting resources required by each target unit;
compiling the at least one target unit to generate a target file of the target unit.
7. The method of claim 6, wherein partitioning the POU file into units according to a partitioning policy comprises:
dividing the POU file into a program, a functional block and a function;
and taking each source code file contained in the program, the functional block and the function as a minimum unit, and dividing the program, the functional block and the function into a plurality of units respectively.
8. The method of claim 6, wherein said communicating the resources required by each target unit comprises:
according to the direct calling relation among the units, determining other units on which each target unit depends;
extracting the dependency information of other units depending on each target unit according to other units depending on each target unit, and putting the dependency information into a header file corresponding to the called unit, wherein the header file also comprises the description information of the called unit;
and transmitting the header file corresponding to the called unit to a target unit needing the header file.
9. The method as recited in claim 8, further comprising:
and determining the dependency information of each unit in the plurality of units on the target unit, putting the dependency information into a header file corresponding to the target unit, and transmitting the header file of the target unit to the unit needing the header file.
10. A PLC software incremental compiling apparatus, comprising:
the detection module is used for detecting the check code of the PLC software to be compiled and determining a changed file;
the compiling module is used for determining that when only POU files in the PLC software to be compiled are changed, compiling the changed POU files and generating target files;
and the link module is used for linking the generated target file with the original compiling file which is unchanged to generate an executable file.
CN202311864133.9A 2023-12-29 2023-12-29 PLC software increment compiling method and device Pending CN117806651A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311864133.9A CN117806651A (en) 2023-12-29 2023-12-29 PLC software increment compiling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311864133.9A CN117806651A (en) 2023-12-29 2023-12-29 PLC software increment compiling method and device

Publications (1)

Publication Number Publication Date
CN117806651A true CN117806651A (en) 2024-04-02

Family

ID=90433037

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311864133.9A Pending CN117806651A (en) 2023-12-29 2023-12-29 PLC software increment compiling method and device

Country Status (1)

Country Link
CN (1) CN117806651A (en)

Similar Documents

Publication Publication Date Title
US11714611B2 (en) Library suggestion engine
US11061648B2 (en) Method and system for arbitrary-granularity execution clone detection
US20200319878A1 (en) Library Model Addition
US9658907B2 (en) Development tools for refactoring computer code
US20230004368A1 (en) Multi-chip compatible compiling method and device
CN112394942B (en) Distributed software development compiling method and software development platform based on cloud computing
CN109918081B (en) Compiling method and compiler
EP3264274B1 (en) Input discovery for unknown program binaries
CN107832059A (en) A kind of code Static Analysis Method and device based on Makefile
CN111459499A (en) Program compiling method and device, computer storage medium and electronic equipment
US20210405980A1 (en) Long method autofix engine
CN106933642B (en) Application program processing method and processing device
CN114518884A (en) Method and device for repairing weak memory order problem
CN110472411B (en) Memory overflow processing method, device, equipment and readable storage medium
US9710360B2 (en) Optimizing error parsing in an integrated development environment
CN117806651A (en) PLC software increment compiling method and device
CN113821486B (en) Method and device for determining dependency relationship between pod libraries and electronic equipment
JP2016128941A (en) Output determination device, output determination method, output determination program, and static analysis device
CN112953721B (en) IPA file analysis method, IPA file analysis device, IPA file analysis equipment and storage medium
CN111880803B (en) Software construction method and device applied to multiple platforms
CN110297639B (en) Method and apparatus for detecting code
CN115168175A (en) Program error solving method, device, electronic equipment and storage medium
CN117806650A (en) Parallel compiling method and device for PLC software, equipment and storage medium
US11650802B2 (en) Idiomatic source code generation
CN116774988B (en) Method and device for releasing frame package mode symbol dependence

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination