- You apply one of the storage classes Auto, FileScope, or SimulinkGlobal.
- You apply a custom storage class that causes the code generator to generate a macro or non-addressable variable.
Why does the generated ASAP2 file not show my parameter under the CHARACTERISTIC section?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 5 Apr. 2019
Bearbeitet: MathWorks Support Team
am 3 Aug. 2022
When I generate code, and enable the ASAP2 interface, the generated A2L-file does not show the parameters under CHARACTERISTIC, even though I can see them in the generated C code. Why does this happen, and how can it be resolved?
Akzeptierte Antwort
MathWorks Support Team
am 3 Aug. 2022
Bearbeitet: MathWorks Support Team
am 3 Aug. 2022
A data item is not represented in the ASAP2 file if any of the following conditions exist:
So as long as the custom storage class does not generate a macro, or a non-addressable variable, it will show up in the A2L file. Create a Simulink parameter e.g., "myParameter" in base workspace and map its storage class to 'ExportedGlobal'.
>> myParameter = Simulink.Parameter;
>> myParameter.CoderInfo.StorageClass = 'ExportedGlobal';
Once the above command is executed for the parameters and signals, the CHARACTERISTIC and the MEASUREMENT sections show up correctly in the ASAP2 file.
Please refer to the documention for more information regarding ASAP2 Files:
Furthermore, in case you
1) are working with AUTOSAR Classic Platform in MATLAB R2022a or older
2) want to generate CHARACTERISTICS in the ASAP2
3) need to assign required memory section,
you can define parameter in base workflow with AUTOSAR.Parameter (or AUTOSAR4.Parameter) like below.
>> myParameter = AUTOSAR.Parameter;
>> myParameter.CoderInfo.StorageClass = 'ExportedGlobal';
Note that from R2020a to R2021b, 'GenerateASAP2' option is disappeared in GUI. Hence you need to turn on the option with MATLAB script like an example below.
open_system('autosar_swc.slx'); % manually select "Create and Configure AUTOSAR Software Component"
%% Build C code on AUTOSAR model with A2L file
% You can change the current directory to your own workspace
% to prevent making a folder in an example directory.
model = 'autosar_swc';
cs = getActiveConfigSet(model);
set_param(cs, 'GenerateASAP2','on')
slbuild(model)
Last but not least, note that from R2022b, we support export of RTE and non-RTE AUTOSAR elements to ASAP2 file which includes model workspace parameters mapped to constant-memory by default.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!