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.

CCS/TMS320F28035: For variable calibration with CCP/XCP, how to allocate calibration variable load address in CMD file?

Part Number: TMS320F28035

Tool/software: Code Composer Studio

For calibration variables, we need define working page, reference page (with default value page).

In CMD file, set a section with load memory, and get the load address variable (void * type). If the calibration is not constant, the load address is as same as run address. But if it's define with variable, it can not direct access the variable to write value(shall use pointer).

When compiler build source code, it will this warning as follow:

Description Resource Path Location Type
#10083-D LOAD placement ignored for "section_xxx":  object is uninitialized F28035.cmd /EB_PMSM_Gen2 line 254 C/C++ Problem.

CCS version: 6.1.3

Compiler version: TI v18.12.1 LTS

How to solved this problem?

  • Your linker command file must have a line similar too ...

        section_xxx : load = FLASH, run = RAM, table(BINIT)

    However, section_xxx is not an initialized section like .text, but uninitialized.  An uninitialized section is only assigned some space for the RUN allocation.  Since nothing is loaded, no load allocation is needed.  To better understand the difference between initialized sections and uninitialized sections, please see the first part of the article Linker Command File Primer.

    Thanks and regards,

    -George

  • I add "table(BINIT)" it still show the warning. Please help me to check the section define.

    Section define:

    Variable use in C code:

    Warnings:

    The #10247 is new warning after add "table(BINIT)"

  • The pictures now show in the page view. I copy the text to here:

    Section Define:

    sec_appSysVars : LOAD = AppSw_NvmDef, RUN = AppSwRam_SysVars, table(BINIT)

    LOAD_START(_memMap_sysVars_loadStart),

    LOAD_END(_memMap_sysVars_loadEnd),

    RUN_START(_memMap_sysVars_ramStart),

    PAGE = 0

    Variable use in C code:

    #define m_MemMap_Sec_SysVars __attribute__ ((section("sec_appSysVars")))

    SysMotoCal_t m_MemMap_Sec_SysVars sys_motorCal =
    {

     ... /* initial values */

    };

     

    Build Warnings:

    #10083-D LOAD placement ignored for "sec_appSysVars":  object is uninitialized

    #10247-D creating output section ".binit" without a SECTIONS specification

  • Because sys_motorCal is not const, the associated section sec_appSysVars is uninitialized.  However, do not rush off and add const.  Depending on how you use sys_motorCal, you may want it to be uninitialized.

    Here is how it works now, without const.  The section sec_appSysVars is uninitialized, and allocated a run address in the memory range AppSwRam_SysVars.  The initial values for sys_motorCal are, per compiler convention, in the section .cinit.  I don't know what memory range .cinit is in, but it is probably in AppSw_NvmDef, or something similar.  Startup code automatically copies the values from .cinit to the run location of sys_motorCal.  

    If anything in sys_motorCal is modified while the program runs, then it cannot be const.  If that is the case, or if you are okay with how everything works now, then change the linker command file line for the section sec_appSysVars  to this ...

        sec_appSysVars > AppSwRam_SysVars, PAGE = 0

    You don't need the rest.  And you won't see the warning diagnostic from the linker.

    If you add const to the definition of sys_motorCal, then the section sec_appSysVars is initialized, allocated a load address in the memory range AppSw_NvmDef, and allocated a run address in the memory range AppSwRam_SysVars.  It is your responsibility to arrange the copy from load to run before anything in sys_motorCal gets referenced.  Since you didn't have the table(BINIT) before, then I presume you have code in your system which uses the symbols created with LOAD_START etc. to perform the copy.  The table(BINIT) is a different way to implement that copy.  I don't know if you want to know the details about it works.

    Thanks and regards,

    -George

  • Dear George:

    Thanks a lot for your help!

    That's the problem, if define as constants, the warning is dismiss, but need using pointer to modify the variable in RAM. If not define as constants, the load address and run address is same.

    The use case is: The variables  value will store to ex-EEPROM in run-time or before power off. It will be load to RAM when power on reset. But we need verify the data after load to RAM, if it's not correct (eg. CRC32 check fail), we need load the default value (store in FLASH). The software is will change the variables in software run-time. In this use case, we just need get the real Load_START address (even it is  in .cinit), but now the address in RAM and as same as RUN address.

    PS: I guess the compiler is not create copy data function for the variable initial value set, It may be a assignment code to initial non-constant variable.

    Jason

  • If you need that much flexibility, it is better to have two arrays explicitly defined in C.  One is const, and the other is not.  When it makes sense, memcpy the const one over to the other, perform the CRC check, etc.

    Thanks and regards,

    -George