S-Function creation for Target link generated code

조회 수: 2 (최근 30일)
santhosh
santhosh 2024년 8월 8일
답변: Sahas 2024년 8월 20일
Hello Team,
I am creating on S-Function creation for Target Link generated codes.
I tried Legacy tool, but Legacy tool works well only when the input parameters and the return type are properly defined.
Example: When i have a function like==> double Sum( double a, double b).
Using def.OutputFcnSpec = 'double y1 = doubleIt(double u1, double u2)'.
But Target Link generated code, the main function is Void.
Example: The function looks like this, Void Sum(Void), in Sum.c file.
Facing difficulty in creating S-Function for this.
Can you please suggest any work around for the above issue.
Regards
Santhosh A

답변 (1개)

Sahas
Sahas 2024년 8월 20일
As per my understanding of the question, you would like a way to generate “S-function” using “legacy tool” for a function whose “return” and “argument” parameters are of “void” type.
I was able to create a small example for this, please follow the steps below to create the “S-function” with required specifications:
  • Create two code files named "sum.c" and "sum.h" that contain a void function and the headers, respectively.
  • Generate the S-function using “legacy code tool”.
  • A Simulink model will open with the required “void” type block.
To know more about using the “legacy code tool”, it’s integration with C/C++ code and a few examples, refer to the following documentation links:
I hope this is beneficial!

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by