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 V6 static library problem

Hello,

 

I am using CCS V6 with compiler version TI v6.2.9. The programming device is TMS28335.

I have created two executable projects using different method. The first project A used all the source files(*.c, *.asm) directly, while the second project B used some static libraries which are generated from part of the source files.

 

The output map files(A.map is generated from project A, and B.map is generated from project B) are almost the same except two differences.

  1. The memory configuration of A.map contains "DSP2833x_DisInt.Obj" and "DSP2833x_DBGIER.obj", while the B.map doesn't contain the two obj.

  1. The A.map uses 0x08 words of Section "CSM_PWL" and 0x76 words of section "CSM_RSVD", while the B.map doesn't use them.

 The relevant source files are the following three asm files:

  1. DSP2833x_DBGIER.asm

  1. DSP2833x_DisInt.asm

  1. DSP2833x_CSMPasswords.asm

I guess the A.map and B.map should be exactly the same. What cause the differences? The building settings?

The cmd file? Or any other reason?

 

Best regards.

  • The linker brings in a file from a library only when that file supplies a function that is called elsewhere.  (The same thing is true if a library file supplies a data object that is used elsewhere.  But that is less common in practice.)  So the symbols like _SetDBGIER and _DSP28x_RestoreInt define functions that are never called.  They are included in the non-library link.  That is because the linker keeps the code from files presented directly, and not from a library.  (This last sentence is not true when you build with EABI.  EABI is presently unavailable with C2800 builds.  That will change soon.)

    Thanks and regards,

    -George

  • Hi, Geroge

    Thanks for your reply.
    The most problem I care about is that the csmpasswds SECTION in "DSP2833x_CSMPasswords.asm" wasn't used when adopting static library project. One way to solve this problem is exclude from build "DSP2833x_CSMPasswords.asm" when generating the corresponding static library, but add the asm source file directly to the project? And is there any other solution to my problem?
  • vesgine said:
    is there any other solution to my problem?

    You can force the linker to bring a file in from a library by using the option --undef_sym=name of global symbol .  That global symbol can be the name of a function, or the beginning of a table of data.  Do not use the name of the section, or the name of the file, but the name of the symbol.  You can read about that option in the C28x assembly language tools manual.

    Thanks and regards,

    -George

  • By using --undef_sym = _SetDBGIER, --undef_sym = _DSP28x_DisableInt and --undef_sym = _DSP28x_RestoreInt, the first problem has been solved. But for the section "CSM_PWL" and section "CSM_RSVD", because --undef_sym can not use the name of section, how to solve this problem?
  • The DSP2833x_CSMPasswords.asm file uses ".int" assembler directive to specify password values into the CSM password location(the "csmpasswords" section). Is this initialization finished before the C-environment init function "_c_int00" called or after? Can I lock the CSM module with C-language not assemble language?
  • vesgine said:
    But for the section "CSM_PWL" and section "CSM_RSVD", because --undef_sym can not use the name of section, how to solve this problem?

    I presume the object files which contain these sections are in a library.  That being the case, the only solution I know is to create global symbols for the start of each of these sections of data.  Then use --undef_sym on each of those symbols.

    Thanks and regards,

    -George

  • vesgine said:
    Is this initialization finished before the C-environment init function "_c_int00" called or after?

    It depends on how the initialization of csmpasswords is implemented.  This is a system start-up issue about which we compiler experts know almost nothing.  In every scenario I can think of, csmpasswords must be initialized before _c_int00 runs.  This is certainly the case if cspasswords is programmed into flash.

    Thanks and regards,

    -George

  • Great!
    The problem is solved. Just as you suggested, I add a global symbols before the sections of data, and then use --undef_sym on that symbol, as below:
    ----------------------------------------------------------------------
    .def _DSP28x_PwlInit

    _DSP28x_PwlInit:
    .sect "csmpasswds"
    ; No Password, Unsecurity
    .int 0xFFFF ;PWL0 (LSW of 128-bit password)
    .int 0xFFFF ;PWL1
    .int 0xFFFF ;PWL2
    .int 0xFFFF ;PWL3
    .int 0xFFFF ;PWL4
    .int 0xFFFF ;PWL5
    .int 0xFFFF ;PWL6
    .int 0xFFFF ;PWL7 (MSW of 128-bit password)
    ----------------------------------------------------------------------
    Finally, the two map files are exactly the same!
    Thank you very much!