A2L/ASAP2 file generation for Simulink Real-Time in R2020b and beyond

95 vues (au cours des 30 derniers jours)
I would like to parameterize and monitor an application running on a Speedgoat real-time target using a third-party calibration tool. For this, I need the A2L file for the application. How does the A2L (ASAP2) calibration file generation work with Simulink Real-Time (SLRT) in R2020b and beyond?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 12 Déc 2023
Modifié(e) : MathWorks Support Team le 12 Déc 2023
Behavior in R2022b (Update 1 and earlier), R2022a (Update 5 and earlier), R2021b, R2021a, R2020b:
In the above-mentioned versions, the Simulink Real-Time model build will always generate an A2L file in the post-build step. The A2L file will appear in the 'ModelName_slrealtime_rtw' build folder.
In addition, the A2L file is packaged into the real-time application MLDATX file. You can extract the A2L file from the MLDATX file at a later point using the extractASAP2 method:
% The A2L file will appear in the current folder
>> app_obj = slrealtime.Application('ModelName.mldatx');
>> extractASAP2(app_obj);
It is not possible to disable the automatic A2L file generation and packaging in the above-mentioned versions.
Behavior in R2023a and beyond, R2022b (Update 2 and later), R2022a (Update 6 and later):
In newer versions, the Simulink Real-Time behavior changed to not automatically generate and package the A2L file anymore in the post-build step. This change was implemented in an effort to decrease the total build time, since most users do not require the A2L file.
To generate the A2L file in newer versions, do the following:
(1) On the REAL-TIME tab, select RUN ON TARGET > Build Application.
(2) On the C CODE tab, select Share > Generate Calibration Files. If you do not see the C Code tab, go to the APPS tab and open the Simulink Coder app.
(3) Use the Generate Calibration Files utility to generate the required version of ASAP2 file. To replace ECU addresses in the A2L file, in the Symbol file field, provide the 'ModelName' binary file located in the 'ModelName_slrealtime_rtw' build folder. For more information about using the tool, see Generate ASAP2 and CDF Calibration Files.
You can perform the same operations from steps (1)-(3) by using the slbuild and coder.asap2.export functions. Note that 'coder.asap2.export' requires the full build folder 'ModelName_slrealtime_rtw' as well as the model SLX file and all its dependencies.
% The A2L file will appear inside the 'ModelName_slrealtime_rtw' build folder
>> slbuild('ModelName');
>> coder.asap2.export('ModelName',...
  'MapFile', 'ModelName_slrealtime_rtw/ModelName',...
'Comments', false);
Then, to package the generated A2L file into the MLDATX file, use:
% Package the generated A2L file into the MLDATX file
>> copyfile(fullfile(pwd,'/ModelName_slrealtime_rtw/ModelName.a2l'));
>> app_obj = slrealtime.Application('ModelName.mldatx');
>> updateASAP2(app_obj,'ModelName.a2l');
The A2L file will appear in the 'ModelName_slrealtime_rtw' build folder.
If you would like any of the above functions to be run automatically after every build, consider adding them as a post-code generation command ("PostCodeGenCommand") in the configuration parameters. The detailed procedure for this can be referenced here: 

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by