OpenSCADAWiki: Home Page En/Using/PLC/firmware ...

Home | Index | Changes | Comments | Users | Registration | Login  Password:  
 
This is an old revision of HomePageEn/Using/PLC/firmware from 2015-11-19 17:34:46..

Firmware and PLC program environment creation of architecture x86

The architecture x86 recently was positioned as embedded and it's real solutions into this industry rarely have resources (< i386), which is not enough for full-featured OS and advanced environment execution. For this reason and by reason of big the architecture unification the individual assemblies of kernel Linux and main programs of the OS environment performed rarely enough, and that typical mostly for the architecture ARM. More interest and practical for x86, for wide the hardware circle, it is assembling firmwares with compressing a root file-system (RFS). But still possible individual assembling by aid of the build systems as "BuildRoot" or "PTXDist", bottom. And also here possible direct installing a Linux distribution.

Instruments for assembling the firmware environments with the compressed RFS, based on distributive ALTLinux

The following requirements were pulled out to the implementation of the PLC firmware of the section:


Given the above requirements, for the creation of the firmware it was chosen the tool for creating the distributions mkimage of ALTLinux. mkimage is the tool for building Sisyphus-based system on basis of template. As an initial set of templates it was taken the set of templates of formation of ALTLinux distributions at git://git.altlinux.org/people/boyarsh/packages/mkimage-profiles-desktop by the command:

As the basis it was taken the "rescue" template, as the most compact and close to the target PLC.


Firstly building performed basing on the package base of the distributive ALTLinux 5.1, there is present the realtime kernel from XENOMAI. For obtaining some specific packages you need to connect the repository of packages "ALTLinux 5.1" from the OpenSCADA project:

rpm ftp://ftp.oscada.org/ALTLinux/5.1 openscada main

Assembling

Firstly it was created the configuration of PLC without local display in mind of the availability of this type of equipment and lack of equipment for the Touch-panels.


New PLC template was named "plc", it was tested on the boards of PC/104 form factor MOPSlcdLX of Kontron company, ATH400-128 of Diamond Systems company and modular PLC LP-8781 of the ICP DAS company. The archive of the resulting mkimage tree with the "plc" template can be downloaded here ftp://ftp.oscada.org/OpenSCADA/PLC (templates and materials of individual controllers are placed in their own directories).


The key points of the configuration of new template was the writing of the new init-script (rc.sysinit), the script of the after installation configuration of the firmware's image and the list of packages in the image of firmware.The first script is designed as the package "startup-plc". The second script was embedded in the template "plc" on the way: profiles/pls/image-scripts.d/01system. The list of packages was embedded in the template "plc" on the path: profiles/pkg/lists/plñ.in.


The procedure of creating the firmware from the image is the following:


The result is an output directory in the "profiles/out/" have look:

Installation

It is possible to download the firmware to: USB-flash, IDE-flash and HDD. However, in the case of the USB-flash there is the problem with waiting for initialization of USB-subsystem and you'll have "to run" some dialogues.


The file system can be FAT or EXT2/3. In the case of EXT3 the root is mounted as in EXT2, because of problems in the initializer. In the case of EXT2/3 you'll need to use not the syslinux boot, but extlinux, the configuration of which is almost the same one.


Next, lets mount the medium and place the files from the output directory on it as follows.
In the case with FAT and syslinux:

In the case with EXT2/3 and extlinux:


To ensure the reliable operation of the operating data stored in the file "work" with the file system EXT3. The file-system of this file is checked for integrity at the initialization. This file is created as follows:


In the case of the file system EXT2/3 on the target disk the "work" file can not be created. In this case, the working data will be placed in the directory "root" of the target disk.

 (2 Kb) This is an unreliable solution because the root file system of the target disk is not static and its check is not possible, because of earlier mounting in the "ro" and the potential unreliability of the check of the file system, mounted at "ro", as well as because of the inability to remount as EXT3.

The next step is the configuration and initialization of the loader. To configure the loader it is necessary to edit the file "syslinux/syslinux.cfg" or "extlinux/extlinux.conf" as follows:


In the case of selection the identification of the bootable partition by the identifier you can get the ID of our partition with the command: blkid.


In the case of the label it is a bit harder and this is done for different file systems in different ways.


For the file-systems EXT2/3 it is done by the utility e2label. For example: e2label /dev/sdb1 PLC


For the FAT file system it does by the set of utilities that come with mtools or with parted, easier. With mtools you can do it as follows:


Now we can initialize the loader:


That is all with the boot and initialization of firmware. If the resulting disk is not loaded:

Result

The result is the firmware with the size from 30Mb to 100Mb, satisfying all announced requirements and it provides:

OpenSCADA

As the PLC runtime system the OpenSCADA is used. For this case we'll take the building with separate packages for each module and indicate to install the virtual package openscada-plc, which contains all the dependencies on all the OpenSCADA packages, typical used for this configuration. The package of gd2 graphics library has been rebuilt without the support of xpm graphic file format and library was called libgd2-noxpm. All this was done in order to avoid the heavy dependencies on the libraries of GUI XOrg.


The result is the runtime of the PLC with support:


The configuration of OpenSCADA runs in demon mode in locale "en_US.UTF-8" (also available "ru_RU.UTF-8" and "uk_UA.UTF-8") using the local database SQLite, providing the following default network services:

The implementation details

