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

95 visualizzazioni (ultimi 30 giorni)
I would like to parameterize and monitor an application running on a Speedgoat real-time target using a third-party calibration tool like Vector CANape® (www.vector.com) and ETAS® Inca (www.etas.com). 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?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 13 Ott 2025 alle 0:00
Modificato: MathWorks Support Team il 13 Ott 2025 alle 13:01

For Newer Versions - MATLAB R2023a, R2022b (Update 2), R2022a (Update 6) and beyond:

To generate the A2L file for the Speedgoat workflow in recent MATLAB 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 build folder ('ModelName_sg_rtw' or 'ModelName_slrealtime_rtw'). 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_sg_rtw/ModelName',...
'Comments', false);
Optionally, you can package the generated A2L file into the MLDATX file by using:
% 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: 

For Older Versions - MATLAB R2022b (Update 1 and earlier), R2022a (Update 5 and earlier), R2021b, R2021a, and R2020b:

In previous releases, 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 these previous releases.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by