Hello,
You are not the first to ask this - and most likely not the last one!
To be honest with you - i've not tried this so far, but it seems to be an interesting topic. If you are willing to invest your time into this, then we will be more than happy to support&learn with you.
At this point, i'm not fully aware of what does it takes to make it run - but i know we might be able to support such mechanism via:
- NXP Toolbox;
- Simulink Coder;
STAGE 1 (easy): copy all RTOS required files (sources + headers + libraries) into the Simulink Code Generation Folder. This can be done via mbd_pnt_user_copy_required_files.m what is automatically invoked during code generation. Check this for how to: https://community.nxp.com/thread/449904#comment-900775
STAGE 2 (tricky): invoke RTOS into the Simulink Model. For this you will have to use 2 basic approaches for custom/legacy code generation.
Anyhow, at this point i do not know how you could integrate Simulink models with RTOS without building re-writing the TLC behind some of the NXP's toolbox function blocks.
You might want to have a look here: https://community.nxp.com/thread/451648#comment-909339 for some additional insights.
Hope this helps!
Daniel