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.

TMS570LC4357: Missing .intvecs section in .out file

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN, UNIFLASH

Hello, I have a simular problem that the one explained in https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/917572/compiler-awr1843-interrupt-vector-table-missing-in-hex-file.
We are trying to migrate to cmake based solution and we have succeed to compile and link our already working application with cmake and armcl using a toolchain file.
When trying to run the application, we found the .intvecs sections is missing.

The compilation cmd line executed for .c  files is:

C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\bin\armcl.exe --compile_only --c_file=<A .C FILE>  --include_path=<A INCLUDE PATH> ...  --include_path=C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\include -mv7R5 --code_state=32 --float_support=VFPv3D16 --define=_VFP_SUPPORT_=1 --define=_TMS570LC43x_ --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --c99 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --enum_type=packed --parallel=8 --abi=eabi --preproc_with_compile --preproc_dependency=<A FILE PATH>.obj.d --output_file=<A FILE PATH>.obj

The compilation cmd line executed for .asm  files is:

 C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\bin\armcl.exe --compile_only --asm_file=<A .ASM FILE> --include_path=<A INCLUDE PATH> ... -mv7R5 --code_state=32 --float_support=VFPv3D16 --define=_VFP_SUPPORT_=1 --define=_TMS570LC43x_ --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --c99 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --enum_type=packed --parallel=8 --abi=eabi --preproc_with_compile --preproc_dependency=<A FILE PATH>.asm.obj.d --output_file=<A FILE PATH>.asm.obj

Both seems to properly compile.

The linking cmd line is

 cmd.exe /C "cd . && C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\bin\armcl.exe -mv7R5 --code_state=32 --float_support=VFPv3D16 --define=_VFP_SUPPORT_=1 --define=_TMS570LC43x_ --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --c99 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --enum_type=packed --parallel=8 --abi=eabi --run_linker --output_file=PCC.out --map_file=<A FILE NAME>.map  <OBJECT FILES> <LINKER CMD FILE> <LIBRARIES> C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\lib\libc.a && cd ."

the linker cmd file is:

//*****************************************
// Linker Command File                                                    
//*****************************************
// This file contains the linker options to use
// it also configures the ecc, memory and sections

--retain="*(.intvecs)"
--reread_libs
--warn_sections
--ecc=on
--xml_link_info=<A NAME>_linkInfo.xml
--rom_model
--be32
--warn_sections
--rom_model
--stack_size=0x8000
--heap_size=0x8000
//--unused_section_elimination=on

MEMORY
{
    VECTORS  (X)  : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
    FLASH0   (RX) : origin=0x00000020 length=0x003FFFE0 vfill = 0xffffffff
    STACKS   (RW) : origin=0x08000000 length=0x0000b800
    RAM      (RW) : origin=0x0800b800 length=0x00074800
    ECC_VEC  (R)  : origin=0xf0400000 length=0x4 ECC={ input_range=VECTORS }
    ECC_FLA0 (R)  : origin=0xf0400000 + 0x4 length=0x7FFFC ECC={ input_range=FLASH0 }
}

ECC
{
   algo_name : address_mask = 0xfffffff8
   hamming_mask = R4
   parity_mask = 0x0c
   mirroring = F021
}

SECTIONS
{
    .intvecs : {} > VECTORS
    .text   align(32) : {} > FLASH0
    .const  align(32) : {} > FLASH0
    .cinit  align(32) : {} > FLASH0
    .pinit  align(32) : {} > FLASH0
    .bss     : {} > RAM
    .data    : {} > RAM
    .sysmem  : {} > RAM
}

The intvects are defined in an asm file like this:

    .sect ".intvecs"
    .arm

;-------------------------------------------------------------------------------
; import reference for interrupt routines

    .ref _c_int00
    .ref _undef
    .ref _svc
    .ref _prefetch
    .ref _dabort
    .ref phantomInterrupt
    .def resetEntry

;-------------------------------------------------------------------------------
; interrupt vectors

