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.

Where is .vec section coming from?

Other Parts Discussed in Thread: LM3S3634, SYSBIOS

Hi,

I am trying to create binary file as an output from my code for an LM3S3634.  I am using TI BIOS.  For some reason, the generated linker command file is creating a .vecs section and I'm not sure what its purpose is.  I would like to remove it, but I don't know how.  Below is posted the majority of my linker.CMD file and also my project .cfg file.

Peter

LINKER.CMD

/*

* 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:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\hal\lib\whole_program_debug\ti.sysbios.hal.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\knl\lib\whole_program_debug\ti.sysbios.knl.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\gates\lib\whole_program_debug\ti.sysbios.gates.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\xdcruntime\lib\whole_program_debug\ti.sysbios.xdcruntime.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\lib\whole_program_debug\ti.sysbios.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\family\arm\m3\lib\whole_program_debug\ti.sysbios.family.arm.m3.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\family\arm\lm3\lib\whole_program_debug\ti.sysbios.family.arm.lm3.aem3"

-l"C:\Program Files\Texas Instruments\xdctools_3_20_08_88\packages\ti\targets\arm\rtsarm\lib\ti.targets.arm.rtsarm.aem3"

-l"C:\Program Files\Texas Instruments\xdctools_3_20_08_88\packages\ti\targets\arm\rtsarm\lib\boot.aem3"

-l"C:\Program Files\Texas Instruments\xdctools_3_20_08_88\packages\ti\targets\arm\rtsarm\lib\auto_init.aem3"

--retain="*(xdc.meta)"

 

/* C6x Elf symbols */

--symbol_map __TI_STACK_SIZE=__STACK_SIZE

--symbol_map __TI_STACK_BASE=__stack

--symbol_map _stack=__stack

 

 

 

--args 0x200

-heap 0x1000

-stack 0x1000

MEMORY

{

IRAM (RWX) : org = 0x20000000, len = 0x8000

FRAM (RWX) : org = 0x0, len = 0x20000

}

/*

* 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.rov (null): */

/* Content from ti.catalog.arm.cortexm3 (null): */

/* Content from ti.catalog.peripherals.hdvicp2 (null): */

/* Content from ti.catalog (null): */

/* Content from ti.catalog.arm.peripherals.timers (null): */

/* Content from xdc.platform (null): */

/* Content from xdc.cfg (null): */

/* Content from ti.platforms.generic (null): */

/* Content from LM3S3634 (null): */

/* Content from ti.targets.arm.rtsarm (null): */

/* Content from ti.sysbios.family.arm.lm3 (null): */

/* Content from ti.sysbios.interfaces (null): */

/* Content from ti.sysbios.family.arm.m3 (ti/sysbios/family/arm/m3/linkcmd.xdt): */

--retain "*(.resetVecs)"

/* Content from ti.sysbios (null): */

/* Content from ti.sysbios.xdcruntime (null): */

/* Content from xdc.runtime.knl (null): */

/* Content from ti.sysbios.gates (null): */

/* Content from ti.sysbios.knl (null): */

/* Content from ti.sysbios.family (null): */

/* Content from ti.sysbios.family.arm (ti/sysbios/family/arm/linkcmd.xdt): */

--retain "*(.vecs)"

/* Content from ti.sysbios.hal (null): */

/* Content from xdc.runtime (null): */

/* Content from configPkg (null): */

 

/*

* symbolic aliases for static instance objects

*/

xdc_runtime_Startup__EXECFXN__C = 1;

xdc_runtime_Startup__RESETFXN__C = 1;

TSK_idle = ti_sysbios_knl_Task_Object__table__V + 68;

SECTIONS

{

.cio: load >> IRAM

GROUP: load > IRAM

{

.bss:

.neardata:

.rodata:

}

xdc.meta: load >> FRAM, type = COPY

.text: load >> FRAM

.far: load >> IRAM

.taskStackSection: load >> IRAM

.sysmem: load > IRAM

.cinit: load > FRAM

.init_array: load > FRAM

.resetVecs: load > 0x0

.args: load > IRAM align = 0x4, fill = 0 {_argsize = 0x200; }

.bootVecs: type = NOLOAD

.switch: load >> IRAM

.data: load >> IRAM

.stack: load > IRAM

.vecs: load > 0x20000000

.fardata: load >> IRAM

.const: load >> FRAM

}

