User defined Simulink block (from C)

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

User defined Simulink block (from C)

939 Views
raghurajappa
Contributor IV

Hi,

Hardware: MPC5643L + Daughter board + Mother board XPC56xx EVB.
Software: Simulink + Green Hills v5.1.7 compiler + Serial interface (RappID). Using MPC56xL RBA file (to internal RAM)

Intention is to create a simple GPIO 'output' simulink block from C code. I know a GPIO output block already exists. But the intention is to get a feel for C code to custom simulink blocks. For now, I am using S-function builder. Attached are the errors as screenshots.
I tried to read a lot of "how to" documents on how to go from C to Simulink but it's still not completely clear in my head. Especially when I want to make a block that will later again be generated into C code to be flashed on the target MPC controller.

Please help me create a simple simulink block from C code.

P.S -> The other problem is NXP has p-coded all the files that have the actual implementation. It would have been easier if I could have been able to read the code.

Thank you :smileyhappy:

Tags (2)
0 Kudos
2 Replies

675 Views
mariuslucianand
NXP Employee
NXP Employee

Hello raghurajappa‌,

Thank you for your interest in understanding how the MBDT generation code works. 

Unfortunately, we can only guide you on how to insert custom code to fulfill your requirements. This toolbox, even if it's free is not open source, this being the reason why we provide most of our scripts as p files. I hope you understand.

Now, I don't know how your model looks like but if you are not using one of the toolbox gpio's blocks the tool does not copy the gpio_564xl_library.c in the generating code, so this must be also done. Another issue might be that under the S-Function Builder->Libraries->Include you need to include also the gpio_564xl_library.h file which also must be copied. 

There is also another way of inserting custom code in your model, the one presented as my response at your question Including custom code .

Hope this helps, 

Marius

0 Kudos

675 Views
raghurajappa
Contributor IV

dumitru-daniel.popa‌ , hopefully you could help me with this? 

thank you :smileyhappy:

0 Kudos