Hi everyone im trying to use legacy code tool to generate s function for my C code generated with simulink coder (for SIL test) but the problem is my output function is void (my I/O are declared as extern at the start of the code) its like “void function_step(void)” so when i generate my s function with legacy code its generated without inputs or outputs.
and even when i add inputs and outputs in my function prototype the generated s function does’nt work and its totally normal because the legacy code cant know my I/O … so if someone could help me please because im trying more than a month to modify the s function generated and try every solution but without a result ....
thanks everyone in advance
here's my script
load('myBues.mat')
def = legacy_code('initialize');
% Find c files:
list = dir('*.c');
def.SourceFiles = {list.name};
% Find header files:
list = dir('*.h');
def.HeaderFiles = {list.name};
% mex function name and output spec:
def.SFunctionName = 'Sfunc';
% here when i have the problem
% instead of void my code has 12 inputs and 22 outputs and when
% i use them in the function_step the S function generated doesnt work correctly
def.OutputFcnSpec = 'void function_step(void)';
def.InitializeConditionsFcnSpec = 'void func_initialize(void)';
def.TerminateFcnSpec = 'void func_terminate(void)';
% % to compile and launch the s function in simulink
legacy_code('generate_for_sim',def);
legacy_code('slblock_generate',def);

 採用された回答

SAID ELMOTAOUAKKEL
SAID ELMOTAOUAKKEL 2019 年 4 月 6 日

0 投票

i finnally found an answer
and its work perfectly i change the function prototype in the C codes to much the s function that i want and i use this prototype in the legacy code and things workd correctly
for any details welcome

2 件のコメント

BABANBHAIGARI SHAFIULLAH
BABANBHAIGARI SHAFIULLAH 2020 年 2 月 18 日
Hi SAID ELMOTAOUAKKEL, could you please share a sample prototype, like, how the legacy function originally was, and how the new function prototype is, after the changes you made .
Thanks in advance.
vamshi krishna kammadanam
vamshi krishna kammadanam 2022 年 1 月 20 日
Hi SAID ELMOTAOUAKKEL,
I am trying to figure out a similar void function(void). How were you able to change it?
Does legacy code tool support "void function(void)" ?
Regards

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

その他の回答 (0 件)

カテゴリ

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

製品

リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by