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.

TMS320C6655: .cinit entry for const in JPEG encoder

Part Number: TMS320C6655


Tool/software: TI C/C++ Compiler

why 'const' is initialized in .cinit?

I Have a application, before  jpgealg_ti.le66 (http://software-dl.ti.com/dsps/dsps_public_sw/codecs/C6678/JPEG_E/latest/index_FDS.html). is linked in, load time address and runtime address for 'const' are the same, 'const' do not rely on .cinit to be initialized. But once jpgealg_ti.le66 is linked in, 'const' become uninitialized, the linker generate an entry in __TI_cinit_table  to initialize 'const'

__TI_cinit_table @ 822b71b8 records: 10, size/record: 8, table size: 80
 .const: load addr=822b1720, load size=0000524a bytes, run addr=80024040, run size=00005ac8 bytes, compression=rle

GanZ

  • I need to see how the .const output section changed when you added that library.  Please attach the most recent linker map file to your next post.  So the system will accept it, add the file extension .txt to it.

    Thanks and regards,

    -George

  • 1. map file(linked with jpgealg_ti.le66)

    TestAppEncoder_w_jepglib.txt

    2. map file(linked without jpgealg_ti.le66)

    TestAppEncoder_wo_jepglib.txt

    3. cfg file

    /* Modules*/
    var Settings = xdc.useModule('ti.sdo.ipc.family.Settings');
    var Cache    = xdc.useModule('ti.sysbios.family.c66.Cache');
    var Task = xdc.useModule ("ti.sysbios.knl.Task");
    var BIOS = xdc.useModule ("ti.sysbios.BIOS");
    var Ipc      = xdc.useModule('ti.sdo.ipc.Ipc');
    
    
    /* specify stack size */
    Program.stack   = 0x2000;
    
    /* specify heap size */
    BIOS.heapSize    = 0xf000;
    
    /* Exclude sections when needed */
    Program.sectionsExclude = "^\.far$";
    
    
    
    

    4. linker file generated by the cfg 

    /*
     * Do not modify this file; it is automatically generated from the template
     * linkcmd.xdt in the ti.targets.elf package and will be overwritten.
     */
    
    /*
     * put '"'s around paths because, without this, the linker
     * considers '-' as minus operator, not a file name character.
     */
    
    
    -l"C:\temp\c66x_jpegenc\packages\ti\sdo\codecs\jpegenc\App\Client\Build\TestAppEncoder\Debug\configPkg\package\cfg\JpegEncApp6678_pe66.oe66"
    -l"C:\ti\ipc_1_24_00_16\packages\ti\sdo\ipc\lib\instrumented_e66\ipc\ipc.lib"
    -l"C:\temp\c66x_jpegenc\packages\ti\sdo\codecs\jpegenc\App\Client\Build\TestAppEncoder\src\sysbios\sysbios.ae66"
    -l"C:\ti\bios_6_46_00_23\packages\ti\targets\rts6000\lib\ti.targets.rts6000.ae66"
    -l"C:\ti\bios_6_46_00_23\packages\ti\targets\rts6000\lib\boot.ae66"
    
    --retain="*(xdc.meta)"
    
    
    --args 0x0
    -heap  0x0
    -stack 0x2000
    
    MEMORY
    {
        MSMCSRAM (RWX) : org = 0xc000000, len = 0xffff0
        L2SRAM (RWX) : org = 0x800000, len = 0x80000
        L2BOOT (RWX) : org = 0x880000, len = 0x80000
        DDR3 (RWX) : org = 0x80000000, len = 0x13c00000
    }
    
    /*
     * Linker command file contributions from all loaded packages:
     */
    
    /* Content from xdc.services.global (null): */
    
    /* Content from xdc (null): */
    
    /* Content from xdc.corevers (null): */
    
    /* Content from xdc.shelf (null): */
    
    /* Content from xdc.services.spec (null): */
    
    /* Content from xdc.services.intern.xsr (null): */
    
    /* Content from xdc.services.intern.gen (null): */
    
    /* Content from xdc.services.intern.cmd (null): */
    
    /* Content from xdc.bld (null): */
    
    /* Content from ti.targets (null): */
    
    /* Content from ti.targets.elf (null): */
    
    /* Content from xdc.rov (null): */
    
    /* Content from xdc.runtime (null): */
    
    /* Content from ti.targets.rts6000 (null): */
    
    /* Content from ti.sdo.ipc.family (null): */
    
    /* Content from ti.sysbios.interfaces (null): */
    
    /* Content from ti.sysbios.family (null): */
    
    /* Content from xdc.services.getset (null): */
    
    /* Content from xdc.runtime.knl (null): */
    
    /* Content from ti.sdo.ipc.interfaces (null): */
    
    /* Content from ti.sysbios.family.c62 (null): */
    
    /* Content from ti.sysbios.family.c64p.tci6488 (null): */
    
    /* Content from ti.catalog.c6000 (null): */
    
    /* Content from ti.catalog (null): */
    
    /* Content from ti.catalog.peripherals.hdvicp2 (null): */
    
    /* Content from xdc.platform (null): */
    
    /* Content from xdc.cfg (null): */
    
    /* Content from ti.platforms.generic (null): */
    
    /* Content from Banner.platforms.NextGen (null): */
    
    /* Content from ti.sysbios (null): */
    
    /* Content from ti.sysbios.rts (ti/sysbios/rts/linkcmd.xdt): */
    
    /* Content from ti.sysbios.rts.ti (ti/sysbios/rts/ti/linkcmd.xdt): */
    
    /* Content from ti.sysbios.family.c64p (ti/sysbios/family/c64p/linkcmd.xdt): */
    
    /* Content from ti.sysbios.knl (null): */
    
    /* Content from ti.sysbios.timers.timer64 (null): */
    
    /* Content from ti.sysbios.family.c66 (ti/sysbios/family/c66/linkcmd.xdt): */
    ti_sysbios_family_c66_Cache_l1dSize = 32768;
    ti_sysbios_family_c66_Cache_l1pSize = 32768;
    ti_sysbios_family_c66_Cache_l2Size = 524288;
    
    /* Content from ti.sysbios.hal (null): */
    
    /* Content from ti.sysbios.gates (null): */
    
    /* Content from ti.sysbios.syncs (null): */
    
    /* Content from ti.sysbios.xdcruntime (null): */
    
    /* Content from ti.sysbios.heaps (null): */
    
    /* Content from ti.sysbios.utils (null): */
    
    /* Content from ti.sdo.utils (null): */
    
    /* Content from ti.sdo.ipc.nsremote (null): */
    
    /* Content from ti.sdo.ipc (ti/sdo/ipc/linkcmd.xdt): */
    
    SECTIONS
    {
    }
    
    
    /* Content from ti.sdo.ipc.notifyDrivers (null): */
    
    /* Content from ti.sdo.ipc.heaps (null): */
    
    /* Content from ti.sdo.ipc.transports (null): */
    
    /* Content from ti.sdo.ipc.gates (null): */
    
    /* Content from configPkg (null): */
    
    /* Content from xdc.services.io (null): */
    
    
    /*
     * symbolic aliases for static instance objects
     */
    xdc_runtime_Startup__EXECFXN__C = 1;
    xdc_runtime_Startup__RESETFXN__C = 1;
    
    SECTIONS
    {
        .text: load >> DDR3
        .ti.decompress: load > DDR3
        .stack: load > DDR3
        GROUP: load > DDR3
        {
            .bss:
            .neardata:
            .rodata:
        }
        .cinit: load > DDR3
        .pinit: load >> DDR3
        .init_array: load > DDR3
        .const: load >> DDR3
        .data: load >> DDR3
        .fardata: load >> DDR3
        .switch: load >> DDR3
        .sysmem: load > DDR3
        .args: load > DDR3 align = 0x4, fill = 0 {_argsize = 0x0; }
        .cio: load >> DDR3
        .ti.handler_table: load > DDR3
        .c6xabi.exidx: load > DDR3
        .c6xabi.extab: load >> DDR3
        .vecs: load > DDR3
        xdc.meta: load > DDR3, type = COPY
    
    }
    

    GanZ

  • I can partially explain what happened.  I cannot, however, tell you the best way to fix it.

    The section .const is normally a RO (read-only) section.  RO sections are not subject to .cinit handling of initialized RW (read-write) sections like .fardata and .neardata.   The input section .const:JPEGIENC_TI_dSect from the library jpgealg_ti.le66 is a RW section.  When it gets combined with the rest of .const, this causes .const to change from being RO to RW.  And that makes it subject to .cinit handling like .fardata and .neardata.

    I think there is a way to configure how that library is linked in so that the section .const:JPEGIENC_TI_dSect from the library jpgealg_ti.le66 is not combined with the general .const section.  Instead, it is placed in its own output section, which is allocated separately from .const.  Then only this one small section, and not all of .const, gets the .cinit handling.  However, I don't know the details of that configuration.  The experts on that JPEG encoder should be able to help.  I understand the best way to contact those experts is by using the forum for the related device.  So, I will move this thread to the Keystone Multicore Forum.

    Thanks and regards,

    -George

  • George,

    Creating a separated memory section for .const:JPEGIENC_TI_dSect solve the problem. Though .const:JPEGIENC_TI_dSect is still in cinit, but const for the rest of system is not in cinit anymore.

    GanZ