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.

TMS320F28379D: I have a question about CLA.

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

The CLA program is not loaded in FLASH and asks for help. thanks

The following is the entire project file, asking for help with the diagnosis.

ccpu.rar

  • Hi,

    Can you please be more specific with a question?

    Please see the CLA examples in C2000Ware, and see the linker command files in device_support which includes CLA sections.

    Regards,
    sal
  • I am writing the entire program in assembly language.The CLA program can be executed in RAM during debugging, but it cannot be burned to the specified unit of FLASH.When the power is reset, CLA can't be executed again.

  • Hi,

    In the file you sent you have commented out the two following lines in ccpu.asm:

    initial_cla:
    ;lc			flash_initialize	;FLASH初始化
    ;lc			copyprogramtosram	;搬运程序到CLA程序区

    To run from flash you need to initialize the flash memory and copy the CLA program from there to the desired RAM area.

    Can you check why these two calls are commented out?

  • Thanks, Pierre. Good catch.

    Yes, you need to load the CLA program and data to flash and then perform a memcpy to the proper RAM location. This is similar to how ramfuncs are handled in the linker command file and then copied to RAM in the main application.

    Our CLA examples and CLA linker command files demonstrate how to do this for programs which are loaded to flash.

    Regards,
    sal
  •  
    But the premise is the use of your CMD configuration file, the CLA program can not be loaded into the FLASH, I do not know how to configure the CMD file to solve the problem that can not write CLA to the FLASH problem
  • During debugging, it is found that CLA program has been in RAM, so it has been unable to use these two subroutines.
  • But the premise is the use of your CMD configuration file, the CLA program can not be loaded into the FLASH, I do not know how to configure the CMD file to solve the problem that can not write CLA to the FLASH problem
  • Hi,

    The CLA program and data must first be loaded into flash, for it to remain through a power cycle. The code and data must be programmed into flash. Then your application must perform a memcpy using the symbols provided by the linker, just like ramfuncs.

    I am not sure what the confusion is. Can you explain?

    Regards,
    sal
  • I can not loading the cla program and data into flash .Even if use your CMD. When the file is loading,I found the CLA program and data is in the RAM.
  • Please see 2837xD_FLASH_CLA_lnk_cpi1.cmd.

    The program is loaded to flash. If you have data tables that need to get loaded, you can see the CLA math library linker command files to show you how to load your data to flash and copy to RAM. It is the same way that CLAProg and ramfuncs are handled.

    2837xD_FLASH_CLA_lnk_cpi1.cmd....

    /* CLA specific sections */
    Cla1Prog : LOAD = FLASHD,
    RUN = RAMLS4_5,
    LOAD_START(_Cla1funcsLoadStart),
    LOAD_END(_Cla1funcsLoadEnd),
    RUN_START(_Cla1funcsRunStart),
    LOAD_SIZE(_Cla1funcsLoadSize),
    PAGE = 0, ALIGN(4)

    CLADataLS0 : > RAMLS0, PAGE=1
    CLADataLS1 : > RAMLS1, PAGE=1

    Cla1ToCpuMsgRAM : > CLA1_MSGRAMLOW, PAGE = 1
    CpuToCla1MsgRAM : > CLA1_MSGRAMHIGH, PAGE = 1

    #ifdef CLA_C
    /* CLA C compiler sections */
    //
    // Must be allocated to memory the CLA has write access to
    //
    CLAscratch :
    { *.obj(CLAscratch)
    . += CLA_SCRATCHPAD_SIZE;
    *.obj(CLAscratch_end) } > RAMLS1, PAGE = 1

    .scratchpad : > RAMLS1, PAGE = 1
    .bss_cla : > RAMLS1, PAGE = 1
    .const_cla : LOAD = FLASHB,
    RUN = RAMLS1,
    RUN_START(_Cla1ConstRunStart),
    LOAD_START(_Cla1ConstLoadStart),
    LOAD_SIZE(_Cla1ConstLoadSize),
    PAGE = 1
    #endif //CLA_C
  •  Hello!


    I tried to solve this problem with the method you provided, but the result was a failure. You can debug it according to the project I provided.
    Check to see if the CLA program can be loaded into FLASH.

  • Hello!
    Could you please provide me with a description of how to configure CMD files?
    thank you
  • Hi,

    The best source of information for this topic is the Assembly Language Tools document : SPRU513. The relevant chapter is 8.5 Linker Command Files.

    See http://www.ti.com/lit/ug/spru513k/spru513k.pdf

  • The thing is that your assembly code is in a section called "claprog" which is placed in RAM. You need to do something else, similar to the other section "ClaProg" which you are not using in the current version.

       ClaProg         : LOAD = FLASHD,
                          RUN = RAMLS0,
                          LOAD_START(_Cla1funcsLoadStart),
                          LOAD_END(_Cla1funcsLoadEnd),
                          RUN_START(_Cla1funcsRunStart),
                          LOAD_SIZE(_Cla1funcsLoadSize),
                          PAGE = 0, ALIGN(4)

    If you use this command all the code you allocated to section ClaProg will be copied in the flash area FLASHD but the symbols (e.g callable functions, etc.) will have their address in the RAM area RAMLS0. Furthermore the linker will define global symbols _Cla1funcsLoadStart, _Cla1funcsLoadEnd, _Cla1funcsRunStart. 

    You will then need to use these global symbols to copy the data from the flash range (_Cla1funcsLoadStart, _Cla1funcsLoadEnd) to the RAM range (_Cla1funcsRunStart, _Cla1funcsRunStart + _Cla1funcsLoadSize).

    It seems that you have a custom function copyprogramtosram but it doesn't look like a mere sequential copy of the CLA code.

  • Thank you, but how should I do it in the existing procedure?

  • Pierre, good answer.

    Please see the cla example including the CLA math examples which have flash build configurations. They demonstrate how to do this.

    Regards,
    sal