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.

How can I fixed inner symbols' addresses? Like __TI_decompress_rle24, __TI_decompress_rle_core etc.

Other Parts Discussed in Thread: TMS320C6678

I analyzed the disassembly files generated from CCS and found the boot sequence from _c_int00 to main

which invokes these inner functions: including  _auto_init_elf,  __TI_decompress_rle24,  __TI_decompress_rle_core,  __TI_zero_init, __TI_tls_init,  __TI_cpp_init, _args_main(which calls main)

The callgraph is (The indent illustrates the call relationship):

   _c_int00:
          _auto_init_elf:
                __TI_decompress_rle24
                     __TI_decompress_rle_core
               __TI_zero_init
               __TI_tls_init
               __TI_cpp_init
        _args_main
               main (The well-known entry function in C)
        exit

If I want to fix all these inner functions address, how could I do that? i know I can use CODE_SECTION pragma, but it needs the function declaration signature in C.

For example, I can find the declaration signature of _auto_init_elf in "xdctools/packages/ti/targets/rts6000/autoinit.c", which is

       void _auto_init_elf(void)

But how could I find the declaration signature of those function which start with 2 underscores (such as __TI_decompress_rle24, __TI_decompress_rle_core etc).

Beyond using CODE_SECTION pragma to fix the function address, are there any other way (such as linker.cmd script) to fix it?

Thank you very much in advance.

  • Each of those library functions is in its own subsection.  You can specify the section in the linker command file just as you would for a section for which you'd used CODE_SECTION:

    .text:startup { 
        rts*.lib<*>(.text:rle24)
        rts*.lib<*>(.text:rle)
        rts*.lib<*>(.text:ZI)
        rts*.lib<*>(.text:none)
        rts*.lib<*>(.text:tls:init)
        rts*.lib<*>(.text:__TI_cpp_init)
    } > MEM
    

    If you still want to know the C function prototype for these functions, I recommend looking at the source code, which is in a subdirectory in the lib directory in your compiler installation.

    [ Edit: fixed the syntax -- Archaeologist ]

  • Archaeologist said:
    Each of those library functions is in its own subsection.  You can specify the section in the linker command file just as you would for a section for which you'd used CODE_SECTION:
    .text:startup { 
        .text:rle24
        .text:rle
        .text:ZI
        .text:none
        .text:tls:init
        .text:__TI_cpp_init
    } > MEM
    

    For a C++ example on a TMS320C6678 with C6000 compiler v7.4.12, I tried adding that to the Linker Command File SECTIONS to place the start-up code in DDR3 (all other sections are in SHRAM):

    SECTIONS
    {
        .text:startup {
            .text:rle24
            .text:rle
            .text:ZI
            .text:none
            .text:tls:init
            .text:__TI_cpp_init
        } > DDR3
        .text          >  SHRAM
    

    However, that generated the following errors and warnings:

    Description Resource Path Location Type
    #10010 errors encountered during linking; "C6000_startup.out" not built C6000_startup C/C++ Problem
    #10008-D cannot find file C6678_unified.cmd /C6000_startup line 40 C/C++ Problem
    #10008-D cannot find file C6678_unified.cmd /C6000_startup line 39 C/C++ Problem
    #10008-D cannot find file ".text:none" C6678_unified.cmd /C6000_startup line 38 C/C++ Problem
    #10008-D cannot find file ".text:ZI" C6678_unified.cmd /C6000_startup line 37 C/C++ Problem
    #10008-D cannot find file ".text:rle" C6678_unified.cmd /C6000_startup line 36 C/C++ Problem
    #10008-D cannot find file C6678_unified.cmd /C6000_startup line 35 C/C++ Problem
    #10068-D no matching section C6678_unified.cmd /C6000_startup line 39 C/C++ Problem
    #10068-D no matching section C6678_unified.cmd /C6000_startup line 38 C/C++ Problem
    #10068-D no matching section C6678_unified.cmd /C6000_startup line 37 C/C++ Problem
    #10068-D no matching section C6678_unified.cmd /C6000_startup line 36 C/C++ Problem
    #10068-D no matching section C6678_unified.cmd /C6000_startup line 35 C/C++ Problem
    #10068-D no matching section C6678_unified.cmd /C6000_startup line 34 C/C++ Problem

    As an alternative, it is possible to place the startup functions in there own section based upon the object file name, rather than section name:

    SECTIONS
    {
         .text:startup {rts*.lib<autoinit.obj>(.text)
                 rts*.lib<copy_*.obj>(.text)
                 rts*.lib<cpp_init.obj>(.text)
                 rts*.lib<tls.obj>(.text)
                 rts*.lib<args_main.obj>(.text)} > DDR3
    

    The linker map file shows that the .text:startup section then contains the desired functions (plus some trampolines to functions they call):

    .text:startup 
    *          0    80000000    00000520     
                      80000000    00000100     rts6600_elf.lib : autoinit.obj (.text:_auto_init_elf)
                      80000100    00000180                     : copy_decompress_rle.obj (.text:__TI_decompress_rle_core)
                      80000280    000000e0                     : copy_zero_init.obj (.text:decompress:ZI:__TI_zero_init)
                      80000360    00000020                     : copy_decompress_none.obj (.text:decompress:none:__TI_decompress_none)
                      80000380    00000020                     : copy_decompress_rle.obj (.text:decompress:rle24:__TI_decompress_rle24)
                      800003a0    00000010                     : memcpy64.obj ($Tramp$S$$memcpy)
                      800003b0    00000010                     : cpy_tbl.obj ($Tramp$S$$copy_in)
                      800003c0    00000060                     : cpp_init.obj (.text:__TI_cpp_init)
                      80000420    000000c0                     : tls.obj (.text:tls:init:__TI_tls_init)
                      800004e0    00000040                     : args_main.obj (.text:_args_main)

  • I'm sorry, I got the syntax incorrect. I've fixed my post. If what you have in your linker command file is working for you, you might as well keep doing that.