MATLAB Answers

Simulink for Texas Instruments C2000 microcontrollers CLA: cannot open source file "cla_header.h" in the LAUNCHXL-F28379D

31 views (last 30 days)
Gabriel Pauka
Gabriel Pauka on 10 Jan 2021
Answered: Mukul Choudhury on 15 Jun 2021 at 7:13
Dear all,
I am trying to configure the Control Law Accelerator (CLA) for my LAUNCHXL-F28379D launchpad, based on the TMS320F28379D microcontroller. I am getting an error when trying to compile my model:
The "Main Routine - CPU1" works fine, as it was already tested. I included the "CLA Task Trigger", which is triggered by ePWM1. The variable that is passed from "Main Rotine - CPU1" to "Auxiliary Routine - CLA1" is only "theta_e" (for now), and it is defined in the main level by the "Data Store Memory" block. "System Initialize" only turns on two pullup resistors, and have no relevancy here. Excluding the right-side of the model (CLA Task Trigger, its subsystem and the global variable), the model works as intended.
By adding the CLA, even searching a lot, I could not find a solution to the problem caused. The section of the Diagnostic Viewer that describes the error is the one that follows:
"C:/Users/Gabriel/Documents/MATLAB/C2000_Programming/BOOSTXL_3PhGaNInv_Test/BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw/cla_task.cla", line 1: fatal error: cannot open source file "cla_header.h"
1 catastrophic error detected in the compilation of "C:/Users/Gabriel/Documents/MATLAB/C2000_Programming/BOOSTXL_3PhGaNInv_Test/BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw/cla_task.cla".
Compilation terminated.
>> Compilation failure
gmake: *** [cla_task.obj] Error 1
gmake: *** Waiting for unfinished jobs....
"C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/src/MW_c28xIPC.c", line 1342: warning: variable "CheckSTSFlag" is used before its value is set
C:\Users\Gabriel\Documents\MATLAB\C2000_Programming\BOOSTXL_3PhGaNInv_Test\BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\Gabriel\Documents\MATLAB\C2000_Programming\BOOSTXL_3PhGaNInv_Test\BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw>exit 1
### Build procedure for BOOSTXL_3PhGaNInv_Test_CPU1_L4 aborted due to an error.
It seems that the file "cla_header.h" could not be opened. I tried to debug it myself, and have some useful information that might be helpful:
I have worked for several hours in this issue, but it is still persistent. Could anyone help me? How can I effectively implement the CLA in my F28379D launchpad?
Best regards,
Gabriel
  1 Comment
Rob de Kluijver
Rob de Kluijver on 5 May 2021
Hi Gabriel,
I encountered the same problem so I started from scratch. That's a copy of the CPU1 blink example for your board. (I have the same board.) This example builds, loads and blinks. Then I modified it to the first model. This also works. Both LEDs should be blinking. Then I used only the eCAP to trigger the task. This builds and loads. The eCAP is running. I can see that with the logic analyzer on P2. However the CLA task is not started. Next is the removal of the data store from the first test. This results is a your build error. The file is also not present in the build directory. I copied it but it got removed. My solution for the moment is to keep the data store. That solves the building problem. The workaround for the CLA triggering is to also include the interrupt, in my case the CAP1 interrupt, in the interrupt handlers.
My overall conclusion on working with the CCS toolchain and the embedded coder is that both tools have serious problems. The latest CCS toolchain doesn't even work in the IDE. Solution there is to switch to an older version. (10.1) Maybe this is the solution for the embedded coder to. I now have 2021a. I can't remember if I used the CLA in 2019a my previous version.
Regards,
Rob.

Sign in to comment.

Answers (1)

Mukul Choudhury
Mukul Choudhury on 15 Jun 2021 at 7:13
Hi Gabriel,
cla_header.h is the file where the data stores, signals and states accesible by cla are declared. Could you please check, if the file is generated or not in the directory by only generating code.
If not, store the data store in the memory section "CpuToCla1MsgRam". To do so follow the link below:
You have to store the data store in "Cpu1ToCla1MsgRam" through embedded coder dictionary.
The steps are as follows:
1) Go to Apps and open "Embedded Coder". A tab name "code mappings" section will appear on the bottom left hand corner of the simulink window.
2) Ensure "tic2000demospkg" is loaded in your model. If not loaded,
  • Open embedded coder dictionary from C Code -> Code Interface -> Embedded Coder Dictionary.
  • In the embedded coder dictionary select the "tic200demospkg" from the drop down that after clicking on Manage Packages ->refresh and then select load.
3) Click on the "Code Mappings" tab on the bottom left hand corner of Simulink window to enlarge it.
4) For data stores, go to "Data Stores" tab. You will find the data store used in your model. Select the storage class as "CpuToCla1MsgRam" for the data stores going to cla from cpu.
5) Similarly set the storage class for the signals in and out of the cla in the "Signals/States" tab.
Also, I noticed that you mentioned that you are triggering cla task using EPWM interrupt. Please ensure, while doing so you also use the CLA end of the task CPU interrupt to perform some task at the end of CLA task. This is required as the EPWM interrupt flag will not be cleared if you just use the CLA task and future interrupts will be blocked as the EPWM interrupt flag is cleared at the end of the cla task while using the End of the task ISR.
Please don't hesitate to comment if you need any further clarification.
Thanks,
Mukul

Community Treasure Hunt

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

Start Hunting!