X2C | FAQ

Didn’t find the answer to your question? Please check the documentation included in the download package or contact us.
Is X2C® freeware?
To some extent, X2C is open source, distributed under the BSD 3‑Clause License. See the available editions for a detailed overview.
How can I get access to the advanced features?
Please see the different available versions in the editions section and feel free to contact us for licensing questions.
Do I need Matlab® to run X2C®?
No. The free version of X2C runs with Scilab. If you want to use X2C with Matlab®, you need to get a X2C Professional license.
Where do I get Scilab / Xcos?
You can download Scilab here.
Does X2C® work with Linux?

Yes, since nightly build v639, X2C code generation works under Linux. However, some things have to be considered:

  • Prior to executing X2C setup, the environment variable has to be set manually.
    This can be done by adding the line
    export X2C_Root=/home/<user>/X2C

    in

    /home/<user>/.profile
  • Pre-compiled libraries for simulation in Xcos are not available.
  • Some USB-to-serial converters are not recognized automatically by X2C Communicator. To work properly, the name has to be either /dev/ttySx or /dev/ttyUSBx.
    The following example shows how to get the Microstick Plus demo board recognized:
    ls -l /dev/ttyACM0

    gives the ouput

    crw-rw---- 1 root dialout 166, 0 Feb 11 08:56 /dev/ttyACM0

    With this information, a new device can be created:

    sudo mknod /dev/ttyUSB0 c 166 0
    sudo chown root:dialout /dev/ttyUSB0
    sudo chmod 660 /dev/ttyUSB0

    This device will be recognized by the Communicator.

  • The Communicator can only be started within Scilab/Xcos. Starting Communicator.jar as standalone application will not work.
So where do I set up my control scheme?
The control scheme is set up in Scilab’s Xcos by dragging the control blocks into the current diagram.
How do I get the code from my control scheme?
You can create the compilation ready C-code representing your control scheme by clicking the create code button in the Communicator GUI.
Does X2C® work with Scilab 6.x?

Yes. Since X2C v6.4 Scilab version 6.1.1 is supported.

How can I connect to my target?
The easiest and fastest way is to use the Communicator GUI. It provides a convenient way to set the communication parameters and connect to the target.
I can't connect to the target with the X2C Communicator, what's the problem?
To get a connection with the Communicator, an X2C application has to be running on the target. So the target has to be programmed prior to any connection attempts. Also interface and port in the “Setup”-tab have to be selected according to the setup of the target.
How can I download the compiled code to my target?
The new application has to be downloaded using the built-in programming feature of the target’s IDE. With X2C Professional and its bootloader support, a new application can be downloaded via the Communicator GUI.
Does X2C® support the target XYZ?
Please check the list of supported targets. If your device is not among the listed targets but is a member of either the C28xx, ARMv6, ARMv7, dsPIC, or PIC32 series, you can use a generic processor type.
How can I simulate my model in Linux?
Unfortunately, simulation out of the box does not work in Linux yet. However, simulation is possible, if these steps are followed:

  1. Install gcc
  2. Download and install the latest X2C nightly build
  3. Re-create the libraries in Scilab:

    – createLibrary(“General”)

    – createLibrary(“Math”)

    – createLibrary(“Control”)

  4. Compile the libraries in Scilab:

    – compileLibs()

  5. Execute loadLibs() after every start of Scilab or execute initProject.sce prior opening an X2C Xcos model
Is a Java Runtime Environment (JRE) required to run X2C®?

A JRE only is required if X2C is intended to be used in Standalone mode, e.g. using the Communicator outside Scilab or Matlab or using the Block Generator.
Above use case requires a JRE installation and – dependend of the underlying operating system and used JRE type – additional steps during the JRE setup.
If X2C is used in Scilab or Matlab environment only, no dedicated JRE is required.

X2C has been tested to work with

The latter uses OpenJDK sources and is free for use.
If ojdkbuild is to be used on a Microsoft Windows platform, additional steps may be necessary during installation. For more information please have a look at the X2C documentation.

