<< 点击显示目录 >> 主页 exOS使用助手 > exOS Automation Help > Development > exOS build-chain in Automation Studio |
exOS 具备运行 Linux 程序的能力,还可以在正常 AS 构建的情况下使用外部构建环境编译这些程序。
编译过程的说明在 exOS 软件包说明文件(.exospkg)中有所描述。就像 AS 中的 "软件配置 "指定了应构建并传输到 PLC 的软件一样,exOS 目标配置也指定了应构建并传输到目标的 exOS 组件。
在下图中,组件 gMouse_0、 gThreads_0、 gWaterTank_0、 gBigData_0、 gAnalyzer_0 和 gTypes_0 将被编译并传输到 Linux 目标机(当然,除非它们是二进制包,在这种情况下,它们不会被编译,而只会被传输到目标机系统)
对于在 exOS 目标配置中选择的每个组件,构建过程的顺序如下:
1.根据 AR 和 Linux 源的 .typ 文件生成/更新 exOS 数据模型描述文件
构建指令位于 .exospkg 文件的 <Build> 部分,例如
<?xml version="1.0" encoding="utf-8"?>
<ComponentPackage .. >
..
<Build>
<GenerateDatamodel FileName="WaterTank\WaterTank.typ" TypeName="WaterTank">
<SG4 Include="WaterTank.h"/>
<Output Path="WaterTank"/>
<Output Path="Linux"/>
</GenerateDatamodel>
<BuildCommand Command="C:\Windows\Sysnative\wsl.exe" WorkingDirectory="Linux" Arguments="-d Debian -e sh build.sh $(EXOS_VERSION)">
<Dependency FileName="Linux\exos_watertank.h"/>
<Dependency FileName="Linux\exos_watertank.c"/>
<Dependency FileName="Linux\watertank.c"/>
<Dependency FileName="Linux\termination.h"/>
<Dependency FileName="Linux\termination.c"/>
<Dependency FileName="Linux\CMakeLists.txt"/>
<Dependency FileName="Linux\build.sh"/>
</BuildCommand>
</Build>
</ComponentPackage>
exOS comes with the capability of running Linux programs as well as the possibility to compile those programs with an external build environment in the context of a normal Automation Studio build.
The instructions for the build process are described in the exOS Package description file (.exospkg). Like the "Software Configuration" in Automation Studio assigns the software that should be built and transferred to the PLC, the exOS Target configuration assigns the exOS Components that should be built and transferred to the target.
In the following picture the components gMouse_0, gThreads_0, gWaterTank_0, gBigData_0, gAnalyzer_0 and gTypes_0 are compiled and transferred to the Linux target (unless, of course they are binary packages in which case they will not be compiled but only transferred to the target system)
The build process has the following sequence for every component selected in the exOS Target configuration:
1.Generate / update exOS datamodel description files from a .typ file for AR and Linux sources
The build instruction is placed within the <Build> section of the .exospkg file, for example:
<?xml version="1.0" encoding="utf-8"?>
<ComponentPackage .. >
..
<Build>
<GenerateDatamodel FileName="WaterTank\WaterTank.typ" TypeName="WaterTank">
<SG4 Include="WaterTank.h"/>
<Output Path="WaterTank"/>
<Output Path="Linux"/>
</GenerateDatamodel>
<BuildCommand Command="C:\Windows\Sysnative\wsl.exe" WorkingDirectory="Linux" Arguments="-d Debian -e sh build.sh $(EXOS_VERSION)">
<Dependency FileName="Linux\exos_watertank.h"/>
<Dependency FileName="Linux\exos_watertank.c"/>
<Dependency FileName="Linux\watertank.c"/>
<Dependency FileName="Linux\termination.h"/>
<Dependency FileName="Linux\termination.c"/>
<Dependency FileName="Linux\CMakeLists.txt"/>
<Dependency FileName="Linux\build.sh"/>
</BuildCommand>
</Build>
</ComponentPackage>