Skip to content

config.xml - improve usage so doesn't conflict with st.cmd [TIMEBOX: 4.5 days] #8445

Closed

Description

@FreddieAkeroyd

As a developer I would like the information in the iocBoot config.xml to reflect what really happens in the ioc. Currently the information in config.xml is used by the GUI to define macros, it also has entries like hasDefault="YES" and default="0x0" but these are for information only in the GUI and do not influence, or necessarily correctly reflect, what the IOC actually does. We should have a single source of truth consistent between the IOC and GUI

Acceptance Criteria

  • Discussion held (virtually or as meeting) to decide on appropriate solution and agreed approach documented
  • Develop approach to enable default IOC macro values specified in only one place and correctly reflected by IOC and GUI display on new IOCs (as agreed in discussion)
  • Start applying this to existing IOCs
  • Create tickets to continue this work

Extra Information

An initial discussion of approach will be needed. There are various potential options e.g.

  • use existing config.xml as source of truth and add a new IOC command that reads file on IOC startup and creates macros. We already do something similar with configurations - IOC reads XML from disk and creates macros, so necessary XML reading code and an example of how to define a macro from an XML file already exists in IOC.
  • use existing config.xml as source of truth but at build time this file is parsed by a stand-alone program (e.g. a python script) that generates a default-macros.cmd file with necessary epicsEnvSet commands, this file can then be loaded by the IOC. This will need a new common Makefile build rule adding to automatically rebuild the macros file, but this is reasonable straightforward

(You could also create a new source of truth file and use it to generate config.xml and an IOC loadable file, but as config.xml is in a readily readable format that is not really worth it)

Note that you will not need to edit every IOC to either load default-macros.cmd or run a new command, all iocs already run init.cmd from the iocstartup common directory, so the command can be added to central init.cmd to apply to all IOCs

How to Test

should be a matter of just editing a config.xml for a chosen IOC and then looking at the screen output of the IOC to check macros defined as expected

Time in planning meeting (18/07/24)

1:34:35

planning 31:21 2024/10/31

Activity

  1. changed the title [-]config.xml - improve usage so doesn't conflict with st.cmd[/-] [+]config.xml - improve usage so doesn't conflict with st.cmd [TIMEBOX: 4.5 days][/+] on Jul 18, 2024
  2. moved this to Backlog in PI_2024_02on Jul 18, 2024
  3. rerpha commented on Jul 20, 2024

    @rerpha
    Contributor

    Can we use a common lua script for this to do the epicsEnvSets at ioc startup?

    from a quick play around lua's XML support is not very good (actually it's nonexistent), but it is doable with a library.... we'd probably need to use an external one by doing this: https://epics-modules.github.io/lua/libraries/adding-libraries.html using a lib like https://github.com/manoelcampos/xml2lua

    alternatively we could open the file and just use https://www.lua.org/pil/20.1.html to find lines starting with "<macro" and/or "<xi:include" which are the nested XML files in COMMON (which would then need to be opened) as we only care about the name and defaultValue attrs.

    i don't like the idea of doing it at build time as much as it makes identifying patches more difficult because the config.xmls generated at build time are presumably not going to be pushed upstream

  4. moved this to Backlog in PI_2024_08on Aug 2, 2024
  5. 50 remaining items

  6. Tom-Willemsen commented on Feb 18, 2026

    @Tom-Willemsen
    Member

    As mentioned in-person:

    ​[2026-02-18 13:52:04.174299] MAJOR: Could not load last configuration. Message was: Element '{http://epics.isis.rl.ac.uk/schema/iocs/1.0}macro', attribute 'useDefault': The attribute 'useDefault' is not allowed., line 5
    

    I suspect https://github.com/ISISComputingGroup/server_common/blob/main/src/server_common/schema/iocs.xsd needs to be updated

    We may also need an upgrade step to migrate existing configs - unless it handles that element not existing?

  7. moved this from Review to In Progress in PI_2026_01on Feb 18, 2026
  8. moved this from In Progress to Review in PI_2026_01on Apr 1, 2026
  9. moved this from Review to Done in PI_2026_01on Apr 7, 2026
  10. closed this as completedby moving to Done in PI_2026_01on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions