Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sequencer-2-2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
epics-modules
sequencer-2-2
Commits
89852e1b
Commit
89852e1b
authored
14 years ago
by
ben.franksen
Browse files
Options
Downloads
Patches
Plain Diff
docs: explain new seqMain.c feature
parent
96c0839e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
documentation/Compiling.txt
+36
-67
36 additions, 67 deletions
documentation/Compiling.txt
documentation/Introduction.txt
+3
-0
3 additions, 0 deletions
documentation/Introduction.txt
with
39 additions
and
67 deletions
documentation/Compiling.txt
+
36
−
67
View file @
89852e1b
...
@@ -36,8 +36,8 @@ Option Description
...
@@ -36,8 +36,8 @@ Option Description
+l Add line markers to the generated code, so that C compiler
+l Add line markers to the generated code, so that C compiler
messages refer to the SNL source file. This is the default.
messages refer to the SNL source file. This is the default.
-l Do not produce line markers.
-l Do not produce line markers.
+m
Generate a
main procedure for a stand-alone program.
+m
Include
main procedure
(seqMain.c)
for a stand-alone program.
-m Do not
generate a main procedure
. This is the default.
-m Do not
include seqMain.c
. This is the default.
+s :ref:`Safe mode`: variables are local to state set
+s :ref:`Safe mode`: variables are local to state set
and must be communicated explicitly. Implies +r.
and must be communicated explicitly. Implies +r.
-s Traditional (non-safe) mode. This is the default for
-s Traditional (non-safe) mode. This is the default for
...
@@ -50,8 +50,8 @@ Option Description
...
@@ -50,8 +50,8 @@ Option Description
====== ===============================================================
====== ===============================================================
Note that :option:`+a` and :option:`-a` are ignored for calls to
Note that :option:`+a` and :option:`-a` are ignored for calls to
:c:func:`pvGet` that explicitly specify ``SYNC`` or ``ASYNC`` in the
2nd
:c:func:`pvGet` that explicitly specify ``SYNC`` or ``ASYNC`` in the
argument.
2nd
argument.
Options may also be set from within the program (somewhere between the
Options may also be set from within the program (somewhere between the
program name/parameter and the state set definitions), see
program name/parameter and the state set definitions), see
...
@@ -79,8 +79,8 @@ knows (and cares) about C is the syntax. This means that many errors
...
@@ -79,8 +79,8 @@ knows (and cares) about C is the syntax. This means that many errors
will only be found only during the C compilation phase. The C compiler
will only be found only during the C compilation phase. The C compiler
will attributed these to the corresponding location in the SNL source
will attributed these to the corresponding location in the SNL source
file, since by default *snc* generates line markers in the output that
file, since by default *snc* generates line markers in the output that
point back to the original source. This can be turned off with the
:option:`-l`
point back to the original source. This can be turned off with the
("ell") compiler switch.
:option:`-l`
("ell") compiler switch.
Warnings
Warnings
^^^^^^^^
^^^^^^^^
...
@@ -101,11 +101,11 @@ C Pre-processor
...
@@ -101,11 +101,11 @@ C Pre-processor
---------------
---------------
Depending on the application, it might be useful to pre-process the SNL
Depending on the application, it might be useful to pre-process the SNL
source with a C pre-processor (*cpp*). Using the C pre-processor
source with a C pre-processor (*cpp*). Using the C pre-processor
allows
allows
you to include other SNL files, define macros, and perform
you to include other SNL files, define macros, and perform
conditional
conditional
compilation. *snc* supports this by interpreting
compilation. *snc* supports this by interpreting
*cpp*-generated line
*cpp*-generated line
markers, so that error and warning messages
markers, so that error and warning messages
refer to the line numbers
refer to the line numbers
in the un-pre-processed SNL source.
in the un-pre-processed SNL source.
Complete Build
Complete Build
--------------
--------------
...
@@ -163,60 +163,29 @@ executable), or create a library for an IOC.
...
@@ -163,60 +163,29 @@ executable), or create a library for an IOC.
.. todo:: explain what libraries to link and where to find them
.. todo:: explain what libraries to link and where to find them
Building a Stand-alone Program for Unix
.. _Building a Stand-alone Program:
---------------------------------------
Building a Stand-alone Program
Under Unix, either the :option:`+m` compiler option should be used to
------------------------------
create a C main program or else the programmer should write a main
program (the main program plays the same role as the VxWorks
The :option:`+m` compiler option can be used to create a stand-alone program,
startup script).
otherwise an iocshell is needed to start sequencer programs. Since version 2.1
the main procedure is no longer hard-coded. Instead, the code generator adds a
Here is a full build of a simple state program from source under
define and an include statement ::
Solaris. Compiler and loader options will vary with other operating
systems. It is assumed that the sequencer is in
#define PROG_NAME name_of_your_snl_program
*/usr/local/epics/seq* and that EPICS is in */usr/local/epics*. ::
#include "seqMain.c"
gcc -E -x c demo.st >demo.i
at the end of the generated C file, where ``name_of_your_snl_program`` is the
snc +m demo.i
name (identifier) whose address is to be passed to the ``seq`` function. This means you can provide your own version of main
simply by placing a file named ``seqMain.c`` in your source directory (the
gcc -D_POSIX_C_SOURCE=199506L -D_POSIX_THREADS -D_REENTRANT\
EPICS build system usually takes care that the source directory is at the front
-D__EXTENSIONS__ -DnoExceptionsFromCXX \
of the C compiler's include path).
-DOSITHREAD_USE_DEFAULT_STACK \
-I. -I.. \
A simple default ``seqMain.c`` is provided and installed into the sequencer's
-I/usr/local/epics/seq/include \
``include`` directory. Note that since version 2.1 the default main starts an
-I/usr/local/epics/base/include/os/solaris \
ioc shell; this can be disabled by providing a ``-S`` (capital 's') argument.
-I/usr/local/epics/base/include -c demo.c
The old ``-s`` switch is accepted for backward compatibility but does nothing.
g++ -o demo \
-L/usr/local/epics/seq/lib/solaris-sparc \
-L/usr/local/epics/base/lib/solaris-sparc \
demo.o -lseq -lpv -lpvCa -lca -lCom \
-lposix4 -lpthread -lthread -lsocket -lnsl -lm
The main program generated by the :option:`+m` compiler option is very
simple. Currently it looks like this::
int main(int argc,char *argv[]) {
char * macro_def;
int callIocsh = 0;
if(argc>1 && strcmp(argv[1],"-s")==0) {
callIocsh=1;
--argc; ++argv;
}
macro_def = (argc>1)?argv[1]:NULL;
seq(&StringArray, macro_def, 0);
if(callIocsh) {
seqRegisterSequencerCommands();
seqRegisterSequencerProgram (&StringArray);
iocsh(0);
} else {
epicsThreadExitMain();
}
return(0);
}
.. _UsingmakeBaseApp:
Using makeBaseApp
Using makeBaseApp
-----------------
-----------------
...
@@ -244,5 +213,5 @@ All that's left to do is add::
...
@@ -244,5 +213,5 @@ All that's left to do is add::
SNCSEQ=/path/to/your/seq/installation
SNCSEQ=/path/to/your/seq/installation
to ``configure/RELEASE`` (that is, the one in the ``configure``
directory
to ``configure/RELEASE`` (that is, the one in the ``configure``
that ``makeBaseApp.pl`` just created).
directory
that ``makeBaseApp.pl`` just created).
This diff is collapsed.
Click to expand it.
documentation/Introduction.txt
+
3
−
0
View file @
89852e1b
...
@@ -199,6 +199,9 @@ ad hoc way variable types were handled before. The new code is not *that*
...
@@ -199,6 +199,9 @@ ad hoc way variable types were handled before. The new code is not *that*
much more complicated and it is certainly easier to extend with new
much more complicated and it is certainly easier to extend with new
features.
features.
The main procedure (:option:`+m`) is no longer hard-coded, so you can easily
provide your own version. See :ref:`Building a Stand-alone Program`.
Lofts of minor fixes.
Lofts of minor fixes.
In the sequencer library interface, bitMask is now a synonym for unsigned,
In the sequencer library interface, bitMask is now a synonym for unsigned,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment