I am using S32k144EVB board and NXP_MBDToolbox in matlab 2019a. I want to make different models for ADC, GPIO, PWM,etc and then finally I want to combine ADC.c, GPIO.c ,PWM.c file in my S32k design studio.
I have created different .slx files for different modules but when I generate code for these different modules each module is generated as a different project and different dependent file.I just want the code for that module only and then when I will combine .c and .h files it should compile.
I have attached sample module for example.
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
Hello sagar.salunkhe50@gmail.com,
I think dumitru-daniel.popa can give you an example on how you can generate code for only part of your model, which you may integrate manually later in your project. Thank you in advance Daniel!
Kind regards,
Razvan.