Skip to content

Commit

Permalink
Merge pull request #22 from epics-containers/template
Browse files Browse the repository at this point in the history
Add RTEMS support
  • Loading branch information
gilesknap authored Mar 5, 2024
2 parents 328aa26 + 4a065fc commit b480e3a
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 212 deletions.
8 changes: 8 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 3.2.0b3
_src_path: gh:epics-containers/ioc-template
description: Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers
git_platform: github.com
github_org: epics-containers
name: ioc-pmac
repo_uri: [email protected]:epics-containers/ioc-pmac.git
84 changes: 0 additions & 84 deletions .devcontainer/.bashrc

This file was deleted.

20 changes: 4 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dockerfile": "../Dockerfile",
"target": "developer",
"args": {
"TARGET_ARCHITECTURE": "linux"
"TARGET_ARCHITECTURE": "rtems"
}
},
"remoteEnv": {
Expand Down Expand Up @@ -39,11 +39,9 @@
]
}
},
// Make sure the files we are mapping into the container exist on the host
// You can place any other outside of the container before-launch commands here
// You can place any outside of the container before-launch commands here
"initializeCommand": "bash .devcontainer/initializeCommand ${devcontainerId}",
// Hooks the global .bashprofile_dev_container but also can add any other commands
// to run in the container at creation in here
// One time global setup commands inside the container
"postCreateCommand": "bash .devcontainer/postCreateCommand ${devcontainerId}",
"runArgs": [
// Allow the container to access the host X11 display and EPICS CA
Expand All @@ -58,16 +56,6 @@
// we also mount the project folder into a know location in the container
// this is where the ibek-support and ioc folders reside in the container build
// in this way the devcontainer and runtime look very similar
"source=${localWorkspaceFolder},target=/epics/generic-source,type=bind",
// this provides eternal bash history in and out of the container
"source=${localEnv:HOME}/.bash_eternal_history,target=/root/.bash_eternal_history,type=bind",
// this bashrc hooks up the .bashrc_dev_container in the following mount
"source=${localWorkspaceFolder}/.devcontainer/.bashrc,target=/root/.bashrc,type=bind",
// provides a place for you to put your shell customizations for all your dev containers
"source=${localEnv:HOME}/.bashrc_dev_container,target=/root/.bashrc_dev_container,type=bind",
// provides a place to install any packages you want to have across all your dev containers
"source=${localEnv:HOME}/.bashprofile_dev_container,target=/root/.bashprofile_dev_container,type=bind",
// provides the same command line editing experience as your host
"source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind"
"source=${localWorkspaceFolder},target=/epics/generic-source,type=bind"
]
}
13 changes: 2 additions & 11 deletions .devcontainer/initializeCommand
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/bin/bash

# make sure all the files we mount into the container exist
for i in \
.bash_eternal_history \
.bashrc_dev_container \
.bashprofile_dev_container \
.inputrc
do
if [ ! -f $HOME/$i ] ; then
touch $HOME/$i;
fi
done
# custom initialization goes here - runs outside of the dev container
# just before the container is launched but after the container is created

echo "devcontainerID ${1}"
27 changes: 15 additions & 12 deletions .devcontainer/postCreateCommand
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Custom initialization goes here if needed.
# Runs inside the dev container after the container is created

################################################################################
# When using docker we will not be root inside the container
# the following steps are then required
Expand All @@ -9,21 +12,21 @@ if [[ $USER != "root" ]] ; then
# make sure the non-root user can build iocs and (mounted in) support modules
sudo chown -R ${USER}:${USER} /epics/ibek-defs /epics/pvi-defs /epics/support/configure /venv
sudo chown -h ${USER}:${USER} /epics /epics/ioc /epics/support

# also give non-root user access to the same bash config we use in podman
sudo chmod a+rx /root
for f in .inputrc .bash_eternal_history .bashrc .bashrc_dev_container; do
sudo chmod a+rw /root/$f
ln -sf /root/$f $HOME/$f
done
fi

################################################################################
# Custom install script for each developer to add whatever they like to
# all epics-containers devcontainers
# Shell customizations for Generic IOC devcontainers
################################################################################

