How to have return value check for Rte_Write in generated C Code?

5 vues (au cours des 30 derniers jours)
Oguz Cebe
Oguz Cebe le 10 Fév 2023
Commenté : lianru le 15 Déc 2024
We generate C code through AUTOSAR and Simulink Coder for Simulink Model. We send signals in Simulink through AUTOSAR interface outport with DataAccessMode: ExplicitSend. We generate code through MATLAB script:
%Check model is loaded
load_system('ModelName');
% Generate code
rtwbuild('ModelName');
We want to implement safety through return value of Rte_Write, RTE_E_OK.
Currently, the generated C code is:
Rte_Write_PortName(&rtb_bus_creator_kk);
We want the generated C code to be similar to:
Consider a provided port, ra, containing a data element val of type SInt16 with the isQueued attribute set to “false”.
Std_ReturnType e = Rte_Write_ra_val(self, 23);
if (e == RTE_E_OK)
{
/* Transmission okay */
}
else{
/* Transmission failed. Execute safety*/
}
Second code is taken from ETAS RTA-RTE V6.2.0 Reference Manual.
We do not want to manually edit the C code since we have too many outports and they are subject to change over time.
  2 commentaires
建华
建华 le 11 Sep 2023
Does MathWorks have a unified solution for this widely existing problem?
lianru
lianru le 15 Déc 2024
any answer already?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by