フィルターのクリア

How to run SIL of a model including s-functions based on c++ code

2 ビュー (過去 30 日間)
Rodrigo Estrella
Rodrigo Estrella 2018 年 12 月 10 日
回答済み: Rodrigo Estrella 2019 年 1 月 14 日
I have a model using S-functions. The s-function is based on existing C++ code and the integration of this code into s-functions was done using legacy code. Until here everything works well. The problem is when i try to run the model as reference model in software in the Loop mode. In this case the compiler is not capable of finding the source code of the s-functions. It works when i copy the source code to the directory where i'm working at, but i don't want that. I need the compiler to find the source code in a specific directory struture, where the code is placed.
Regards,
Rodrigo
  2 件のコメント
Mukund Sankaran
Mukund Sankaran 2018 年 12 月 10 日
Perhaps the search path needs to be modified to include the path to the custom C/C++ code so the compiler can find it ?
Rodrigo Estrella
Rodrigo Estrella 2018 年 12 月 10 日
編集済み: Rodrigo Estrella 2018 年 12 月 10 日
I've tried this in the configuration at simulink (configuration parameters->code generation->custom code. The funny thing is that this works when running the model in external mode. In external mode, the code is generated, the exe is generated and the external mode works without problems. But when i try running the model as reference model in SIL mode, the compiler can't find the source code.

サインインしてコメントする。

回答 (2 件)

Mark McBroom
Mark McBroom 2019 年 1 月 11 日
when you used legacy_code tool to create s-function, did you use the
legacy_code('rtwmakecfg_generate', specs)
option to create an rtwmakecfg.m file? This file will add path information for S-Function source and header files to the make file used to build the SIL mode target.

Rodrigo Estrella
Rodrigo Estrella 2019 年 1 月 14 日
Thanks, i've tried with:
legacy_code('sfcn_makecfg_generate', specs) and it works. I don't know what is the difference. The problem i have now is when i try to run the same model as processor in the loop (PIL) on a raspberry pi. The problem i have is that the generated code cannot be build, the make command on the raspberry fails. Matlab is able to generate the code, copy the generated code and the include files (my existing code) into the raspberry pi. But when the make command is executed on the raspberry pi, it fails.
I've took a look using a terminal and the sources files are not copied with the correct directory structure as in my desktop. Do you now if its there a way to tell matlab to replicate the directory structure of the source code?
Thanks

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by