This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Code from matlab(simulink) model with S-function

Hello everyone

I have a model in simulink and convert it in C-code thanks for Embedded coder. I debug it in CCS 6.0 and it works fine. 

Now I need to add S-function in my model. It still converts witout errors in matlab, but in CCS I had nomerouse errors.
 I tried to use decision described below: 1) translate.google.ru/translate 2) stackoverflow.com/.../compiling-s-functions-for-matlab As described in (1) I add all preprocessing simbols from file "defines.txt"(from matlab`s generated code)


in CCS project`s properties (C/C++ General-->Paths and Symbols) but I still have same errors)



It happens every time I use S-function, no matter how simpe model or function is.

I am sure I made a mestake in principle of conversion code with S-function from matlab to CCS but I don`t understand where.

  Thank you for any help.

  Best Regards,

  Andrey

  • Hi Andrey

    The s-function and the compiled .mex file is just one part of the story. The .mex file is basically used in the context of the Simulation in Simulink. If you want to create code with the real time workshop for your target you have to write a so called .tlc file which advises the target language compiler what code to implement in the target source file during the code generation process.

    Philippe
  • Thank you for reply.

    As I understand .tlc files are specific for matlab, to organise  succession of code, generated in matlab compiler, for other  IDEs like CCS(or it is also specific for  controller like TMS320 F28335??? ).

    But there is large variety of them in matlab.

    I use "idelink_ert.tlc" ( in simulink model window   Simulation--Model Configuration Parameters --Code generation) and it compiled fine in CCS until I didnt use  S-function in my model.

    Do you mean It would be better to modernize tlc. file?  or you also use that are included in matlab?

     

  • Hello Andrey,
    You may also want to contact Mathworks support. They can give you the best answers regarding your matlab\simulink questions

    Thanks
    ki