# add user's custom profile container creation script
if [ -f ~/.bashprofile_dev_container ]; then
. ~/.bashprofile_dev_container
# add ibek completion to bash and zsh
echo 'source <(ibek --show-completion bash)' >> $HOME/.bashrc
echo 'source <(ibek --show-completion zsh)' >> $HOME/.zshrc

# pick a theme that does not cause completion corruption in zsh
sed -i $HOME/.zshrc -e 's/ZSH_THEME="devcontainers"/ZSH_THEME="dst"/'

# allow personalization of all devcontainers in this subdirectory
# by placing a .devcontainer_rc file in the workspace root
if [[ -f /workspaces/.devcontainer_rc ]] ; then
source /workspaces/.devcontainer_rc
fi
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ jobs:
packages: write
strategy:
fail-fast: false
max-parallel: 1 # take advantage of caching
matrix:
target: [developer, runtime]
architecture: [linux]
architecture: [linux, rtems]
include:
- os: ubuntu-latest
platforms: linux/amd64
Expand Down Expand Up @@ -53,6 +52,8 @@ jobs:
load: true

- name: Test image
# can't test rtems without some hardware to run on
if: ${{ matrix.architecture != 'rtems' }}
run: tests/run-tests.sh

- name: Push image
Expand Down
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
##### build stage ##############################################################

ARG TARGET_ARCHITECTURE
ARG BASE=7.0.7ec3
ARG BASE=7.0.8ec1b3
ARG REGISTRY=ghcr.io/epics-containers

FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS developer

# The devcontainer mounts the project root to /epics/generic-source
# Using the same location here makes devcontainer/runtime differences transparent.
ENV SOURCE_FOLDER=/epics/generic-source
# connect ioc source folder its know location
# connect ioc source folder to its know location
RUN ln -s ${SOURCE_FOLDER}/ioc ${IOC}

# Get latest ibek while in development. Will come from epics-base when stable
Expand All @@ -21,17 +21,20 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support
# copy the global ibek files
COPY ibek-support/_global/ _global

COPY ibek-support/sequencer sequencer
RUN sequencer/install.sh R2-2-9

COPY ibek-support/iocStats/ iocStats
RUN iocStats/install.sh 3.1.16
RUN iocStats/install.sh 3.2.0

COPY ibek-support/asyn/ asyn/
RUN asyn/install.sh R4-42
RUN asyn/install.sh R4-44-2

COPY ibek-support/autosave/ autosave/
RUN autosave/install.sh R5-11

COPY ibek-support/busy/ busy/
RUN busy/install.sh R1-7-3
RUN busy/install.sh R1-7-4

COPY ibek-support/sscan/ sscan/
RUN sscan/install.sh R2-11-6
Expand All @@ -47,7 +50,7 @@ RUN pmac/install.sh 2-6-2b1

# get the ioc source and build it
COPY ioc ${SOURCE_FOLDER}/ioc
RUN cd ${IOC} && make
RUN cd ${IOC} && ./install.sh && make

##### runtime preparation stage ################################################

Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
An epics-containers generic IOC source file for Delta Tau pmac motion controllers.
# Generic IOC Template Repository ioc-pmac

Generates a Generic IOC for running in a container and
creating IOC instances to control pmac motion controllers.
## Description
Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers

