MATLAB Answers

C2000 CLA _DWork Variable Creation

16 views (last 30 days)
I am trying to use the CLA on a F28035 using nearly identical examples from provided example scripts. I am attaching the model to this thread. I keep getting CLA compiler errors despite using 'inlining variables' under the optimization tab for the model and 'inlining' the function. I am not sure what else to do at this point as the CLA comiler seems to be very tempermental. The errors I keep getting are below in reference to my model.
IC:/ti/CONTRO~1/libs/math/CLAmath/V4_00_~1/include --output_file="cla_task.obj" "C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla"
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 160: warning: function "rt_hypotf_snf" declared implicitly
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 203: error: identifier "c28035_CAN_CLA_FOC_B" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 259: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 292: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 321: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 332: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 338: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 375: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 408: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 414: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 439: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 445: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
"C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla", line 501: error: identifier "c28035_CAN_CLA_FOC_DWork" is undefined
12 errors detected in the compilation of "C:/Users/ZCampbell/Desktop/c28035_CAN_CLA_FOC_ert_rtw/cla_task.cla".
>> Compilation failure
gmake: *** [cla_task.obj] Error 1
C:\Users\ZCampbell\Desktop\c28035_CAN_CLA_FOC_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\ZCampbell\Desktop\c28035_CAN_CLA_FOC_ert_rtw>exit 1
Error(s) encountered while building "c28035_CAN_CLA_FOC":
### Failed to generate all binary outputs.

Accepted Answer

Zak Campbell
Zak Campbell on 11 Feb 2020
The inputs and outputs in the model that I provided have all inputs assigned as "CPUTOClaMsgRam" and "CLA1ToCPUMsgRam" as has been discussed in the examples provided by Mathworks. I am showing the data attributes that I mention in the snapshots below. This is identical to the examples provided by Mathworks, no? The Code within the CLA function block is nearly identical to the example code provided by mathworks also (i.e. all data storage classes have remained). I feel that the code illustrated in the attached .slx meets the requirements stated in your note above Matthew. What specifically is wrong?
Question for Ventkatesh: Why would the CLA access the Global_Ia_Int variable, when, in the block diagram I have provided, this variable exists outside of the CLA function block?
Venkatesh Chilapur
Venkatesh Chilapur on 13 Feb 2020
A model is usually stuck in external mode configuration when an abrupt disconnect between Host and Target happens running in external mode. In this config, the default parameter behavior is 'Tunable' hence we see DWork variables.

Sign in to comment.

More Answers (1)

Ismail Mussed
Ismail Mussed on 10 Feb 2020
You need to make sure the inputs have storage class "CpuToCla1MsgRam" and the outputs have storage class "Cla1ToCPUMsgRam". Also make sure that your blocks with state such as delays have state attribute set to ClaDataRam.
Here's an excerpt:
"Discrete State Variables
All discrete state variables used inside CLA function-call subsystems must be stored in Cla1DataRam. For example, delay blocks and integrators must be set to use the Cla1DataRam storage class for state variables. See the 'State Attributes' of the Delay block inside cla_subsystem for an example. "

Community Treasure Hunt

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

Start Hunting!