Including custom code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Including custom code

1,690 Views
raghurajappa
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 https://community.nxp.com/thread/450048  
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

1,299 Views
mariuslucianand
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.

pastedImage_2.png

Hope this helps, 

Marius

0 Kudos