How to generate "VAL_BLK" instead of "ARRAY" in arxml-files?

5 次查看(过去 30 天)
For an SWC-model which contains array cal-params (AUTOSAR4.Parameter), EC normally generates arxml where the params refer to an "ARRAY" Application-data-Type. Such an APPLICATION-ARRAY-DATA-TYPE has a certain number of VALUE elements. In the Calibration tool, each element will be instrumented as an individual scalar. The generated arxml normally looks similar to this example:
<DATA-TYPE-MAP>
<APPLICATION-DATA-TYPE-REF DEST="APPLICATION-ARRAY-DATA-TYPE">/Demo/ApplDataTypes/rt_Array_UInt8_12</APPLICATION-DATA-TYPE-REF>
<IMPLEMENTATION-DATA-TYPE-REF DEST="IMPLEMENTATION-DATA-TYPE">/Demo/ImplDataTypes/rt_Array_uint8_12</IMPLEMENTATION-DATA-TYPE-REF>
</DATA-TYPE-MAP>
<APPLICATION-ARRAY-DATA-TYPE>
<SHORT-NAME>rt_Array_UInt8_12</SHORT-NAME>
<CATEGORY>ARRAY</CATEGORY>
<SW-DATA-DEF-PROPS/>
<ELEMENT>
<SHORT-NAME>rt_Array_UInt8_12</SHORT-NAME>
<CATEGORY>VALUE</CATEGORY>
<TYPE-TREF DEST="APPLICATION-PRIMITIVE-DATA-TYPE">/Demo/ApplDataTypes/UInt8</TYPE-TREF>
<ARRAY-SIZE-SEMANTICS>FIXED-SIZE</ARRAY-SIZE-SEMANTICS>
<MAX-NUMBER-OF-ELEMENTS>12</MAX-NUMBER-OF-ELEMENTS>
</ELEMENT>
</APPLICATION-ARRAY-DATA-TYPE>
<PARAMETER-DATA-PROTOTYPE>
<SHORT-NAME>Demo_MyParam_CA</SHORT-NAME>
<CATEGORY>ARRAY</CATEGORY>
<TYPE-TREF DEST="APPLICATION-ARRAY-DATA-TYPE">/Demo/ApplDataTypes/rt_Array_UInt8_12</TYPE-TREF>
<!-- ... -->
</PARAMETER-DATA-PROTOTYPE>
In order to instrument such array calibrations as a value-block instead of individual scalars, however, the arxml should use category "VAL_BLK" instead of "ARRAY", like in this example:
<DATA-TYPE-MAP>
<APPLICATION-DATA-TYPE-REF DEST="APPLICATION-PRIMITIVE-DATA-TYPE">/Demo/ApplDataTypes/rt_ValBlk_UInt8_12</APPLICATION-DATA-TYPE-REF>
<IMPLEMENTATION-DATA-TYPE-REF DEST="IMPLEMENTATION-DATA-TYPE">/AUTOSAR_Platform/ImplementationDataTypes/uint8</IMPLEMENTATION-DATA-TYPE-REF>
</DATA-TYPE-MAP>
<APPLICATION-PRIMITIVE-DATA-TYPE>
<SHORT-NAME>rt_ValBlk_UInt8_12</SHORT-NAME>
<CATEGORY>VAL_BLK</CATEGORY>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<SW-VALUE-BLOCK-SIZE>12</SW-VALUE-BLOCK-SIZE>
<COMPU-METHOD-REF DEST="COMPU-METHOD">...</COMPU-METHOD-REF>
<DATA-CONSTR-REF DEST="DATA-CONSTR">...</DATA-CONSTR-REF>
</SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS>
</SW-DATA-DEF-PROPS>
</APPLICATION-PRIMITIVE-DATA-TYPE>
<PARAMETER-DATA-PROTOTYPE>
<SHORT-NAME>Demo_MyParam_CA</SHORT-NAME>
<CATEGORY>VAL_BLK</CATEGORY>
<TYPE-TREF DEST="APPLICATION-PRIMITIVE-DATA-TYPE">/Demo/ApplDataTypes/rt_ValBlk_UInt8_12</TYPE-TREF>
<!-- ... -->
</PARAMETER-DATA-PROTOTYPE>
Question: Is it somehow possible to let the Emedded Coder generate APPLICATION-PRIMITIVE-DATA-TYPE with category "VAL_BLK" (example 2) instead of "APPLICATION-ARRAY-DATA-TYPE" (example 1) ?

采纳的回答

Karan Singh
Karan Singh 2023-9-4
Hi Jochen,
In the context of the Embedded Coder generating “AUTOSAR XML” (arxml) files, it is not directly possible to control the generation of the “APPLICATION-PRIMITIVE-DATA-TYPE” category as "VAL_BLK" instead of "APPLICATION-ARRAY-DATA-TYPE". The category of the data type is determined by the “AUTOSAR” metamodel and the mapping rules defined by MATLAB.
If you want to generate an APPLICATION-PRIMITIVE-DATA-TYPE with the category "VAL_BLK" instead of "APPLICATION-ARRAY-DATA-TYPE", you will need to customize the code generation process. This customization involves modifying the code templates or implementing custom code generation hooks.
Here are a few steps you can consider to achieve this customization:
  • Identify the code generation templates used by the Embedded Coder for generating the AUTOSAR XML files. These templates define the structure and content of the generated “ARXML” files.
  • Locate the template responsible for generating “APPLICATION-ARRAY-DATA-TYPE” elements and modify it to generate “APPLICATION-PRIMITIVE-DATA-TYPE” elements with the desired category "VAL_BLK". This modification should include updating the structure and content of the generated “XML” elements.
  • Implement a custom code generation hook or script to integrate your modified template into the code generation process.
Additionally, you may want to consider the implications of modifying the code generation behaviour. The changes you make should align with the “AUTOSAR” specification and the requirements of your specific project.
Attached below are some documentation links that you may find helpful:
  1. Customize Build Process with STF_make_rtw_hook File - MATLAB & Simulink (mathworks.com)
Hope this helps!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 AUTOSAR Blockset 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by