LM3S3634.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:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\hal\lib\whole_program_debug\ti.sysbios.hal.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\knl\lib\whole_program_debug\ti.sysbios.knl.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\gates\lib\whole_program_debug\ti.sysbios.gates.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\xdcruntime\lib\whole_program_debug\ti.sysbios.xdcruntime.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\lib\whole_program_debug\ti.sysbios.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\family\arm\m3\lib\whole_program_debug\ti.sysbios.family.arm.m3.aem3"

-l"C:\Program Files\Texas Instruments\bios_6_30_03_46\packages\ti\sysbios\family\arm\lm3\lib\whole_program_debug\ti.sysbios.family.arm.lm3.aem3"

-l"C:\Program Files\Texas Instruments\xdctools_3_20_08_88\packages\ti\targets\arm\rtsarm\lib\ti.targets.arm.rtsarm.aem3"

-l"C:\Program Files\Texas Instruments\xdctools_3_20_08_88\packages\ti\targets\arm\rtsarm\lib\boot.aem3"

-l"C:\Program Files\Texas Instruments\xdctools_3_20_08_88\packages\ti\targets\arm\rtsarm\lib\auto_init.aem3"

--retain="*(xdc.meta)"

 

/* C6x Elf symbols */

--symbol_map __TI_STACK_SIZE=__STACK_SIZE

--symbol_map __TI_STACK_BASE=__stack

--symbol_map _stack=__stack

 

 

 

--args 0x200

-heap 0x1000

-stack 0x1000

MEMORY

{

IRAM (RWX) : org = 0x20000000, len = 0x8000

FRAM (RWX) : org = 0x0, len = 0x20000

}

/*

* 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.rov (null): */

/* Content from ti.catalog.arm.cortexm3 (null): */

/* Content from ti.catalog.peripherals.hdvicp2 (null): */

/* Content from ti.catalog (null): */

/* Content from ti.catalog.arm.peripherals.timers (null): */

/* Content from xdc.platform (null): */

/* Content from xdc.cfg (null): */

/* Content from ti.platforms.generic (null): */

/* Content from LM3S3634 (null): */

/* Content from ti.targets.arm.rtsarm (null): */

/* Content from ti.sysbios.family.arm.lm3 (null): */

/* Content from ti.sysbios.interfaces (null): */

/* Content from ti.sysbios.family.arm.m3 (ti/sysbios/family/arm/m3/linkcmd.xdt): */

--retain "*(.resetVecs)"

/* Content from ti.sysbios (null): */

/* Content from ti.sysbios.xdcruntime (null): */

/* Content from xdc.runtime.knl (null): */

/* Content from ti.sysbios.gates (null): */

/* Content from ti.sysbios.knl (null): */

/* Content from ti.sysbios.family (null): */

/* Content from ti.sysbios.family.arm (ti/sysbios/family/arm/linkcmd.xdt): */

--retain "*(.vecs)"

/* Content from ti.sysbios.hal (null): */

/* Content from xdc.runtime (null): */

/* Content from configPkg (null): */

 

/*

* symbolic aliases for static instance objects

*/

xdc_runtime_Startup__EXECFXN__C = 1;

xdc_runtime_Startup__RESETFXN__C = 1;

TSK_idle = ti_sysbios_knl_Task_Object__table__V + 68;

SECTIONS

