Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

2.1 Generate and run an IOC application

Create a compiled Input/Output Controller (IOC) application with the ALS-U template generator. The application links installed support; you do not build EPICS Base or its modules.

  1. Activate your matching 1.5.0 environment from Chapter 1. In a development directory, download the generator once:

    git clone --depth 1 https://github.com/jeonghanlee/EPICS-IOC-template-tools.git tools
    

    Use an existing tools checkout if you already have it. Keep the generated applications outside the binary distribution.

  2. From the directory containing tools/, generate the application:

    bash tools/generate_ioc_structure.bash -l home -p mouse
    

    Enter y when asked to continue with the unlisted home location. -p names the application; -l names the location. The result is mouse/ with the boot instance iocBoot/iochome-mouse/. Keep the exact name mouse rather than substituting your own name so the directory paths and commands in Chapter 2 match as shown.

    Use ASCII letters, digits, and underscores in application, location, and folder names. The generator rejects + and -. Avoid ioc in names: the script reserves ioc, Ioc, and IOC. Keep application name capitalization identical when adding instances.

  3. Build the generated application:

    cd mouse
    make
    

    A successful build creates bin/linux-x86_64/mouse, its database definition (DBD), and generated envPaths in the boot directory.

  4. Keep the generated diagnostic files inside this application:

    mkdir -p epics-pvinfo/env epics-pvinfo/names
    export TARGET_TOP="$PWD"
    

    The startup writes below $(TARGET_TOP=/opt)/epics-pvinfo. Set TARGET_TOP again if you start from another terminal.

  5. Run the boot instance:

    cd iocBoot/iochome-mouse
    ./st.cmd
    

    Wait for iocRun: All initialization complete. At the IOC prompt, inspect the database and available commands:

    dbl
    help
    exit
    

    This initial application loads no records, so dbl has no PV names to print. Successful initialization does not imply device communication.

Generated directory reference

PathPurpose
configure/RELEASESelects installed Base and module paths
configure/CONFIG_SITEControls application build settings
mouseApp/src/MakefileSelects DBD files, source files, and linked libraries
mouseApp/Db/Holds database and protocol source files
mouseApp/iocsh/Holds reusable startup fragments
iocBoot/iochome-mouse/st.cmdConfigures and starts this IOC instance
iocBoot/iochome-mouse/envPathsGenerated paths for the startup

The source Makefile includes support conditionally. Enabling a module in RELEASE activates the corresponding DBD and library entries. Keep the generator’s module dependency comments when selecting support. Chapter 3 enables asyn, calc, and StreamDevice.

Exercise: Compare build targets

From the application root, compare the installed executable after each cleanup target:

make clean
ls bin/linux-x86_64
make
make distclean
ls bin/linux-x86_64
make

clean keeps installed products, so the first ls lists mouse. distclean removes them together with bin/, so the second ls reports No such file or directory. The final make rebuilds the application. Lesson 5.3 repeats this exercise with a separate installation path.