Hi sagar.salunkhe50@gmail.com,
That is absolutely possible and quite easy to do with S32Design Studio or any other tools that support Virtual Files/Folders
You need virtual linkage because you need to have MATLAB responsible for the content of the files and to be all the time in sync with the latest changes/code generation.
These files will not be part of the S32 Design Studio, but rather these will exists only in the MATLAB generated folders. Each time the files are updated, the S32 Design Studio will be automatically updated.
Step 1: Start by creating a new application project for the target you are developing for:


STEP 2: Create a new Virtual Folder in your project. This will be used to linked your files generated by MATLAB with the existing project created at STEP 1.

STEP 3: In this folder you can link virtually all the files generated from MATLAB. Here you can create additional virtual folders for src/headers etc.

STEP 4: Add your files into these folders. Typically you need only the MATLAB Generated Code files for your models. You can drag and drop them into your S32 Design Studio virtual folders.

REMEMBER: Select LINK option when drag&drop files into S32 Design Studio.

After this step, the S32 Design Studio will update the INDEXER and will show all the data/functions. All you have to do is to call your functions in the other parts of the projects.

For a better code modularity and reuse, I recommend to use Function Packaging. This way you can generate files and functions for each subsystem you are interested in, and will avoid having the Simulink Step/Initializa/Terminate functions staying into your S32 Design Studio project. This way you will achieve the best automatic code generation and custom code interfacing.

Hope this helps!
Daniel