{

.cio: load >> IRAM

GROUP: load > IRAM

{

.bss:

.neardata:

.rodata:

}

xdc.meta: load >> FRAM, type = COPY

.text: load >> FRAM

.far: load >> IRAM

.taskStackSection: load >> IRAM

.sysmem: load > IRAM

.cinit: load > FRAM

.init_array: load > FRAM

.resetVecs: load > 0x0

.args: load > IRAM align = 0x4, fill = 0 {_argsize = 0x200; }

.bootVecs: type = NOLOAD

.switch: load >> IRAM

.data: load >> IRAM

.stack: load > IRAM

.vecs: load > 0x20000000

.fardata: load >> IRAM

.const: load >> FRAM

}

 

  • Peter,

    This specifies the placement of your interrupt vector table.

    Why do you want to remove it?

  • I am developing with an LM3S3634 using Code Composer Studio 4.2 and I have set up a post build step to create a .bin file output.  Here is the command:

    "${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/ofd470.exe" "${CG_TOOL_ROOT}/bin/hex470.exe" "${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe"

    It seems to be working correctly, except that the .bin file is 524MB in size.  The first 700K is the correct data, and the rest is all 0s.  Investigation revealed that the .vecs memory section is the culprit, as it is initialized memory but stored in RAM (starting at address 0x20000000). All the other initialized memory sections are located in flash (starting at 0x0).

    The reason of the file size is because the .bin file is an extremely simple binary format. There is no mechanism by which I can compactly represent holes in memory and filling them with zero is the only option.

    Therefore, to get a small .bin file all of the initialized sections must be close to each other in memory. Any gaps between them are filled with zeros.

    Should the .vecs section be in RAM?  Thanks,

    Peter

  • Rafael -- can you please close that other thread and we can work the issue here.  Having 2 threads makes it hard to manage.

    Peter -- Alan and I discussed and reviewed the vector table definition -- which is a C structure in our generated .c file (search for .vecs in that file) -- and we don't understand why this section is initialized.   The structure is like other C structures and has initial values but these initial values should be filled in during boot time by .cinit processing and not load time.

    There are 2 possible workarounds:

    (1)  add this line to your .cfg file to exclude the generation of the .vecs section in the generated .cmd file.

    Program.sectionsExclude = ".vecs";

    The linker can handle more than 1 .cmd file.   You will then need to add a 2nd .cmd file to your project which has something like the following:

    SECTIONS {

        .vecs : > 0x20000000, type = NOLOAD

    }

    This should hopefully mark this section as an uninitialized section and keep the .bin tool from doing what it is doing.

    You might have to do similar with the ".data" section.   When we look at the .map file, we see that these sections are not tagged with the "UNINITIALIZED" keyword like we see for the .bss section.  Not sure why these are different.  All of them have C data structures that are initialized by cinit.

    .bss       0    20000140    000031f4     UNINITIALIZED
                      20000140    00002000     clock_pem3.oem3 (.bss:ti_sysbios_heaps_HeapMem_Instance_State_0_buf__A)
                      20002140    00000800     clock_pem3.oem3 (.bss:taskStackSection)

     

    (2)  We place the vectors at 0x20000000 by default since this is RAM and we allow dynamic interrupt vector plugging.   We update the NVIC (or whatever) to point to 0x20000000.    If your application does not require you to change the interrupts at runtime, then you can add the following line to your .cfg script which will leave the vectors at 0x0.

    Hwi.vectorTableAddress = 0x0;

     

     

  • Thanks for the help.  Where do I add the linker file?  I added it under Properties->CSS Build->General Tab, "Linker Command File".  This gives me a compile error that CSS can't find the compiler.

  • just add the .cmd file to your project.  CCS will know it's a linker .cmd file because of the .cmd extension.

  • Peter --

    We've been looking at this more and think the root of the problem is actually the .args section.   This section is used for command line arguments to main() (argc,argv) which you probably aren't using.    .args is an initialized section.  I bet that this is causing that big fill and the huge .bin file.


    Let's call this workaround #3.  I think this is better than (1) or (2).

    (3)  Try adding this to your .cfg file and I think you'll be in better shape:

    Program.argSize = 0x0;

     

    -Karl-

     

  • Solution 3 worked!  Thanks Karl and Rafael!  I now have a post build script that creates a correct size binary file.

  • I know this is an old post, however I have the same issue on a program not using the RTSC - Bin file is 524K.
    If I add a CFG file I need to add the RTSC and Tivaware.
    How do I get the Args to be 0 without adding the RTSC or is this not possible?
  • Barry,

    Since your question is non TI-RTOS (non RTSC) question. Can you please post the question in the Compiler Forum for a quicker response?

    e2e.ti.com/.../

    Vikram