Including custom code

Showing results for 
Search instead for 
Did you mean: 

Including custom code

Contributor IV

I am getting an error when I try to build a model which includes custom code. The custom code I used is from  
Please find attached the error. I think it has to do with Simulink 2017b. But I am unable to solve the error. 

0 Kudos
1 Reply

NXP Employee
NXP Employee

Hello raghurajappa,

Sorry for our delayed answer.

It looks like when compiles, the mwSize variable type has not been defined, probably a file must also be included. 

For this approach of custom code insertion, we also have an example here How to put S32K MCU into sleep (low power mode)? , but just take the .slx model as example, and do not copy those s32k  files into your toolbox because it handles another toolbox. 

Another easier way of injecting custom code into the model is to use the Custom Code blocks from the Simulink Coder (see the image attached), from the Simulink library. The System Initialize block will inject the code in the generated initialize function and the System Outputs blocks will put your code in the step function.


Hope this helps, 


0 Kudos