s function usage error- code generation

7 views (last 30 days)
Dinesh Guleria
Dinesh Guleria on 25 Aug 2015
Commented: Yuchen Chen on 5 Dec 2017
My s function is build with SfunctionBuilder block from already existing c source code & tlc file is also generated for it. It takes two nubers as input & output the sum of two numbers.
void add(unsigned char *ip_1,unsigned char *ip_2,unsigned char *result)
{
*result = *ip_1 + *ip_2;
}
I have integrated a matlab s-function in my model. I am getting following error while generating code, for the model.
Error: Simulink Coder Error in block: "one_mdl_extention/One Model/S-Function Builder", block type "S-Function": Block output output_1 uses custom storage class, level 2 but the compliance level of this block is only 1; use a different block or a different custom storage class, level 1 or lower
I have made a simple c function & used s-function builder to create s function, now how can i decide it is a level-1 or level-2 s function ?
What is causing this error ? How to resolve this error ?
why my c source code is converted into level-1 s function, by s function builder block ?

Answers (1)

Varun Bhaskar
Varun Bhaskar on 27 Aug 2015
Hi,
There is a bug in Simulink 7.8 (R2011b) in the error message produced when advanced storage classes are used in blocks that do not support advanced storage classes. There are no workarounds. Are you working with R2011b?
  2 Comments
Dinesh Guleria
Dinesh Guleria on 28 Aug 2015
Thanks for reply, finally resolved. I was doing something wrong at my side.
Yuchen Chen
Yuchen Chen on 5 Dec 2017
Would you mind sharing what you did wrong? I keep seeing this error but could not find any hints anywhere. the wired thing is the error happens pretty randomly, I'm using exactly the same blocks in a couple similar occasions, the error showed several times, but not all the time.

Sign in to comment.

Categories

Find more on Block and Blockset Authoring in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!