Rte Explicit Read inside if condition

6 visualizzazioni (ultimi 30 giorni)
gianluca cenerelli
gianluca cenerelli il 14 Mag 2021
Commentato: Noé il 3 Dic 2025 alle 8:55
Dear all
could you please help me with the following problem?
I have to to an Rte Explicit read (AUTOSAR) port inside an if block. I've tried several solutions (enabled sub-systems, if action, function call) but it generates the code with the Rte read in the if condition, but it adds another variable that I don't want in the final code.
Then at the end I need a code like this:
if (condition){
Rte_Read_XXX(&tmp);
}
But what I tried generates the following code:
if (condition){
Rte_Read_XXX(&tmp);
Var = tmp;
}
and then uses Var. I don't want it to create this additional variable.
NOTE: I'm using MATLAB 2016B and Embedded Coder.

Risposte (1)

Anurag Ojha
Anurag Ojha il 18 Ago 2024
Spostato: Walter Roberson il 18 Ago 2024
Hey
The issue arises because when using 'ExplicitReceive' mode, Simulink automatically buffers the data to ensure simulation and code behavior match. This often results in an additional variable in the generated code.
You can refer to following links for more infromation:
  1 Commento
Noé
Noé il 3 Dic 2025 alle 8:55
Their is a MATLAB answer about a similar topic on Rte_Write.
This might help you:
https://mathworks.com/matlabcentral/answers/2110141-conditional-rte-write-in-autosar-generated-code

Accedi per commentare.

Categorie

Scopri di più su Programming Utilities in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by