MATLAB: Arxml Import leads to an “endless loop” during import process up to R2018a

Embedded Codersimulink

It could happen, that when you import an .arxml file in MATLAB to create a Software Component (SWC) then after starting AUTOSAR API command "createComponentAsModel(…)" the MATLAB command window prompt does not come back.
Assume you have a AUTOSAR XML description file called "mytest1.arxml" which contains one SWC called TCalc which I would import into Simulink to get a AUTOSAR configured model. I changed the MATLAB current directory and executed these commands in MATLAB command window to create the model with the SWC:
>> ar = arxml.importer('mytest1.arxml')
ar =
The file "H:\test_project\incoming\mytest1.arxml" contains:
1 Application-Software-Component-Type:
'/ComponentTypes/TCalc'
>> createComponentAsModel(ar,'/ComponentTypes/TCalc','ModelPeriodicRunnablesAs','AtomicSubsystem')
After I while the MATLAB command window prompt ">>" does not come back, means an endless loop was executed in the API function createComponentAsModel(…).

Best Answer

This issue was fixed in R2018b to provide a exeption handling message for the user after import failed:
Error using arxml.importer/createComponentAsModel (line 116)
Cannot find DATA-TYPE-MAP that maps application data type
"/AUTOSAR_Platform/ImplementationDataTypes/ApplDataTypes/XYZ1_Appl_TYPE" to an implementation data type.
Error in runme (line 2)
createComponentAsModel(ar,'/ComponentTypes/TCalc','ModelPeriodicRunnablesAs','AtomicSubsystem')
Up to R2018a you can push Ctrl+C in the MATLAB command window to get this error:
>> createComponentAsModel(ar,'/ComponentTypes/TCalc','ModelPeriodicRunnablesAs','AtomicSubsystem')
Operation terminated by user during autosar.mm.Model.findObjectByMetaClass
In autosar.mm.arxml.Exporter.findByBaseType
In autosar.mm.mm2sl.TypeBuilder/buildDataTypeMappings
In autosar.mm.mm2sl.TypeBuilder/createType
Both error point you to the fact that the AUTOSAR XML file ".arxml file
Both error message point you to the fact that ARXML defines application types but provides no map to implementation types. You see an error when importing but I wouldn’t describe it as an endless loop. It looks like a validation error which means the ARXML is incorrect.
The TypeBuilder you see after cancle import with Ctrl+C is the same cause. It is trying to construct the base type be tracing the application type to the underlying implementation type. Since R2018b you get a validation error instead which pointing you to correct the .armxl file.