C code compliant with AUTOSAR

7 views (last 30 days)
Nour
Nour on 16 Dec 2023
Commented: Angelo Yeo on 17 Dec 2023
Hello,
I have a simulink model that contains subsytems and I need to generate a C code which is compliant with autosar for one subsystem within the model, I am using matlab 2020 version to generate the code. I selected the system target file autosar.tlc in configuration parameters/ Code generation and I used the autosar Component Designer quick start for the code generation so as I need to generate a subsystem, I selected the subsystem to be considered however as an output for the generated code, I can't select C code compliant with autosar and between parenthesis it says it is available for model build only.
Is there any solution to be able generate a C code compliant with autosar for a Subsystem within a model ?

Answers (1)

Angelo Yeo
Angelo Yeo on 16 Dec 2023
You must have received error messages similar to the one below. No, generating AUTOSAR-compliant C code from a subsystem is not a supported workflow.
Configuring a subsystem as an AUTOSAR SW-Component is not supported. Please convert the subsystem to a model and then configure the model as an AUTOSAR SW-Component.
You may have been confused with such a section of the doc below for ert.tlc.
  2 Comments
Nour
Nour on 17 Dec 2023
Thank you for your answer
yes I have received this error message
the subsytem contains Invoke AUTOSAR Server Operation block and function caller so when I converted it to model reference and generated code for referenced model, I get this error message ", block type "S-Function": Invoke AUTOSAR Server Operation block resides in a referenced model. This is not supported for the AUTOSAR Target. You must place this block in the top model.
I think there are some limtations for autosar code generation with referenced model.
So, I don't know if there's another solution for this issue.
Angelo Yeo
Angelo Yeo on 17 Dec 2023
Please see the limitation explicitly introduced in MathWorks homepage below. As noted, "The software does not support the use of the Invoke AUTOSAR Server Operation block in a referenced model."
The reason behind the Invoke AUTOSAR Server Operation block not being allowed inside a referenced model is the code for a referenced model may be shared by multiple top-level models (AUTOSAR components) and hence it cannot contain any RTE calls (such as the one generated by an Invoke Server Operartion block) which are specific to a particular top-level model (AUTOSAR component).
In addition, there are limitations that may come into play when performing incremental build of model-reference blocks for Accelarator/SIL mode where the defintion of the Rte_Call_<port>_<op>() stub that the referenced model's code needs to link against may not be available until after the top level model build is complete leading to a case where the referenced model's code will not compile during incremental build. The limitation applies to other RTE calls such as AUTOSAR.Parameter objects with the CalPrm and InternalCalPrm CSC. This could mean such parameters cannot be present within a referenced model.
These limitations with using the AUTOSAR.Parameter objects within a referenced model could be worked around by the following:
  1. parameterizing such a model and passing in the parameter arguments to the model block from a top-level model (AUTOSAR component).
  2. keeping the block in the top-level model and bringing the data that feeds the block to the top-level from within the referenced model.

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!