Clear Filters
Clear Filters

S-function codegeneraton for rtw: error C2065: 'ssGetData​TypeSize_c​annot_be_u​sed_in_RTW​': undeclared identifier

27 views (last 30 days)
Hello,
I would like to use this function in an s-function to determine the memory size in bytes of a custom datatype.
// Retrieve the size in bytes of the datatype at the input port
int_T size = ssGetDataTypeSize(S,dtype);
This works fine in simulation, but when generating code for my target, I receive the following error:
error C2065: 'ssGetDataTypeSize_cannot_be_used_in_RTW': undeclared identifier
So probably this is not supported?
This is the only function preventing me to deploy my code on my realtime target.When hardcoding the size, codegeneration and running is succesfull. Therefore I would like to ask if there is an alternative to retrieve the memory size.
Kind regards,
Brecht
  5 Comments
Karel Viaene
Karel Viaene on 4 Feb 2022
Hello Benjamin,
Thank you for your reply. I believe this is exactly what I'm looking for. To clarify, we don't use PLC coder, but generate C++ code with simulink coder.
However I have no experience yet with TLC, so I think I need to learn this first. If I understand correctly, the TLC file will contain an alternative implementation which is interpreted differently at compile time. At compile time te compiler will know all sizes of the input ports and can then 'hardcode' the right value at compiletime.
I will come back to you if I played around with this a bit; already thanks for the help.
kr
brecht
Karel Viaene
Karel Viaene on 4 Feb 2022
Hi Benjamin,
I started learning writing tlc using the tutorials. The directive you talked about before works for me. In the generated code it can retrieve the datatype of the input signal on which the sizeof() operator can be applied. Then I was able to generate code with my TLC file corresponding to the S-function c++ code and deploy it on the target.
Still many things to learn about tlc apparently, but it's a start.
thanks for the help!
kr,
Brecht

Sign in to comment.

Accepted Answer

Benjamin Thompson
Benjamin Thompson on 4 Feb 2022
See this documentation for more information on the Target Language Compiler and some tutorials with instruction on how to use this tool and code TLC:

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!