Update docs/2._Services_Portfolio/Services/01_epicscore.md #19

Open
zimoch wants to merge 13 commits from zimoch/Controls-docs:master into master
pull from: zimoch/Controls-docs:master
@@ -7,9 +7,166 @@ tags:
- HIPA
---
# EPICS Environment and support modules
# EPICS Environment
## EPICS base
Controls provides the [EPICS](https://epics-controls.org/) control system to operate the PSI acceleator facilities.
We make sure that EPICS is installed on the hosts maintained by Controls.
Our version [on gitea](https://gitea.psi.ch/epics/epics-base) includes fixes and additions compared to the community version
in order to supports all host and target (IOC) architectures used in the accelerator control systems.
*There is no need to build your own EPICS base version and, for compatibility reasons, this is also strongly discouraged and unsupported.*
### Install location
On RHEL hosts, EPICS is installed locally in `/usr/local/epics/base-*`.
Multiple releases of EPICS base may be installed at the same time.
Our target (IOC) systems mount EPICS from NFS at the same location.
### Environment variables
* `EPICS_HOST_ARCH` — The EPICS architecture name matching the host.
* `EPICS_BASE` — The location of the **latest** installed EPICS release.
* `PATH` — The location of the EPICS base host utilities of the latest installed EPICS release will be appended.
### Life cycle
As new EPICS releases are published by the community, they will be built and installed on Controls maintained hosts.
Old releases will eventually be discontinued and removed. Removal will be announced in advance.
There are always about 3 to 5 releases available.
If building EPICS applications, be prepared to migrate to the latest EPICS release about every 2 years.
* Currently supported: 7.0.8, 7.0.9, 7.0.10
* Upcoming: 7.0.11
All older releases are no longer supported.
#### Updating related software
IOC software installed as modules will be rebuilt for each new EPICS version, provided it is
available in one of the standard git repositories [epics_driver_modules](https://gitea.psi.ch/epics_driver_modules)
or [epics_ioc_modules](https://gitea.psi.ch/epics_ioc_modules) with a proper version tag.
All host EPICS application that build as RPMs in [ctrl_packages](https://gitea.psi.ch/ctrl_packages)
will be rebuilt regularly using the most recent EPICS release.
Best have your applications in an RPM with an explicit dependency on the use EPICS release.
*Software not installed as RPM at not obvious locations (other than `/<facility>/*/bin`) may have dependencies on
EPICS unknown to Controls and may break when an obsolete EPICS version is removed.
Such software installations are not supported by Controls and must be rebuilt regularly by their maintainer.*
### Support levels
Each EPICS installation is split into several support levels, each represented by an installed RPM package.
Most hosts will only have the "basic" package installed, which supports running EPICS client applications but not building EPICS software.
On dedicated development hosts, currently following the naming pattern `<facility>-lc*`, additional EPICS development packages are installed.
Building EPICS applications and EPICS IOC software (e.g. drivers) is only supported on such hosts.
#### Available RPMs for each release
* `epics-base-<release>` &mdash; The "basic" support for running EPICS applications, includes host IOC and utilities.
* `epics-base-<release>-compat` &mdash; Support for running applications built for older OS versions (e.g. RHEL8 applications on RHEL9).
* `epics-base-<release>-wine` &mdash; Support for running EPICS applications built for Windows on Linux.
* `epics-base-<release>-host-devel` &mdash; The build environment for host applications.
* `epics-base-<release>-devel` &mdash; The build environment for EPICS IOC software, such as drivers.
* `epics-base-<release>-devel-static` &mdash; Static libraries for all target architectures. Huge and rarely needed.
* `epics-base-<release>-boot` &mdash; Runtime components for IOC target architectures other than RHEL, only needed on NFS servers for booting IOCs.
* `epics-base-<release>-doc` &mdash; EPICS base documentation.
* `epics-base-<release>-src` &mdash; The source code, sometimes useful for debugging.
### Installing EPICS RPMs on unsupported hosts
*Be aware that installing EPICS on your own host has no support by Controls at all.
Such installations may break any time and will not be tested, debugged or fixed.*
With access to one of the Controls RPM repositories at
`https://repos.psi.ch/rhel*/latest/{sls,swissfel,hipa,proscan}`,
you can install any of the `epics-base-*` RPMs on your host.
The different EPICS releases can be installed in parallel.
Some RPMs depend on more basic ones and potentially on external packages and will automatically install those.
Of course, you need sufficient sudo priviledges on your hostto do so.
We do not provide EPICS installation for hosts operating systems other than x64 RHEL8, 9, and 10.
## EPICS IOCs
EPICS IOCs are the distributed components of the control system running inside the firewalled facility networks
and controlling the accelerator hardware.
### Development hosts
IOC software is developed on one of our developmen hosts `<facility>-lc*`.
Those hosts have the necessary development packages installed and are the only hosts with write access to the directores IOCs boot from.
The hosts are different for each facility.
### Install location
IOC software is installed to `/ioc`, a location on NFS which resolves to different file systems for different facilities.
The directory `/ioc/modules` contains loadable software modules for IOCs, each in its own subdirectory.
In those is one directory for each version of the module and below that one directory for each
EPICS base release this module has been built for:
```
/ioc/modules/<modulename>/<version>/<EPICS-release>
```
Installation of those modules is exclusively done with
[driver.makefile](https://gitea.psi.ch/epics_driver_modules/require#readme).
**Do not manipulate installed modules manually!**
### IOC repositories
* EPICS drivers https://gitea.psi.ch/epics_driver_modules
* Other generic EPICS modules: https://gitea.psi.ch/epics_ioc_modules
* IOCs configurations (per facility)
* https://gitea.psi.ch/epics_iocboot_sls
* https://gitea.psi.ch/epics_iocboot_sf
* https://gitea.psi.ch/epics_iocboot_hipa
* https://gitea.psi.ch/epics_iocboot_proscan
* https://gitea.psi.ch/epics_iocboot_cryo
* https://gitea.psi.ch/epics_iocboot_twlha
### Supported IOC architectures
* RHEL8, 9, or 10 virtual IOC servers
* Windows servers (using VC or mingw)
* VxWorks 6.9 on MVME 23xx or MVME 51xx VME boards
* Yocto 4.0 on Zynq Ultrascale+ (e.g. compactPCI-Serial boards)
* ELDK 5.2 on IFC1210 VME boards
* ELDK 4.2 or 5.3 on DeltaTau motor controllers
* ELDK 5.1 on Virtex Controller (e.g. GigaFRoST)
* Debian 12 on ECMC motor controllers
* Embedded Linux on Moxa Serial Servers
* (Debian 10)
* (Raspbian on Raspberry PI)
### Life cycle
Each module can have multiple versions installed. The versions are generated from git tags.
The IOCs can either load a specific version or simply the latest one.
When a new EPICS base version is deployed or a new host (or rarely: target) architecture (e.g. RHEL10)
needs to be supported, all modules need to be rebuilt for each facility.
This is currently a manual process and is typically only done for the latest version.
When an obsolete EPICS base release is removed and no IOC uses it any longer, the
module installations for that release will be removed.
Maintainers can remove obsolete module versions at any time, simply by removing the
installation directory. Be careful.
### Running IOCs on Linux
The bash wrapper script `iocsh` is used to start IOCs, either on installed servers or embedded Linux systems or,
mainly for debugging, on the command line.
It is typically called with the name of a startup script to run.
For more options, see `iocsh --help`.
epics base
epics modules
epics provisioning
epics iocs ...