In the following steps you will create the build cache and the executable for your Adaptive Application.

Optional: Copy Example

  1. Copy the directory /Examples/amsr-vector-app-example-hello-world to your workspace.
  2. Rename the copied directory.
notice

Note: Your workspace may be located outside of the directory of your BSW Package.

Step 1: Set Environment Variable

  1. Open a terminal session.
  2. Set the environment variable AMSR_SRC_DIR to the path of the BSW Package delivery.
  3. export AMSR_SRC_DIR=~/<path to BSW Package>

Step 2: Initialize the build-cache

  1. In the terminal, change to the directory to your copied Hello World App directory.
  2. cd ~/<path to Hello World App>

  3. Initialize the build-cache with CMake.
  4. The AMSR_EM_EXAMPLE_APP_MSC=ON setting tells the EM example application to act as machine state client (MSC).
  5. cmake -S . --preset=gcc7_linux_x86_64 -C ${AMSR_SRC_DIR}/CMakeConfig/linux_gcc7.cmake -D AMSR_EM_EXAMPLE_APP_MSC=ON

  1. You will find the build-cache in the build directory of the Hello World App directory: ./build/gcc7_linux_x86_64.

Step 3: Generate the application code

Run the code generators for both amsr (Adaptive MICROSAR) and hwsrc (Hello World src) prefixed targets and reload the build cache:

cd build/gcc7_linux_x86_64
ctest -R '(amsr|hwsrc)_.*\.DvACfg.Generate' --progress --parallel $(nproc)
cmake .

Step 4: Build the Executable

The main CMake target is the executable hwsrc_app.
To build it together with its MICROSAR Adaptivedependencies, call the following (in the build-directory):

cmake --build . --target hwsrc_app --parallel $(nproc)

 

Optional next step: Change the log message

Next step in the tutorial: Install and Run the Application