Linux itself is not real-time capable, so it is recommended to use it with the additional PREEMPT_RT patch.
The power management can disrupt cyclical processing, it is advisable to disable the CPUIDLE sub-system and CPUFREQ sub-system. The sub-systems can be disabled by changing the kernel command line parameters in the boot loader. On x86, x86_64 systems this is usually grub, on embedded devices with ARM, ARM64 is usually u-boot. It is also possible to build a custom kernel without these sub-systems.
Running a EC-Simulator application on a dedicated CPU core that is isolated from the Linux scheduler (ISOLCPUS) can provide additional stability.
- Check if CPUFREQ sub-system is enabled:
cpuidle appears in the list, it is enabled.
- Disable CPUIDLE via the Kernel command-line in grub:
linux /boot/vmlinuz-4.19.0-16-rt-amd64 cpuidle.off=1
- Check if CPUFREQ sub-system is enabled:
cpufreq appears in the list, it is enabled.
- Disable CPUFREQ sub-system via the Kernel command-line grub:
linux /boot/vmlinuz-4.19.0-16-rt-amd64 cpufreq.off=1
If CPUFREQ is not to be deactivated, the governor should be set to
- The currently active governor can be determined as follows:
- The available governors with:
- To change governor use:
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
- Isolate CPU core number 4 of a quad-core processor via the Kernel command-line grub:
linux /boot/vmlinuz-4.19.0-16-rt-amd64 isolcpus=3
- Running EcSimulatorHilDemo on the isolated CPU core by setting the CPU affinity
./EcSimulatorHilDemo -a 3
To use Optimized Link Layers under Linux, the atemsys Kernel module must be compiled and loaded. Atemsys grants direct access to hardware to improving the performance.
All necessary scripts, source code and a detailed description of the installation can be found on https://github.com/acontis/atemsys. A ready-to-use Yocto recipe is also available on https://github.com/acontis/meta-acontis
Atemsys can also be used as a device tree driver to avoid certain conflicts between the link layer and the Linux kernel, e.g. power management, shared MDIO bus, etc..
A detailed guide on how to customize the device tree accordingly can also be found on https://github.com/acontis/atemsys. Example device tree modifications for different link layers/SoC can be found in https://github.com/acontis/atemsys/wiki.
This is the preferred solution on all embedded devices with device tree support.
It is possible to operate EC-Simulator within a Docker container with realtime priority. The atemsys kernel module should be installed on the host in order to operate the container with the lowest possible capabilities and privileges.
The following additional settings, permissions for
docker run are required:
- Add atemsys device to container
- Allow max realtime priority
- Add capability to set priority an lock memory
- Publish RAS server port 6000
- Unbind Link Layer instance, e.g.
echo 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind
- Load atemsys kernel module
Copy files from EC-Simulator package
eni.xmlto directory e.g.
- Adjust LD_LIBRARY_PATH search locations for Optimized Link Layers if necessary, e.g.
- Run EcSimulatorHilDemo
cd /tmp ./EcSimulatorHilDemo -f eni.xml -i8254x 1 1 -perf
Unbind Link Layer instance and load atemsys on the host.
Create a directory on the host (e.g.
~/docker) and copy files from EC-Simulator package
eni.xmlinto this directory.
- Start bash console in container
sudo docker run -it \ --name atem_container \ --device=/dev/atemsys:/dev/atemsys \ --ulimit rtprio=99 \ --cap-add=sys_nice --cap-add=ipc_lock \ -v ~/docker:/home/docker \ -p 6000:6000 \ ubuntu bash
Command line arguments:
-itAllocate a pseudo-TTY and run container
--name atem_containerContainer name
--device=/dev/atemsys:/dev/atemsysAdd atemsys device to container
--ulimit rtprio=99Allow max realtime priority
--cap-add=sys_niceAdd Linux capability to set priority
--cap-add=ipc_lockAdd Linux capability to lock memory
-v ~/docker:/home/dockerMount previously create directory to container
-p 6000:6000Publish RAS server port 6000
ubuntu bashUse Docker image ubuntu and start bash
- Run EcSimulatorHilDemo in container
cd /home/docker export LD_LIBRARY_PATH=. ./EcSimulatorHilDemo -f eni.xml -i8254x 2 1 -perf
The following settings are necessary to build the example application for Linux
- Possible ARCHs (see ATECAT_ARCHSTR in
x64 (aka amd64)
x86 (aka i686)
- armv4t-eabi and armv6-vfp-eabihf are incompatible with each other. A potentially armv6-vfp-eabihf compatible system returns success on
readelf -A /proc/self/exe | grep Tag_ABI_VFP_args
- Extra include paths
- Extra source paths
- Extra library paths to the main EtherCAT components
- Extra libraries (in this order)
AtesRasSrv EcSimulator pthread dl rt