segmenation violatio error while simulating s function builder

Hi, I have one algorithm which is developed in C.In C project,main() is calling all the other methods required.Now I am trying to integrate this legacy code in matlab/simulink by using s function builder.In s function builder,directly I am calling main() by creating function pointer to call this method.When I started the simulation,it is throwing segmentation violation error and pop uping the stack status in command window and matlab session is getting terminated.Please can anyone help me in fixing this. Thanks in advance Sai

回答 (1 件)

TAB
TAB 2013 年 3 月 14 日

0 投票

Legacy code tool is best the best way to integrate legacy C-code in simulink. It generates the s-function automatically with all required function call. You have to just do a proper configuration.

5 件のコメント

sai vasavi
sai vasavi 2013 年 3 月 14 日
I created s function and it is compiling fine.while executing that model i'm getting segmentation violation error.Plz help in fixing this
Kaustubha Govind
Kaustubha Govind 2013 年 3 月 14 日
Sai: It sounds like there is a problem in your legacy C code. Please debug your S-function to see which line the SegV occurs at.
sai vasavi
sai vasavi 2013 年 3 月 15 日
Kaustubha:Thanks for your reply.I am able to execute the legacy C code in visual studio environment with out any error. And I have a quick question Kausthubha,I am developing s function by using S function builder.How can I debug S function builder.Plz help in fixing it
Kaustubha Govind
Kaustubha Govind 2013 年 3 月 15 日
Select "Create a debuggable MEX-file" in the S-function Builder Build Info pane, to replace step#2 for debugging in a third-party environment, and follow the remaining instructions.
sai vasavi
sai vasavi 2013 年 3 月 15 日
Thanks Kaustubha for your quick reply.

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

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

製品

質問済み:

2013 年 3 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by