Skip to content

📖 AUTOSAR

Advanced

Mayhem can be used to analyze embedded software during the software-in-the-loop (SIL) testing phase. By performing analysis at this stage, you can identify and fix defects prior to hardware integration. In order to perform SIL testing, you must virtualize the electronic control units (ECU).

What you need to get started

In order to analyze a virtualized ECU (vECU) you'll need the following.

Tip

  1. Mayhem 2.10 or higher
  2. The mayhem CLI
  3. A vECU that produced with vVirtualTarget or exposing the OpenSUT API. Mayhem supports vECUs compiled under Linux x64/x86, Windows x86 and Windows x64.

For detail on the Vector toolchain and creating vECUs, see Vector's documentation.

Running Mayhem on a vECU target

In order to analyze a vECU, Mayhem makes use of a universal harness for embedded software. This harness is made available as a binary executable within the Mayhem CLI, and is used like any other harness template in Mayhem.

Once you've generated a vECU, follow the below steps.

1. Initialize Mayhem's SUT Runner

In your terminal, run the following command:

mayhem init --template=opensut 
This initializes your Mayhem working directory and loads Mayhem's SUT runner, along with a README.md that contains these instructions.

2. Copy vECU and related files into your Mayhem directory

Copy your dll (Windows) or so (Linux) and any generated pdb files into the root directory created by mayhem init.

3. Configure your Mayhem run

In the Mayhemfile, uncomment the cmd line, and edit it to point at the Mayhem SUT runner and your target. For example:

  • Windows x86: /mayhem-sut-runner-win32.exe /<your-target.dll> @@
  • Windows x64: /mayhem-sut-runner-win32.exe /<your-target.dll> @@
  • Linux: /mayhem-sut-runner-linux <your-target.so> @@
4. Run Mayhem

In your terminal, run mayhem run .

Advanced Configuration

You can set environment variables that change the behavior of Mayhem's analysis, allowing you to fine tune error checking, input delays, and more. Below is a list of variables that can be set, along with their default values if left unspecified.

MAYHEM_BOOT_DELAY_MS milliseconds

The delay in miliseconds before the runner begins stimulation of inputs.

By default, set to 100


MAYHEM_STEP_DELAY_MS milliseconds

The delay between stimulation steps

By default, is variable and controlled by Mayhem.


MAYHEM_CTRL_PINS comma-seperated

Control outputs to check after each step. Matches any names containing the specified string(s), for example foo will match foobar_output. Provide multiple strings seperated by commas.

By default, includes Error.

Leaving blank will disable all error checking.


MAYHEM_SKIP_PINS comma-seperated

Inputs to skip when stimulation occurs. Matches any inputs containing the specified strings.

By default, includes Reset, Error and Ram.


MAYHEM_CAN_ID integer

Allows you to specifiy a CAN ID if your SUT expects it.

By default, Mayhem generates a CAN ID as needed.


MAYHEM_TRIAGING boolean

When set, generates a human-readable stimulation trace that can be shared with CANoe or viewed within Mayhem's web console.

By default, is not set.