Verify AUTOSAR C Code with SIL and PIL
As part of developing AUTOSAR software for the Classic Platform, you can carry out model-based verification of AUTOSAR software components by using software-in-the-loop (SIL) and processor-in-the-loop (PIL) simulations. Use SIL for verification of generated source code on your development computer, and PIL for verification of object code on your production target hardware. For example:
You can run a top model that is configured for the AUTOSAR system target file (
autosar.tlc) by using the
Processor-in-the-Loop (PIL)simulation modes.
You can use Model block SIL or PIL to test AUTOSAR top-model or submodel code:
To test an AUTOSAR software component model, use a harness model that references the AUTOSAR component model. In the Model block, set Simulation mode to SIL or PIL and set Code interface to
To test a submodel that is not mapped to AUTOSAR inside an AUTOSAR model, open the AUTOSAR model. In the Model block for the non-AUTOSAR submodel, set Simulation mode to SIL or PIL and set Code interface to
You can create a SIL or PIL block for a component configured for the AUTOSAR system target file. For example:
Open an AUTOSAR software component model.
Open the Configuration Parameters dialog box.
In the Hardware Implementation pane, set appropriate properties.
In the Code Generation pane, clear the Generate code only option.
In the Code Generation > Verification, set advanced parameter Create block to
To generate code and create a SIL block for the model, enter Ctrl+B.
Add the generated block to a harness model that supplies test vectors or input.
Run simulations with the harness model.
However, SIL and PIL block verification does not support code generated for Simulink Function and Function Caller blocks, for example, in AUTOSAR client-server configurations.