Main Content

Build Out of the Box Linux Executable from AUTOSAR Adaptive Model

As part of generating code for an AUTOSAR adaptive model, you can generate a CMakeLists.txt file for building a Linux® standalone executable. Then, on a Linux system, you can build the executable. You can run the resulting executable on Linux as a standalone application.

Building the executable file from CMakeLists.txt requires running CMake software on a Linux system.

Note

Executable generation from AUTOSAR adaptive model is supported only on Linux platform.

To build a Linux standalone executable:

  1. Open a component model that is configured for the AUTOSAR adaptive target (autosar_adaptive.tlc).

  2. In the Configuration Parameters dialog box, go to Code Generation > Build process > Toolchain settings. Set Toolchain to AUTOSAR Adaptive Linux Executable. The toolchain selection adds ARA functional cluster libraries provided by MathWorks®.

    Configuration Parameters dialog box, Code Generation pane, with the System target file set to autosar_adaptive.tlc and the Toolchain set to AUTOSAR Adaptive Linux Executable.

  3. Build the model. The build generates C++ code, ARXML files, and a CMakeLists.txt file.

  4. In the model build folder, open CMakeLists.txt and verify that it is configured for executable generation. For example, check that:

    1. The CMakeLists.txt file contains add_executable(modelName …).

    2. The specifications for target_include_directories, target_link_libraries, and link_directories include the values specified in Toolchain settings.

  5. On a Linux system, outside MATLAB, go to the model build folder. To build the executable file, enter these commands:

    cmake CMakeLists.txt;
    make all;

The make generates an executable file for the adaptive model one level above the model build folder. You can run the executable on Linux as a standalone application.

Related Topics