resetEntry
        b   _c_int00
        b   _undef
        b   _svc
        b   _prefetch
        b   _dabort
        b   phantomInterrupt
        ldr pc,[pc,#-0x1b0]
        ldr pc,[pc,#-0x1b0]

The map file does not include the intvecs section:

******************************************************************************

                  TI ARM Linker PC v18.12.4                    
******************************************************************************
>> Linked Mon Jan  9 16:59:53 2023

OUTPUT FILE NAME:   <<A FILE NAME>.out>
ENTRY POINT SYMBOL: "_c_int00"  address: 0001c88c


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  VECTORS               00000000   00000020  00000000  00000020     X (ffffffff)
  FLASH0                00000020   003fffe0  0002422b  003dbdb5  R  X (ffffffff)
  STACKS                08000000   0000b800  00000000  0000b800  RW  
  RAM                   0800b800   00074800  0000acec  00069b14  RW  
  ECC_VEC               f0400000   00000004  00000004  00000000  R   
  ECC_FLA0              f0400004   0007fffc  0007fffc  00000000  R   


SEGMENT ALLOCATION MAP

run origin  load origin   length   init length attrs members
----------  ----------- ---------- ----------- ----- -------
00000020    00000020    00021814   00021814    r-x
  00000020    00000020    00021814   00021814    r-x .text
00021840    00021840    0000294f   0000294f    r--
  00021840    00021840    0000294f   0000294f    r-- .const
000241a0    000241a0    000000c8   000000c8    r--
  000241a0    000241a0    000000c8   000000c8    r-- .cinit
0800b800    0800b800    0000acf0   00000000    rw-
  0800b800    0800b800    00009734   00000000    rw- .bss
  08014f38    08014f38    000015b8   00000000    rw- .data
f0400000    f0400000    00080000   00080000    r--
  f0400000    f0400000    00000004   00000004    r-- .ecc0
  f0400004    f0400004    0007fffc   0007fffc    r-- .ecc1

Defining _intvecs as mentioned in the previous post is not helping me. Any clue would be really appreciated!
Thanks in advance

  • Hi Martin,

    The HL_sys_intvecs.asm is not compiled and linked. By default, the compiler and assembler treat .asm files as assembly source files.

  • Thanks QJ for the answer. Sorry I'm not sure if you are marking an abuse of language (which I agree, asm are not "compiled") or a possible solution (like incorrect usage of armcl).

  • Hi QJ Wang.

    The question from my colleague Martin may be a little hidden among that much information.

    I'd summarize the straight question as "what must be done so that the vectors in the intvects section get properly linked to the VECTORS area?" The linkers seems to be ignoring the vectors.

    Thank you.

  • Hi Txema,

    In your ARMCL command line, I don't see the source files (*.c and *.asm) and linker cmd file. 

    If you build the project in CCS, is the .intvecs section generated?

    I built one CCS project using command line, and get all the sections in map file:

    Compile all *.c and *.asm files:

    C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armcl.exe C:/Users/workspace_v10/TMS570LC43x_rtIBlinky/source/*.c C:/Users/workspace_v10/TMS570LC43x_rtIBlinky/source/*.asm  --compile_only -mv7R5 --code_state=32 --float_support=VFPv3D16 --opt_for_speed=2 --include_path=C:/Users/workspace_v10/TMS570LC43x_rtIBlinky --include_path=C:/Users/workspace_v10/TMS570LC43x_rtIBlinky/include --include_path=C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/include -g --diag_warning=225 --diag_wrap=off --display_error_number --enum_type=packed --abi=eabi

    Link the objects:

    C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armcl.exe *.obj --abi=eabi -z C:/Users/workspace_v10/TMS570LC43x_rtIBlinky/source/HL_sys_link.cmd -mv7R5 --diag_wrap=off --display_error_number -m TMS570LC43x_rtiBlinky_LED.map --heap_size=0x800 --stack_size=0x800 -i C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/lib -i C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/include -l C:\ti\ccs1120\ccs\tools\compiler\ti-cgt-arm_20.2.5.LTS\lib\rtsv7R4_T_be_v3D16_eabi.lib --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info=TMS570LC43x_rtiBlinky_LED_linkInfo.xml --rom_model --be32 -o TMS570LC43x_rtiBlinky_LED.out

    In your compilation and linker option, why do you use --c_file=a.c and --asm_file=a.asm?

  • Thanks for the reply QJ

    we are compiling each of the .c and .asm files and then linking them as mentioned in my first post.
    The command lines are very similar to yours and include the .c, .asm and the linker cmd line.
    These command lines are the product of CMake compiler definition and toolchian, they are not exactly the same, but I supposed them to be proven by other users of CMake already. Do you think the difference in order or the usage of  --c_file in the cmd line regarding yours could be the cause?

    I have checked and all the .c and .asm files are properly compiled and passed to the linker.

    All the object files product of this compilation are included in the .map file, excepting for the one for the VECTORS section (the
    HL_sys_intvecs.asm.obj) which is not. The VECTORS section is empty.

    Something I have not mentioned in my previous post because I don´t think is the cause: the obj files are linked into libraries and then into the binary:
    * BSP.a (including HALCoGen and our own bsp sources, includes the .asm files)
    * Logic.a (only .c files implementing application logic, they are platform agnostic)
    * SW binary (including main.c, other .c files for integration fo bsp and logic, the BSP and Logic libraries as dependencies)

    (Others .asm files in BSP.a are included in the .map file, only the one containing the interrupt vectors located in the VECTORS section is missing. only the VECTORS section is empty, the others are properly filled with the objects)

    Recall of the cmd lines:

    C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\bin\armcl.exe --compile_only --c_file=<A .C FILE>  --include_path=<A INCLUDE PATH> ...  --include_path=C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\include -mv7R5 --code_state=32 --float_support=VFPv3D16 --define=_VFP_SUPPORT_=1 --define=_TMS570LC43x_ --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --c99 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --enum_type=packed --parallel=8 --abi=eabi --preproc_with_compile --preproc_dependency=<A FILE PATH>.obj.d

     C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\bin\armcl.exe --compile_only --asm_file=<A .ASM FILE> --include_path=<A INCLUDE PATH> ... -mv7R5 --code_state=32 --float_support=VFPv3D16 --define=_VFP_SUPPORT_=1 --define=_TMS570LC43x_ --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --c99 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --enum_type=packed --parallel=8 --abi=eabi --preproc_with_compile --preproc_dependency=<A FILE PATH>.asm.obj.d --output_file=<A FILE PATH>.asm.obj

    cmd.exe /C "cd . && C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\bin\armcl.exe -mv7R5 --code_state=32 --float_support=VFPv3D16 --define=_VFP_SUPPORT_=1 --define=_TMS570LC43x_ --define=EXTERNAL_SP_INIT --define=SL_REG_INIT_VAL=0u --c99 --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --enum_type=packed --parallel=8 --abi=eabi --run_linker --output_file=PCC.out --map_file=<A FILE NAME>.map  <SW BINARY OBJECT FILES> <LINKER CMD FILE> BSP.a Logic.a C:\ti\ccs930\ccs\tools\compiler\ti-cgt-arm_18.12.4.LTS\lib\libc.a && cd ."

    The <LINKER CMD FILE> is:

    //*****************************************
    // Linker Command File                                                    
    //*****************************************
    // This file contains the linker options to use
    // it also configures the ecc, memory and sections

    --retain="*(.intvecs)"
    --reread_libs
    --warn_sections
    --ecc=on
    --xml_link_info=<A NAME>_linkInfo.xml
    --rom_model
    --be32
    --warn_sections
    --rom_model
    --stack_size=0x8000
    --heap_size=0x8000
    //--unused_section_elimination=on

    MEMORY
    {
        VECTORS  (X)  : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
        FLASH0   (RX) : origin=0x00000020 length=0x003FFFE0 vfill = 0xffffffff
        STACKS   (RW) : origin=0x08000000 length=0x0000b800
        RAM      (RW) : origin=0x0800b800 length=0x00074800
        ECC_VEC  (R)  : origin=0xf0400000 length=0x4 ECC={ input_range=VECTORS }
        ECC_FLA0 (R)  : origin=0xf0400000 + 0x4 length=0x7FFFC ECC={ input_range=FLASH0 }
    }

    ECC
    {
       algo_name : address_mask = 0xfffffff8
       hamming_mask = R4
       parity_mask = 0x0c
       mirroring = F021
    }

    SECTIONS
    {
        .intvecs : {} > VECTORS
        .text   align(32) : {} > FLASH0
        .const  align(32) : {} > FLASH0
        .cinit  align(32) : {} > FLASH0
        .pinit  align(32) : {} > FLASH0
        .bss     : {} > RAM
        .data    : {} > RAM
        .sysmem  : {} > RAM
    }

  • Got it. Thanks

    I guess the sys_intvecs.asm is included in your library. Can you please remove this file from your lib, and add it to your project for generating a executable *.out.

  • Ok, some progress. Now the intvecs are filled in the VECTORS section, but the memory is still uninitialized

    map file:


    ******************************************************************************
                      TI ARM Linker PC v18.12.4                    
    ******************************************************************************
    >> Linked Thu Jan 12 09:58:10 2023

    OUTPUT FILE NAME:   <PCC.out>
    ENTRY POINT SYMBOL: "_c_int00"  address: 0001c88c


    MEMORY CONFIGURATION

             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
      VECTORS               00000000   00000020  00000020  00000000     X (ffffffff)
      FLASH0                00000020   003fffe0  0002429f  003dbd41  R  X (ffffffff)
      STACKS                08000000   0000b800  00000000  0000b800  RW  
      RAM                   0800b800   00074800  0000acec  00069b14  RW  
      ECC_VEC               f0400000   00000004  00000004  00000000  R   
      ECC_FLA0              f0400004   0007fffc  0007fffc  00000000  R   


    SEGMENT ALLOCATION MAP

    run origin  load origin   length   init length attrs members
    ----------  ----------- ---------- ----------- ----- -------
    00000000    00000000    000218a8   000218a8    r-x
      00000000    00000000    00000020   00000020    r-x .intvecs
      00000020    00000020    00021888   00021888    r-x .text
    000218c0    000218c0    0000294f   0000294f    r--
      000218c0    000218c0    0000294f   0000294f    r-- .const
    00024220    00024220    000000c8   000000c8    r--
      00024220    00024220    000000c8   000000c8    r-- .cinit
    0800b800    0800b800    0000acf0   00000000    rw-
      0800b800    0800b800    00009734   00000000    rw- .bss
      08014f38    08014f38    000015b8   00000000    rw- .data
    f0400000    f0400000    00080000   00080000    r--
      f0400000    f0400000    00000004   00000004    r-- .ecc0
      f0400004    f0400004    0007fffc   0007fffc    r-- .ecc1


    SECTION ALLOCATION MAP

     output                                  attributes/
    section   page    origin      length       input sections
    --------  ----  ----------  ----------   ----------------
    .intvecs   0    00000000    00000020     
                      00000000    00000020     HL_sys_intvecs.asm.obj (.intvecs)

    and the memory is:

  • It looks like that the code is not loaded properly. Does your PCC project have its own linker cmd file?

  • I'm not sure, cmake generates the eclipse project, so I suppose it does not have another one and it uses the cmd file exposed before:

    The <LINKER CMD FILE> is:

    //*****************************************
    // Linker Command File                                                    
    //*****************************************
    // This file contains the linker options to use
    // it also configures the ecc, memory and sections

    --retain="*(.intvecs)"
    --reread_libs
    --warn_sections
    --ecc=on
    --xml_link_info=<A NAME>_linkInfo.xml
    --rom_model
    --be32
    --warn_sections
    --rom_model
    --stack_size=0x8000
    --heap_size=0x8000
    //--unused_section_elimination=on

    MEMORY
    {
        VECTORS  (X)  : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
        FLASH0   (RX) : origin=0x00000020 length=0x003FFFE0 vfill = 0xffffffff
        STACKS   (RW) : origin=0x08000000 length=0x0000b800
        RAM      (RW) : origin=0x0800b800 length=0x00074800
        ECC_VEC  (R)  : origin=0xf0400000 length=0x4 ECC={ input_range=VECTORS }
        ECC_FLA0 (R)  : origin=0xf0400000 + 0x4 length=0x7FFFC ECC={ input_range=FLASH0 }
    }

    ECC
    {
       algo_name : address_mask = 0xfffffff8
       hamming_mask = R4
       parity_mask = 0x0c
       mirroring = F021
    }

    SECTIONS
    {
        .intvecs : {} > VECTORS
        .text   align(32) : {} > FLASH0
        .const  align(32) : {} > FLASH0
        .cinit  align(32) : {} > FLASH0
        .pinit  align(32) : {} > FLASH0
        .bss     : {} > RAM
        .data    : {} > RAM
        .sysmem  : {} > RAM
    }


  • The sys_startup.c, sys_main.c, sys_intvecs.asm, and link.cmd files should be in your application project rather than the static library. 

    Please use palign(32) instead of align(32) in your link cmd file.

    palign(32) tells the linker to place an output section at an address that falls on an 32-byte boundary, and ensures that the size of the section is a multiple of 32 bytes, and padding space (unused space in this section) is filled with zero (default). This will avoid getting an ECC error when the cache controller grabs a line that is only partially full of data or code. 

  • Thanks QJ

    The sys_startup.c, sys_main.c, sys_intvecs.asm, and link.cmd were already in the main binary project, not in the library after my last trial.
    I will change paling too thanks for the tip.

    Any other idea of what could be the source of the vectors not being filled?
    Kind regards

  • I am not able to reproduce this problem.

  • Hello,

    Sorry for the late reply.
    I have made a little progress here. I have dump the .obj and .out files and the intvec section is properly initialized.
    I tried to upload it using uniflash and the initvecs shown by the dump are actually in the memory with the same values. But my app do not work, so I tried to debug using CCS the external .out file, and probably there is when I got lost. It is possible the loader is failing to load the .out file into the target properly and I was running memory that was just there.
    So it seems that is how I'm trying to debug in target that is creating this issue. Do you have any "how to" on debug external compiled .out files with CCS?
    Thanks in advance

    Left side: dump of .out file compiled with CCS
    Right Side: dump of .out file compiled with cmake toolchain

  • The opcodes (in both panels (left right)) for the instructions used in sys_intvecs.asm are correct.

    bit[31:28] E -- condition field, E=always

    bit[27:24] B --> opcode, B = b

    bit[23:0] address offset

  • great. Do you known how to debug this .out file in target then?

  • Sorry for my typo:

    bit[27:24] opcode --> B = Branch with Link, A=Branch

    branch addressL (offset << 2) + 8

    So ea0108c1 --> branch addr is b (0x0108c1<<2 + 8) = 0x4230C

    Can you change the code in sys_invecs.asm and generate a new out file?

    1. change b _c_int00 t b #-8

    2. recompile and get a new out file

    3. load the new out file to flash using CCS

    4. after loaded, click CCS System Reset

    5. open CCS Disassembly window

    6. add a breakpoint at  0x7221 << 2 + 8  (_c_int00), click "Move To Line"

    7. then use assembly step into or assembly step over to debug your code 

  • I cannot make "3 - load the new out file to flash using CCS". I have tried several ways and configurations.
    Any wiki where I can find some info on how to make it work for sure?