System Launch and Monitor (slm)

Use slm in the QNX Platform for ADAS to modify the launch sequence of applications and services without rebuilding the target image.

For more information about how to use SLM, see slm in the Utilities Reference.

SLM configuration files for QNX Platform for ADAS

QNX Platform for ADAS uses multiple SLM configuration files to manage, dependencies between processes, commands for launching processes, and other properties.

The following default files are included:

slm-config-all.xml
Configures services common to all hardware platforms.
slm-config-platform.xml
Platform-specific services, such as board-specific drivers.

A simple way to switch default SLM configuration files is to copy your custom slm configuration file (e.g.. my-slm-config.xml) to slm-config-platform.xml on your target. For example:

# mount -uw /base
# cp /base/etc/my-slm-config.xml /base/etc/slm-config-platform.xml

    

where my-slm-config.xml is the name of the slm configuration file that you want to use.

Example: SLM configuration to use file camera immediately

This example describes set up a SLM file using a file camera immediately after the target boots.

To use this configuration, you must ensure that you have a file camera specified in the sensor configuration file. For example:

...
begin SENSOR_UNIT_1
    type = file_camera
    address = /usr/share/videos/adas_example.mp4
    playback_group = 1
    name = front-camera
    direction = 0,0,0
    position = 0,0,800
end SENSOR_UNIT_1
...
        

For more information, see “Example: Sensor configuration for file camera” in the Sensor configuration file section of this guide.

To configure your SLM configuration file for a file camera, here's what you need to do:

  • Ensure that the resource arbitration is in running before starting the Sensor service.

    For example, the resarb component must start before the sensor component. The resarb component is used to permit arbitration of resources so that multiple processes can access the same resource. The sensor component requires this arbitration as a dependency when you're using file cameras.

    In general, the resarb component must be started, but it's not required as an explicit dependency for the sensor component for other sensors and cameras.

  • Ensure that the sensor service has a dependency on Screen.

    For example, start the sensor component with a dependency to wait until the screen_ready component comes up.

  • Start your file camera application.

For example, your SLM configuration should include components as follows:

<SLM:system xmlns:SLM="SLM">
...
 <SLM:component name="screen-ready">
   <SLM:command launch="builtin">no_op</SLM:command>
   <SLM:waitfor wait="pathname">>/dev/screen</SLM:waitfor>
 </SLM:component>
...
 <SLM:component name="resarb">
   <SLM:command>/base/bin/resarb</SLM:command>
   <SLM:stop stop="signal">SIGTERM</SLM:stop>
 </SLM:component>
...
 <SLM:component name="sensor">
  <SLM:command>/base/bin/sensor</SLM:command>
    <SLM:args>-U 521:521,1001 -r /accounts/1000/shared/camera -c /base/etc/system/config/adas_example_capture.conf</SLM:args>
    <SLM:depend>resarb</SLM:depend>
    <SLM:depend>screen-ready</SLM:depend>
 </SLM:component>
...
 <SLM:component name="adas_example">
   <SLM:command>/base/usr/bin/adas_example</SLM:command>
   <SLM:args>-pointcloud</SLM:args>
   <SLM:depend>sensor</SLM:depend>
   <SLM:stop stop="signal">SIGTERM</SLM:stop>
  </SLM:component>
...
</SLM:system>
        

If your application uses other sensors, in addition to a file camera, more components and dependencies than what's shown here may be required in the SLM configuration file.

Example: SLM configuration for USB cameras to boot immediately

This example describes how to set up an SLM file using a USB camera immediately after the target boots.

For this configuration, you must ensure that you have a USB camera configured in the sensor configuration file. For example:

begin SENSOR_UNIT_1
    type = usb_camera
    usb_driver_path = /dev/usb/io-usb-otg
    name = front-camera
    position = 0, 0, 0
    direction = 0, 0, 1
    orientation = 0
    address = -1, -1, -1, -1
end SENSOR_UNIT_1
        

For more information, see “Example: Sensor configuration file for USB camera” in the Sensor configuration file section of this guide.

To configure your SLM configuration file to start using a USB camera, here's what you need to do:
  • If not already part of your IFS image, start the USB driver before you start the Sensor service.

    For a USB camera to start immediately after the board boots, the USB driver must start before the Sensor service. If the USB driver isn't already part of your IFS image, you need to start the USB driver in your SLM configuration and have the Sensor service depend on it. For example, you would specify that the sensor component depends on the usb component.

    If you aren't using a USB camera, then there's no need for you to set up a dependency on the usb component in your SLM configuration file.

  • Ensure that the sensor service has a dependency on Screen.

    For example, start the sensor component with a dependency to wait until the screen_ready component comes up.

  • Start your camera application.

For example, your SLM configuration should include components as follows:

<SLM:system xmlns:SLM="SLM">
...
    <SLM:component name="screen-ready">
        <SLM:command launch="builtin">no_op</SLM:command>
        <SLM:waitfor wait="pathname">>/dev/screen</SLM:waitfor>
    </SLM:component>
...
    <!-- Include a usb component to start the USB driver using SLM
         if the USB driver isn't already part of your IFS image.
    -->
    <SLM:component name="usb">
        <SLM:command>io-usb-otg</SLM:command>
        <SLM:args>-n /dev/usb/io-usb-otg -d hcd-xhci</SLM:args>
    </SLM:component>
...
    <SLM:component name="resarb">
        <SLM:command>/base/bin/resarb</SLM:command>
        <SLM:stop stop="signal">SIGTERM</SLM:stop>
    </SLM:component>
...
    <SLM:component name="sensor">
        <SLM:command>/base/bin/sensor</SLM:command>
        <SLM:args>-U 521:521,1001 -r /accounts/1000/shared/camera -c /base/etc/system/config/usb_camera.conf</SLM:args>
        <!-- Add a dependency on the usb component if you are starting the USB driver through SLM. -->
        <SLM:depend>usb</SLM:depend>
        <SLM:depend>screen-ready</SLM:depend>
    </SLM:component>
...
    <SLM:component name="adas_example">
        <SLM:command>/base/usr/bin/adas_example</SLM:command>
        <SLM:args>-pointcloud</SLM:args>
        <SLM:depend>sensor</SLM:depend>
        <SLM:stop stop="signal">SIGTERM</SLM:stop>
    </SLM:component>
...
</SLM:system>
        

If your application uses other sensors, in addition to a file camera, more components and dependencies than what's shown here may be required in the SLM configuration file.