In this section let examine the details of the OS tree of the firmware, the initialization script rc.sysinit.plc and the script of preparation of the OS tree of the firmware.


To build the PLC firmware it was used the following list of packages:


List of the modules of the loader's system kernel with the purpose to reducing the initialization image size was decreased to the following ones:


To the script of the tree preparation there were added the following functions:


The initialization script (rc.sysinit.plc) was provided with the following functions:


As the result of these actions the mount table of the resulting PLC tree looks like:

Setting of the GUI

One option of the firmware is built with a graphical interface, which, however, necessary to configure for automatic startup with the visualization area of OpenSCADA. In addition, it should be noted that the firmware with a graphical interface does not contain all the drivers and you may have to rebuild it under the right equipment.


After downloading and logging to the console it is necessary to configure the XServer, automatic graphical login, start of the graphical environment and automatic startup of OpenSCADA from the IceWM environment:

Packages base of ALTLinux T6

Next stage of the firmwares creation was moving to the package base of distributive ALTLinux T6. On the whole firmwares creation concept saved, with bits changes, but there were added some improvements and expansions:


During the possibility of a free additional installation of needs packages direct from the repository gone needs to the separated built of the firmware with GUI. That is you can easy install the desired window manager (WM) or desktop environment include needed drivers, than create a separated firmware with a limited list of the drivers.


The script "startup-plc" was turned spare into the new firmwares besides the "root" FS remounting to writing does early on the initial sage. The script "profiles/plñ/image-scripts.d/01system" renamed to "profiles/plñ/image-scripts.d/init1-PLC", but it changed and expanded. The packages list of the firmware was left into "profiles/pkg/lists/plñ.in" and some changed.


For get the some specific packages you have to connect the repository "ALTLinux T6" from the OpenSCADA project:

rpm ftp://ftp.oscada.org/ALTLinux/t6 openscada main

The firmware creation procedure mostly left unchanged:

# Creation of the configuration script "configure"
$ ./autoconf
# The builder configuration for the disk's images generation. The key "--with-imagetype" you can set to "iso", or pass
# for creation the combined ISO-image
$ ./configure --with-distro=kdesktop --with-branding=altlinux-kdesktop --with-version=6.0 --with-language=en_US --with-imagetype=flash
# The image assembling
$ make plc.cd


The output folder's content with the image and the firmware installing process to file system FAT and EXT2/3/4 different only by renaming the FS archive's file from "plc" to "live". Installing the ISO-image to USB-flash, HDD, SSD performs by the command dd:

$ dd if=LP8x81-ALTLinuxT6-OpenSCADA_0.8.0.6-i586-plc.iso of=/dev/sd{x} bs=4096

Instead the file "work" you should create partition EXT3 with the label "alt-live-storage", if it is not the ISO-image. The new partition creation you can do with the help of fdisk, if the FAT partition was not created to all allowed the storage space, or with help of parted where the FAT partition you allowed to change. To the details about a partition creation the reader will send to the documentation on fdisk or parted.


Configuration of files "syslinux/syslinux.cfg" and "extlinux/extlinux.conf" were not changed, besides the FS file archive's name changed from "plc" to "live".


At the result we get the firmware with size from which provides:


For the PLC firmware assembling used next packages list:


The Linux kernel modules list of the initial stage was some changed and include:


To the script of the tree preparation "profiles/plñ/image-scripts.d/init1-PLC" performs the functions:


The revision in progress


iROBO-3000a

iROBO-3000a is a fanless industrial computer with Intel Atom D425 1.8 GHz ñ VGA, 2xGb LAN, 4xCOM, 4xUSB, 1GB RAM, 1x2.5" SATA HDD 120GB, Mini-PCIe, 4x4 DIO, CF slot, SIM Card slot, Audio, WDT on board, operating temperature range -5..+55°Ñ. Performance of this computer is enough to run the functions of data acquisition, monitoring and control server, as well as the visualization station's functions. However, because of usage the non-productive Atom processor family, the implementation of mathematical models of processes will require almost all of the CPU resources. For example, during the performance of the AGLKS mathematical model, the CPU is loaded at 86%. The controller has been certified by "UKRSEPRO" that may be important for many users in the territory of Ukraine.



OpenSCADA operating environment for this computer was based on the packets base of the ALTLinux T6 distribution, as well as freshly-builded Trinity (TDE) desktop environment. Building of the environment was made using the above described conception with an updated profile of "mkimage". The "plc" objective has been added to the new profile, but its nature has changed in fact and has become a copy of the "live" target, which became possible thanks to the implementation in primary initialization stage the transparent mount of the partition with the "alt-live-storage" label as a reflection of a packed file system with random access to the modification. In general, it made possible to create the fixed core of the firmware with the basic set of software environment with the size of 300MB and with the possibility of free expansion by installing the necessary packages from the distribution.


The Trinity was selected as the desktop environment because of the presence of background artefacts problem in conjunction with XOrgServer 1.10 + QT4, as well as because of TDE low-resource with high maturity and stability.


Archive of the build profiles of the new environment is called mkimage-profiles-6-kdesktop-plc.tgz, and the latest build of the firmware ALTLinux6-OpenSCADA_0.7.2-i586-plcUI_TDE-generic.flash.tar.


 
There are no files on this page.[Display files/form]
There is no comment on this page. [Display comments/form]