@@ -9,12 +9,18 @@ now will look at the differences for this architecture. Further
9
9
architectures will be supported in future.
10
10
11
11
Each beamline or accelerator domain will require a server for
12
- serving the IOC binaries and instance files. For details of how to set this
13
- up see `rtems_setup `.
12
+ serving the IOC binaries and instance files to the RTEMS devices. This
13
+ needs to be set up for your test beamline before proceeding,
14
+ see `rtems_setup `.
14
15
15
16
Once you have the file server set up, deploying an IOC instance that uses
16
17
an RTEMS Generic IOC is very similar to `deploy_example `.
17
18
19
+ We will be adding
20
+ a new IOC instance to the ``bl01t `` beamline that we created in the previous
21
+ tutorials. You will need to have worked through the previous tutorials in
22
+ order to complete this one.
23
+
18
24
Preparing the RTEMS Boot loader
19
25
-------------------------------
20
26
@@ -33,6 +39,8 @@ using a terminal server or similar.
33
39
:console: ts0001 7007
34
40
:crate monitor: ts0001 7008
35
41
42
+ It is likely already set up as per the example below.
43
+
36
44
Use telnet to connect to the console of your target IOC. e.g.
37
45
``telnet ts0001 7007 ``. We want to get to the MOTLoad prompt which should look
38
46
like ``MVME5500> ``. If you see an IOC Shell prompt instead hit ``Ctrl-D `` to
@@ -81,14 +89,126 @@ Meaning of the parameters:
81
89
Note that the IP parameters to the tftpGet command are respectively:
82
90
net mask, gateway, server address, client address.
83
91
84
- Once you have the correct configuration you can restart the IOC with
85
- the ``reset `` command. But you need the kubernetes pod for this IOC to be
86
- up and running first so that it places the necessary files on the file server.
87
- See the next section for setting up the kubernetes pod.
88
92
93
+ Creating an RTEMS IOC Instance
94
+ ------------------------------
95
+
96
+ We will be adding a new IOC instance to the ``bl01t `` beamline that we created in
97
+ :doc: `create_beamline `. The first step is to make a copy of our existing IOC instance
98
+ and make some modifications to it. We will call this new IOC instance
99
+ ``bl01t-ea-ioc-02 ``.
100
+
101
+ .. code-block :: bash
102
+
103
+ cd bl01t
104
+ cp -r iocs/bl01t-ea-ioc-01 iocs/bl01t-ea-ioc-02
105
+ # don't need this file for the new IOC
106
+ rm iocs/bl01t-ea-ioc-02/config/extra.db
107
+
108
+ We are going to make a very basic IOC with some hand coded database with
109
+ a couple of simple records. Therefore the generic IOC that we use can just
110
+ be ioc-template.
111
+
112
+ Generic IOCs have multiple targets, they always have a
113
+ ``developer `` target which is used for building and debugging the generic IOC and
114
+ a ``runtime `` target which is lightweight and usually used when running the IOC
115
+ in the cluster. The matrix of targets also includes an architecture dimension,
116
+ at present the ioc-template supports two architectures, ``linux `` and
117
+ ``rtems ``, thus there are 4 targets in total as follows:
118
+
119
+ - ghcr.io/epics-containers/ioc-template-linux-runtime
120
+ - ghcr.io/epics-containers/ioc-template-linux-developer
121
+ - ghcr.io/epics-containers/ioc-template-rtems-runtime
122
+ - ghcr.io/epics-containers/ioc-template-rtems-developer
123
+
124
+ We want to run the RTEMS runtime target on the cluster so this will appear
125
+ at the top of the ``values.yaml `` file. In addition there are a number of
126
+ environment variables required for the RTEMS target that we also specify in
127
+ ``values.yaml ``.
128
+ Edit the file
129
+ ``iocs/bl01t-ea-ioc-02/values.yaml `` to look like this:
130
+
131
+ .. code-block :: yaml
132
+
133
+ If you are not at DLS you will need to change the above to match the
134
+ parameters of your RTEMS IOC. The environment variables are:
135
+
136
+ :K8S_IOC_ADDRESS: The IP address of the IOC (mot-/dev/enet0-cipa above)
137
+ :RTEMS_VME_CONSOLE_ADDR: Address of terminal server for console access
138
+ :RTEMS_VME_CONSOLE_PORT: Port of terminal server for console access
139
+ :RTEMS_VME_AUTO_REBOOT: true to reboot the hard IOC when the IOC container changes
140
+ :RTEMS_VME_AUTO_PAUSE: true to pause/unpause when the IOC container stops/starts
141
+
142
+ Edit the file ``iocs/bl01t-ea-ioc-02/Chart.yaml `` and change the 1st 4 lines
143
+ to represent this new IOC (the rest of the file is boilerplate):
144
+
145
+ .. code-block :: yaml
146
+
147
+ apiVersion : v2
148
+ name : bl01t-ea-ioc-02
149
+ description : |
150
+ example RTEMS IOC for bl01t
151
+
152
+ For configuration we will create a simple database with a few of records and
153
+ a basic startup script. Add the following files to the
154
+ ``iocs/bl01t-ea-ioc-02/config `` directory.
155
+
156
+ .. code-block :: :caption: bl01t-ea-ioc-02.db
157
+
158
+ record(calc, "bl01t-ea-ioc-02:SUM") {
159
+ field(DESC, "Sum A and B")
160
+ field(CALC, "A+B")
161
+ field(SCAN, ".1 second")
162
+ field(INPA, "bl01t-ea-ioc-02:A")
163
+ field(INPB, "bl01t-ea-ioc-02:B")
164
+ }
165
+
166
+ record(ao, "bl01t-ea-ioc-02:A") {
167
+ field(DESC, "A voltage")
168
+ field(EGU, "Volts")
169
+ field(VAL, "0.0")
170
+ }
171
+
172
+ record(ao, "bl01t-ea-ioc-02:B") {
173
+ field(DESC, "B voltage")
174
+ field(EGU, "Volts")
175
+ field(VAL, "0.0")
176
+ }
177
+
178
+ .. code-block :: :caption: st.cmd
179
+
180
+ # RTEMS Test IOC bl01t-ea-ioc-02
181
+
182
+ dbLoadDatabase "/iocs/bl01t/bl01t-ea-ioc-02/dbd/ioc.dbd"
183
+ ioc_registerRecordDeviceDriver(pdbbase)
184
+
185
+ # db files from the support modules are all held in this folder
186
+ epicsEnvSet(EPICS_DB_INCLUDE_PATH, "/iocs/bl01t/bl01t-ea-ioc-02/support/db")
187
+
188
+ # load our hand crafted database
189
+ dbLoadRecords("/iocs/bl01t/bl01t-ea-ioc-02/config/bl01t-ea-ioc-02.db")
190
+ # also make Database records for DEVIOCSTATS
191
+ dbLoadRecords(iocAdminSoft.db, "IOC=bl01t-ea-ioc-02")
192
+ dbLoadRecords(iocAdminScanMon.db, "IOC=bl01t-ea-ioc-02")
193
+
194
+ iocInit
195
+
196
+ You now have a new helm chart in iocs/bl01t-ea-ioc-02 that describes an IOC
197
+ instance for your RTEMS device. Recall that this is not literally where the IOC
198
+ runs, it deploys a kubernetes pod that manages the RTEMS IOC. It does contain
199
+ the IOC's configuration and the IOC's binary code, which it will copy to the
200
+ file-server on startup.
201
+
202
+ You are now ready to deploy the IOC instance to the cluster and test it out.
89
203
90
- Creating an RTEMS Generic IOC
91
- -----------------------------
92
204
93
205
Deploying an RTEMS IOC Instance
94
- -------------------------------
206
+ -------------------------------
207
+
208
+ TODO:
209
+
210
+ Once you have the correct configuration in your RTEMS boot-loader and you have
211
+ deployed the kubernetes IOC instance, you can restart the IOC with
212
+ the ``reset `` command. This will cause it to reboot and it should pick
213
+ up your binary from the network and start the IOC. You should see the
214
+ iocShell fire up and run
0 commit comments