Is X2C® freeware?
To some extent, X2C is open source, distributed under the BSD 3‑Clause License. See the available editions for a detailed overview.
How can I get access to the advanced features?
Please see the different available versions in the editions section and feel free to contact us for licensing questions.
Do I need Matlab® to run X2C®?
No. The free version of X2C runs with Scilab. If you want to use X2C with Matlab®, you need to get a X2C Professional license.
Where do I get Scilab / Xcos?
You can download Scilab here.
Does X2C® work with Linux?

Yes, since nightly build v639, X2C code generation works under Linux. However, some things have to be considered:

  • Prior to executing X2C setup, the environment variable has to be set manually.
    This can be done by adding the line
    export X2C_Root=/home/<user>/X2C

    in

    /home/<user>/.profile
  • Pre-compiled libraries for simulation in Xcos are not available.
  • Some USB-to-serial converters are not recognized automatically by X2C Communicator. To work properly, the name has to be either /dev/ttySx or /dev/ttyUSBx.
    The following example shows how to get the Microstick Plus demo board recognized:
    ls -l /dev/ttyACM0

    gives the ouput

    crw-rw---- 1 root dialout 166, 0 Feb 11 08:56 /dev/ttyACM0

    With this information, a new device can be created:

    sudo mknod /dev/ttyUSB0 c 166 0
    sudo chown root:dialout /dev/ttyUSB0
    sudo chmod 660 /dev/ttyUSB0

    This device will be recognized by the Communicator.

  • The Communicator can only be started within Scilab/Xcos. Starting Communicator.jar as standalone application will not work.
So where do I set up my control scheme?
The control scheme is set up in Scilab’s Xcos by dragging the control blocks into the current diagram.
How do I get the code from my control scheme?
You can create the compilation ready C-code representing your control scheme by clicking the create code button in the Communicator GUI.
Does X2C® work with Scilab 6.x?

Yes. Since X2C v6.4 Scilab version 6.1.1 is supported.

How can I connect to my target?
The easiest and fastest way is to use the Communicator GUI. It provides a convenient way to set the communication parameters and connect to the target.
I can't connect to the target with the X2C Communicator, what's the problem?
To get a connection with the Communicator, an X2C application has to be running on the target. So the target has to be programmed prior to any connection attempts. Also interface and port in the “Setup”-tab have to be selected according to the setup of the target.
How can I download the compiled code to my target?
The new application has to be downloaded using the built-in programming feature of the target’s IDE. With X2C Professional and its bootloader support, a new application can be downloaded via the Communicator GUI.
Does X2C® support the target XYZ?
Please check the list of supported targets. If your device is not among the listed targets but is a member of either the C28xx, ARMv6, ARMv7, dsPIC, or PIC32 series, you can use a generic processor type.
How can I simulate my model in Linux?
Unfortunately, simulation out of the box does not work in Linux yet. However, simulation is possible, if these steps are followed:

  1. Install gcc
  2. Download and install the latest X2C nightly build
  3. Re-create the libraries in Scilab:

    – createLibrary(“General”)

    – createLibrary(“Math”)

    – createLibrary(“Control”)

  4. Compile the libraries in Scilab:

    – compileLibs()

  5. Execute loadLibs() after every start of Scilab or execute initProject.sce prior opening an X2C Xcos model
Is a Java Runtime Environment (JRE) required to run X2C®?

A JRE only is required if X2C is intended to be used in Standalone mode, e.g. using the Communicator outside Scilab or Matlab or using the Block Generator.
Above use case requires a JRE installation and – dependend of the underlying operating system and used JRE type – additional steps during the JRE setup.
If X2C is used in Scilab or Matlab environment only, no dedicated JRE is required.

X2C has been tested to work with

The latter uses OpenJDK sources and is free for use.
If ojdkbuild is to be used on a Microsoft Windows platform, additional steps may be necessary during installation. For more information please have a look at the X2C documentation.

Die Österreichische Forschungsförderungsgesellschaft FFG -  Logo
Bundesministerium für Verkehr, Innovation und Technologie -  Logo
Bundesministerium für Wissenschaft, Forschung und Wirtschaft -  Logo
Forschungsland Oberösterreich -  Logo
UAR Innovation Network - Logo
COMET – Competence Centers for Excellent Technologies -  Logo
Europa -  Logo