
Why does the generated code for a Simulink Function returns an argument instead of void when using the autosar.tlc target?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 10 de Nov. de 2021
Editada: MathWorks Support Team
el 19 de Mayo de 2023
It is sought to generate embedded code using the autosar.tlc target from a Simulink model that uses a Simulink Function Caller block. The function prototype provided to the function is as follows,
myoutp = myfunc()
It is expected that the generated embedded code when using the autosar.tlc target for this Simulink Function Caller block has no output argument and the signature looks as follows,
void Rte_Call_CP_myfunc(UInt8* myoutp);
However, the generated embedded code when using the autosar.tlc from this Simulink Function has in fact the following signature,
Std_ReturnType Rte_Call_CP_myfunc(UInt8* State);
Why does the generated code for a Simulink Function returns an argument instead of void when using the autosar.tlc target?
where as it can be see the return type 'Std_ReturnType', which is defined under Std_Types.h is an alias to uint8:
typedef uint8 Std_ReturnType;
Respuesta aceptada
MathWorks Support Team
el 17 de Mayo de 2023
Editada: MathWorks Support Team
el 19 de Mayo de 2023
Please note that these stub-files generated by Simulink in case of the autosar.tlc target are not meant to be used in production and they have to be replaced by the stub-files provided by the corresponding RTE generator. These autogenerated files from Simulink are only meant to be used in a Software-In-the-Loop (SIL) simulation.
Although these stub files are meant to be used internally within Simulink, we strive to keep the implementation of the RTE APIs as close to what AUTOSAR specification dictates and also similar to what actual RTE generator would generate as much as possible.
In this particular example, it is used a return type 'Std_ReturnType' based on how AUTOSAR specification defines the Rte_Call* API to initiate the Client-Server communication as per Section 5.6.13 of the document that can be found in the following link,
So this is a design choice we made to always use "Std_ReturnType Rte_Call_*" in the RTE source code (stub file) and "void Rte_Call_*" in the application component source code since the return value from the access function is almost never used. See also the following screenshot from the AUTOSAR specifications document,

0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre AUTOSAR Blockset en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!