See the https://epics-containers.github.io
## Template Info
This repository was generated by
[ioc-template](https://github.com/epics-containers/ioc-template)

To update to the latest version of the template:

```bash
# activate a python virtual environment

pip install copier
cd ioc-pmac
copier update -A --trust .
```
13 changes: 7 additions & 6 deletions build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

################################################################################
# generic local build script for epics-containers ioc repositories #
# generic local build script for epics-containers repositories #
################################################################################

# set TARGET_ARCHITECTURE to rtems for RTEMS based targets
Expand All @@ -11,17 +11,18 @@ TARGET=${TARGET:-developer}
# set TAG to override the default tag
TAG=${TAG:-ec_test}

# log commands and stop on erros
# log commands and stop on errors
set -xe

cd $(dirname ${0})

# use docker if available else use podman
if ! docker version &>/dev/null; then alias docker=podman; fi
if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi
if $docker buildx version &>/dev/null; then builx=buildx; load=--load; fi

# make sure new repos get their submodule ibek-support
git submodule update --init
if [ ! -d ibek-support ] ; then git submodule update --init ; fi

# build and developer images
docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A --target $TARGET .

$docker build $buildx -t ${TAG} --build-arg \
TARGET_ARCHITECTURE=$T_A $load --target $TARGET .
2 changes: 1 addition & 1 deletion ibek-support
Submodule ibek-support updated 41 files
+0 −122 ADCore-slim/ADCore.ibek.support.yaml
+0 −300 ADCore-slim/ADDriver.pvi.device.yaml
+0 −176 ADCore-slim/NDPluginDriver.pvi.device.yaml
+0 −4 ADCore-slim/NDPluginFile.pvi.device.yaml
+0 −14 ADCore-slim/NDPluginPva.pvi.device.yaml
+0 −273 ADCore-slim/asynNDArrayDriver.pvi.device.yaml
+0 −63 ADCore-slim/install.sh
+26 −11 ADCore/ADCore.ibek.support.yaml
+294 −297 ADCore/ADDriver.pvi.device.yaml
+60 −58 ADCore/NDPluginDriver.pvi.device.yaml
+2 −2 ADCore/NDPluginPva.pvi.device.yaml
+94 −88 ADCore/asynNDArrayDriver.pvi.device.yaml
+0 −3 ADSample/install.sh
+6 −3 ADSimDetector/ADSimDetector.ibek.support.yaml
+296 −293 ADSimDetector/simDetector.pvi.device.yaml
+0 −3 StreamDevice/install.sh
+1 −2 _global/README.md
+0 −19 _global/global.sh
+13 −0 _global/install.sh
+7 −8 asyn/install.sh
+2 −10 autosave/install.sh
+6 −0 busy/install.sh
+7 −4 calc/install.sh
+19 −2 iocStats/install.sh
+130 −0 iocStats/iocStats.patch
+0 −3 lakeshore340/install.sh
+345 −0 motor/asynMotorAxis.pvi.device.yaml
+7 −0 motor/asynMotorController.pvi.device.yaml
+5 −2 motor/install.sh
+9 −2 motor/motor.ibek.support.yaml
+0 −3 motorMotorSim/install.sh
+26 −13 pmac/install.sh
+19 −0 pmac/make_pvi.sh
+21 −32 pmac/pmac.ibek.support.yaml
+85 −0 pmac/pmacAxis.pvi.device.yaml
+54 −0 pmac/pmacCSController.pvi.device.yaml
+313 −0 pmac/pmacController.pvi.device.yaml
+444 −0 pmac/pmacTrajectory.pvi.device.yaml
+34 −0 quadEM/install.sh
+33 −0 sequencer/install.sh
+0 −3 sscan/install.sh
1 change: 0 additions & 1 deletion ioc/configure/CONFIG_SITE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CONFIG_SITE

CROSS_COMPILER_TARGET_ARCHS =
CHECK_RELEASE = NO

1 change: 1 addition & 0 deletions ioc/configure/CONFIG_SITE.Common.linux-x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 12 additions & 0 deletions ioc/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# global install script for support all support modules to reference

x86_cfg='./configure/CONFIG_SITE.Common.linux-x86_64'

# for RTEMS builds don't build for the host architecture, target only
if [[ $TARGET_ARCHITECTURE == "rtems" ]]; then
touch ${x86_cfg}
sed -i '/VALID_BUILDS/d' ${x86_cfg}
echo "VALID_BUILDS=Host" >> ${x86_cfg}
fi
4 changes: 2 additions & 2 deletions ioc/iocApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ioc_DBD += $(shell cat /epics/support/configure/dbd_list)

ioc_SRCS += ioc_registerRecordDeviceDriver.cpp

# add in the libs collected by ibek during container build
ioc_LIBS += $(shell cat /epics/support/configure/lib_list)
# add in the libs collected by ibek during container build (in reverse order)
ioc_LIBS += $(shell tac /epics/support/configure/lib_list)

ioc_LIBS += $(EPICS_BASE_IOC_LIBS)
ioc_SRCS += iocMain.cpp
Expand Down
Loading

0 comments on commit b480e3a

Please sign in to comment.