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.

Purpose of .resetVecs, .vecs, and .intvecs Sections

I have a CCS TI-RTOS project built for a TM4C129X MCU. In my map file I have the following:

SEGMENT ALLOCATION MAP

run origin  load origin   length   init length attrs members
----------  ----------- ---------- ----------- ----- -------
00000000    00000000    000258e8   000258e8    r-x
  00000000    00000000    0000003c   0000003c    r-- .resetVecs
  0000003c    0000003c    0001136a   0001136a    r-x *
...
20000000    20000000    000075d4   00000000    rw-
  20000000    20000000    00000360   00000000    rw- .vecs
...

SECTION ALLOCATION MAP

 output                                  attributes/
section   page    origin      length       input sections
--------  ----  ----------  ----------   ----------------
...
*          0    0000003c    0001136a
                  00004c74    00000200     startup_ccs.obj (.intvecs)
...

I assume that the .resetVecs section is the typical interrupt vector table that is stored in flash, is that correct? What is the .vecs section? What is the .intvecs section?

I looked in the MCU's datasheet and I see that there is a VTABLE register which can be used to relocate the base address of the interrupt vector table. Is the .vecs section where the interrupt vector table's base address is relocated to?

How about the .intvecs section? Is this a second flash-based interrupt vector table?

I looked at the following posts but did not find the answer:

http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/109389/389931
http://e2e.ti.com/support/embedded/tirtos/f/355/t/110251
http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/236361
http://e2e.ti.com/support/embedded/tirtos/f/355/t/108165

Thanks,
Samuel

  • Hi Samuel,

    The vector table used at system reset time is placed in ".resetVecs" section. Since ".resetVecs" is in FLASH, it is not possible to update it at runtime. In order to support dynamic Hwi creation, the vector table needs to be editable. In order to make it editable, during the startup sequence it is copied to RAM into a section called ".vecs" (and the necessary NVIC register is updated to point to the RAM vector table).

    I am not sure where ".intvecs" is coming from since it looks like your app was built with TI tools. If you are using GNU tools then the vector table section name is "intvecs" instead of ".resetVecs". From a SYS/BIOS point of view there are only 2 vector tables - one in the flash used at system reset time and the other in RAM used after the system is up (startup sequence completed).

    Best,
    Ashish
  • Ashish,

    Thanks for the quick reply. You answered my question. As for the .intvecs section. I found the following items in my project:

    linker_ccs.cmd:

    --retain=g_pfnVectors
    ...
    #define APP_BASE 0x00000000
    ...
    SECTIONS
    {
    //.intvecs : > APP_BASE
    ...
    }

    .intvecs is commented out from SECTIONS.

    startup_ccs.c:

    #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
    void (* const g_pfnVectors[])(void) =
    ... (long list of function pointers)

    It looks like at one time the .intvecs section was the interrupt vector table loaded in flash where .resetVecs is now. In my project now though the .intvecs section is commented out of the linker command file so it's not used like this anymore.

    I searched the TI-RTOS code and my project's code for any instances of g_pfnVectors but didn't find any. Maybe this is something that is no longer used in my project. I'll have to check if it can be removed.

    Also, I don't think the g_pfnVectors variable is exclusive to my project, see also:

    http://stackoverflow.com/questions/15207877/lpc-1769cortex-m3-code-red-ide-no-source-available-for-g-pfnvectors-at0x0
    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/300218

    Thanks!

    Samuel
  • Hi Samuel,

    CCS has a bare-metal (non TI-RTOS) "hello world" example for some targets including TM4C129x. This example has a startup_ccs.c file that defines a vector table called g_pfnVectors. I am guessing your project may have leveraged some code from this example and thats how g_pfnVectors got pulled in. Since your project now uses TI-RTOS, I think it should be safe to remove g_pfnVectors.

    Best,
    Ashish