Shared Hardware Configuration across different simulink models Hi, I am working on a project where I have multiple simulink models that use S32K3 library blocks for inputs and outputs of my microcontroller, I want my different models stored in independent .slx files to share the same Harware configuration (.mex file) so that if I open one model, modify something in that configuration and save, I can later open a diferent model and I can see those changes applied to the configuration. My problem is that when using the option "referenced configuration" an independent .mex file is generated for each .slx file, also if I generate a configuration and set it as the reference for the different models it will create a local copy for each one of them but I modify any of the local configurations changes will not be applied to the template or other models. Is there a way that I can achieve what I am looking for? Thanks in advance Re: Shared Hardware Configuration across different simulink models Hello,
To use a reference configuration, you can follow these steps:
0. If you want to set up an existing model for reference configuration, I strongly recommend you to use source control, or to manually create a backup of the whole folder (which contains the model). It might be possible that important files to be deleted or corrupted during the process.
Create a new Simulink Model.
Save it. It this case, I named it 's32k3_ref_modelA.slx'.
Model Model Settings and configure Hardware Board to NXP S32K3xx. In the Hardware tab, choose the right template depending on your board. Apply the settings.
Go to Referenced Configuration tab and enable the checkbox. Select the location where you want to store the reference configuration.
Click on Create Reference.
In the pop up dialog, choose Base Workspace then MAT-file. At the last pop-up, it is not mandatory to open the referenced configuration.
Now the model created previously uses the reference configuration you just created.
These files ("s32k3_ref_modelA_config", "s32k3_ref_modelA_settings.mat" and "s32k3_refmodelAConfig.mex") can now be deleted as they are not used anymore.
To recreate the .mex, you can simply build the s32k3_ref_modelA.
After the build is completed, next to the model you should have the following files. The most important ones are the Configuration_RefS32K3_settings.mat (where the referenced configuration is saved) and the Configuration_RefS32K3Config.mex (where the configuration settings are stored).
Create a new model. Save it as s32k3_ref_modelB. Inside the s32k3_ref_modelB, open the Model Explorer.
Expand the s32k3_ref_modelB and click on Configuration. Click on Add configuration reference and select the previously created .mat file (Configuration_RefS32K3). Click Apply.
Activate the Refence configuration and delete the old one.
This is how the Configuration tab for s32k3_ref_modelB should look at the end.
Go back to s32k3_ref_modelB model and open Hardware Settings. Now it should state that a reference configuration is used.
To validate it, build the s32k3_ref_modelB and next to the model you should see only a .mex file
Tip! In this scenario, if you want to replace the default .mex configuration file (Configuration_RefS32K3Config.mex) with your configuration project you need to do the following:
IMPORTANT! Make sure you have a backup available in case something goes wrong.
Delete Configuration_RefS32K3Config.mex
Delete Configuration_RefS32K3_Config, s32k3_refModelA_ert_rtw and s32k3_refModelB_ert_rtw folders.
Copy your .mex file next to the model.
Renamed your .mex file to Configuration_RefS32K3Config.mex
Do not forget to give a kudo and to mark this post as Solved if these steps helped you. Thanks! Best regards, Sorin Bancila Re: Shared Hardware Configuration across different simulink models I am using Matlab 2025b and the 1.8.0 version of the toolbox Re: Shared Hardware Configuration across different simulink models Hello, Can you please share what MATLAB and toolbox versions do you currently use? Best regards, Sorin Bancila
View full article