This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I have been working on a project that I am hoping to use the Digital Controller Library (DCL). I have followed the directions of the user guide SPRUI31 and the project builds, but the moment a DCL function is called, the program crashes.
I have been using the PSFB project in C2000Ware as a reference to help me understand what is happening and I noticed something interesting when looking at the disassembly. In the reference project, the disassembly matches the .asm files of the DCL. In my project however, an ITRAP0 instruction is present between every single line. Below I have a screen capture of both cases. Any idea what could cause such as difference?
I am running both projects in the same hardware on a F280049 with the same XDS200. I am using the same version of CCS (10.1.1.00004), compiler (TI v20.2.1.LTS).
Any help or suggestions that can point me in the right direction is really appreciated.
Best regards,
Luccas
In my project however, an ITRAP0 instruction is present between every single line.
The addresses shown indicate the DCL functions are running in RAM.
The C2000 Digital Control Library Version 3.3 User’s Guide contains:
DCL functions which run on the FPU32 or C28x core can be allocated to a specific memory block in the linker command file. It is common to place the controller functions in zero wait-state internal RAM since this allows them to run at the maximum speed of the device. Note that all CLA functions must run from internal zero wait-state RAM.
All DCL library functions are placed in the user defined code section .dclfuncs. An example showing how this section might be mapped into the internal L4 RAM memory block is shown below.dclfuncs : > RAML4, PAGE = 0
See also the linker command file F28069_DCL.cmd in the project examples (chapter 5). In a stand-alone application, code must be stored in non-volatile memory (such as internal flash) and copied into RAM at run-time. For information on how to do this, refer to the application note “Running an Application from I
In the reference project, the disassembly matches the .asm files of the DCL.
I expect the reference project has code to copy the DCL functions from flash to RAM, but that is missing in your project.
Hi Luccas,
As Chester pointed out, the memory range you showed in your project (RAM) are all 0x0000, the purple wording only shows the reference / expected program and the blue instructions are actual disassembly.
If you are building a FLASH program (load to Flash and run in RAM), you will need to put the DCL assembly functions into the group to be copied from Flash to RAM at start-up. DCL library put all asm functions into a section called "dclfuncs". You should add the program to copy it, maybe together with ".TI.ramfunc" like below. Please make sure to replace the LOAD and RUN section to the one you selected. Thanks.
GROUP
{
.TI.ramfunc
dclfuncs
} LOAD = FLASH_BANK0_SEC6,
RUN = RAMGS0GS1,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
PAGE = 0, ALIGN(4)
Han
Hi Chester,
Thank you for the help. My linker was correctly mapped in the linker, but I was not copying from flash to RAM. I added the following memcpy to my device initialization routine and now the DCL functions work as expected.
memcpy(&isrcodefuncsRunStart, &isrcodefuncsLoadStart,
(size_t)&isrcodefuncsLoadSize);
Thanks again the help!
Luccas
Hi Han,
Indeed I am building a flash program. I had added the dclfuncs to my linker file but I was not copying it from flash to RAM during initialization. Once I addressed that, the DCL functions worked as expected.
Thank you for your help!
Luccas