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.

TMS320F28388D: linker cannot locate data structure in section

Part Number: TMS320F28388D

Hello All,

We have a very strange situation that the linker cannot link a structure of 0x98 in size into an output section section that is 0x98.

The linker output looks like this: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section.placement with alignment.blocking fails for section xxx size 0x98page0. Available memory ranges MEM_xxx size 0x98 unused: 0x98 max hole: 0x98

the memory where we plan to locate the section is defined like this:

#define LEN_xxx 0x98

MEM_xxx : origin = 0x0C0000 - LEN_xxx, length = LEN_xxx

Some important facts:

if instead the data structure with size 0x98 we use an array with size 0x98 the linking works fine

if we use 0xA0 and 0xB0 for LEN_xxx and the data structure as input sectiuon the linking does not work

if we use 0xC0 for LEN_xxx and the data structure as input section the linking works ok. After linking complete, when we inspect the map file we can clearly observe that the size of the structure is, as expected, 0x98.

a fuew questions arrize:

1 - why does linking work for an array but not for a data structure of the same size

2 - why does linking work for an arbitrarly higher section size (0xC0) and not for 0xA0 or 0xB0 when the located data is, in this case, 0x98.

If any of you has an idea of why the locating does not work in the first place, please let me know.

We are using the compiler that comes with the code composer studio 10.2

Thank you,

Eugen

  • We have a very strange situation that the linker cannot link a structure of 0x98 in size into an output section section that is 0x98.

    I presume this data structure is defined in one C file.  For that C file, please follow the directions in the article How to Submit a Compiler Test Case.  While I am not certain, I am confident I can use that to reproduce the problem.

    Thanks and regards,

    -George

  • Test_logistics.c
    /*=========================================================================*/
    /*
    Compiler-Version:
    --------------
    TMS320C2000 C/C++ Compiler              v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    
    TMS320C2000 C/C++ Parser                v20.2.2.LTS
    Build Number 1UGHJ-2LI-RZASS-TAQ-C08D
    TMS320C2000 EABI C/C++ Parser           v20.2.2.LTS
    Build Number 1UGHJ-2LI-RZASS-TAQ-C08D
    TMS320C2000 C/C++ File Merge            v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 C/C++ Optimizer             v20.2.2.LTS
    Build Number 1UGHJ-2LI-RZASS-TAQ-C08D
    TMS320C2000 G3 C/C++ Codegen            v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Assembler                   v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Embed Utility               v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 C Source Interlister        v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Linker                      v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Absolute Lister             v20.2.2.LTS
    Build Number 1UGHJ-2LI-RZASS-TAQ-C08D
    TMS320C2000 Strip Utility               v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 XREF Utility                v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 C++ Demangler               v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Hex Converter               v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Name Utility                v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Object File Display         v20.2.2.LTS
    Build Number 1UGHK-2LI-RZASS-TAQ-C08D
    TMS320C2000 Archiver                    v20.2.2.LTS
    Build Number 1UGHJ-2LI-RZASS-TAQ-C08D
    */
    
    /*--------------------------------------*/
    /*
    Compiler-Options:
    --------------
    C:/tools/ti-cgt-c2000/20.2.2/bin/cl2000.exe
    --preproc_with_compile
    -v28
    -mt
    --cla_support=cla2
    --float_support=fpu64
    --tmu_support=tmu0
    --vcu_support=vcrc
    --fp_mode=relaxed
    --include_path=C:/tools/ti-cgt-c2000/20.2.2/include
    --include_path=C:/tools/ti-cgt-c2000/20.2.2/lib\src
    ..
    -DApp
    -D_COPY_CLA_SECTIONS
    -D_USE_LOGISTIC_ARRAY           (or -D_USE_LOGISTIC_RECORD)
    -DCPU1
    -DSINGLECPU
    -g
    --c99
    --diag_warning=225
    --diag_wrap=off
    --display_error_number
    -abi=eabi
    --gen_func_subsections=on
    --gen_data_subsections=on
    --idiv_support=idiv0
    --advice:performance=all
    --verbose_diagnostics
    --define=_FLASH
    Dcdc/App/Sources/Test_logistics.c
    --output_file=<xxx>.obj
    --cla_support=cla2
    --cla_background_task=on
    */
    
    /*--------------------------------------*/
    /*
    Linker-Options:
    --------------
    C:/tools/ti-cgt-c2000/20.2.2/bin/cl2000.exe
    --abi=eabi
    --run_linker
    <xxx>.cmd  -* lib-/obj-list *-
    --search_path=C:/tools/ti-cgt-c2000/20.2.2/lib
    --entry_point=code_start
    --rom_model
    --disable_auto_rts
    -m=<xxx>.map
    --warn_sections
    --reread_libs
    --diag_wrap=off
    --display_error_number
    --xml_link_info=<xxx>.xml
    -o=<xxx>.elf
    <xxx>.ldscript
    --library=libc.a ...
    */
    
    /*--------------------------------------*/
    /*
    Linker-Skript:
    --------------
    #define LEN_LOG 0x0098
    MEMORY
    {   ...
        MEM_APP_LOG : origin = 0x0C0000-LEN_LOG, length = LEN_LOG
        ...
    }
    
    SECTIONS
    {   ...
        App_Logistics   : > MEM_APP_LOG,                            -* line 133 *-
                            LOAD_START(_LNK_AppLogisticStart),
                            LOAD_SIZE( _LNK_AppLogisticSize),
                            ALIGN(4)
        ...
    }
    */
    /*=========================================================================*/
    
    #pragma SET_DATA_SECTION("App_Logistics")
    
    #if defined(_USE_LOGISTIC_ARRAY)
    /* Compiler-Option: "-D_USE_LOGISTIC_ARRAY" */
    /*=========================================================================*/
    
    #define SWE_LOGISTICS_LENGTH    (0x98U)
    
    typedef unsigned int    uint16_t;
    
    /*--------------------------------------*/
    
    __attribute__((retain)) volatile const uint16_t AppLogistics[SWE_LOGISTICS_LENGTH] =
    {
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0800U, 0x00A0U, 0x7704U, 0x0301U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x5A5AU, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U,
        0x0000U, 0x0001U, 0x0100U, 0x0000U, 0x0708U, 0x110BU, 0x0102U, 0x0304U,
        0x0506U, 0x0708U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U, 0x0000U
    };  /* 304 Bytes */
    
    /*--------------------------------------*/
    /*
    map-file
    ---------------------
    Test_logistics.obj
    
    Run/Load
    Value     Binding   Name (Section)
    --------  --------  ---------------
    00000000  local     .text (.text)
    000bff68  global    AppLogistics (App_Logistics:retain)
    000bff68  local     App_Logistics:retain (App_Logistics:retain)
    */
    
    /*--------------------------------------*/
    /*
    Debugger-Info (Lauterbach)
    ---------------------
    variable_(global_scope)
    \\PeDCDC_SWFL_0000A077_004_003_001\Test_logistics\AppLogistics
                                       D:000BFF68--000BFFFF
    
    module_info
    language: ELF-ASM
    producer: TI TMS320C2000 Linker PC v20.2.2 Copyright (c) 1996-2018 Texas Instruments Incorporated
    source:   C:\_e\prj_pedsp\pedsp\bazel-build\execroot\__main__\Dcdc\App\Sources\Test_logistics.c
    
    type
    --------------------------------------------------------------------------------
    (volatile const uint16_t [152]) array (volatile const uint16_t, 304 bytes, 0..151)
    --------------------------------------------------------------------------------
    (volatile const uint16_t) volatile (const uint16_t)
    --------------------------------------------------------------------------------
    (const uint16_t) const (uint16_t)
    --------------------------------------------------------------------------------
    (uint16_t) typedef (unsigned int)
    --------------------------------------------------------------------------------
    (unsigned int) unsigned integer (16 bits)
    */
    
    /*=========================================================================*/
    #endif /* _USE_LOGISTIC_ARRAY */
    
    
    #if defined(_USE_LOGISTIC_RECORD)
    /* Compiler-Option: "-D_USE_LOGISTIC_RECORD" */
    /*=========================================================================*/
    
    #define ARRAY01_LENGTH  (0x04U)
    #define ARRAY02_LENGTH  (0x04U)
    #define ARRAY03_LENGTH  (0x40U)
    #define ARRAY04_LENGTH  (0x30U)
    #define ARRAY05_LENGTH  (0x08U)
    #define ARRAY06_LENGTH  (0x08U)
    
    typedef unsigned int    uint16_t;
    
    typedef struct
    {
       uint16_t Counter00;
       uint16_t Counter01;
       uint16_t Counter02;
       uint16_t Counter03;
       uint16_t Counter04;
       uint16_t Counter05;
       uint16_t Counter06;
       uint16_t Counter07;
       uint16_t Counter08;
       uint16_t Counter09;
       uint16_t Counter10;
       uint16_t Counter11;
       uint16_t Counter12;
       uint16_t Counter13;
       uint16_t Counter14;
       uint16_t Counter15;
    
    } TestData_t;
    
    typedef struct
    {
       uint16_t     Array01[ARRAY01_LENGTH];        /*   8 Bytes */
       uint16_t     Array02[ARRAY02_LENGTH];        /*   8 Bytes */
       uint16_t     Array03[ARRAY03_LENGTH];        /* 128 Bytes */
       uint16_t     Array04[ARRAY04_LENGTH];        /*  96 Bytes */
       uint16_t     Array05[ARRAY05_LENGTH];        /*  16 Bytes */
       uint16_t     Array06[ARRAY06_LENGTH];        /*  16 Bytes */
       TestData_t   TestData;                       /*  32 Bytes */
    
    } TestLogistics_t;                              /* 304 Bytes */
    
    /*--------------------------------------*/
    
    __attribute__((retain)) volatile const TestLogistics_t AppLogistics =
    {
       .Array01 =   {   0                                   },
       .Array02 =   {   0x0800U, 0x00A0U, 0x7704U, 0x0301U  },
       .Array03 =   {   0                                   },
       .Array04 =   {   0                                   },
       .Array05 =   {   0                                   },
       .Array06 =   {   0x5A5AU, 0, 0, 0, 0, 0, 0, 0        },
       .TestData =
       {  .Counter00    = 0x0000U,
          .Counter01    = 0x0001U,
          .Counter02    = 0x0200U,
          .Counter03    = 0x0000U,
          .Counter04    = 0x0708U,
          .Counter05    = 0x110BU,
          .Counter06    = 0x0102U,
          .Counter07    = 0x0304U,
          .Counter08    = 0x0506U,
          .Counter09    = 0x0708U,
          .Counter10    = 0,
          .Counter11    = 0,
          .Counter12    = 0,
          .Counter13    = 0,
          .Counter14    = 0,
          .Counter15    = 0
       },
    };
    
    /*--------------------------------------*/
    /*
    Linker-Error:
    ---------------------
    ERROR: <xxx> Linking App_native_binary failed:
    (Exit 1): cl2000.exe failed: error executing command
        C:/tools/ti-cgt-c2000/20.2.2/bin/cl2000.exe --abi=eabi --run_linker <xxx> ... (remaining 13 argument(s) skipped)
    "Dcdc\App\..\..\Linker\PeDSP_AppMain.ldscript", line 133:
        error #10099-D: program will not fit into available memory,
        or the section contains a call site that requires a trampoline
        that can't be generated for this section.
        placement with alignment/blocking fails for section "App_Logistics" size 0x98page 0.
        Available memory ranges:    MEM_APP_LOG   size: 0x98         unused: 0x98         max hole: 0x98
    error #10010: errors encountered during linking; "<xxx>.elf" not built
    */
    
    /*
    �nderung Linker-Skript:
    --------------------
    #define LEN_LOG 0x00C0
    -> Linking successful
    */
    
    /*--------------------------------------*/
    /*
    map-file
    ---------------------
    Test_logistics.obj
    
    Run/Load
    Value     Binding   Name (Section)
    --------  --------  ---------------
    00000000  local     .text (.text)
    000bff40  global    AppLogistics (App_Logistics:retain)
    000bff40  local     App_Logistics:retain (App_Logistics:retain)
    */
    
    /*--------------------------------------*/
    /*
    Debugger-Info (Lauterbach)
    ---------------------
    \\PeDCDC_SWFL_0000A077_004_003_001\Test_logistics\AppLogistics
                                       D:000BFF40--000BFFD7
    
    module_info
    language: ELF-ASM
    producer: TI TMS320C2000 Linker PC v20.2.2 Copyright (c) 1996-2018 Texas Instruments Incorporated
    source:   C:\_e\prj_pedsp\pedsp\bazel-build\execroot\__main__\Dcdc\App\Sources\Test_logistics.c
    
    type
    (volatile const TestLogistics_t) volatile (const TestLogistics_t)
    --------------------------------------------------------------------------------
    (const TestLogistics_t) const (TestLogistics_t)
    --------------------------------------------------------------------------------
    (TestLogistics_t) typedef (struct)
    --------------------------------------------------------------------------------
    (struct) struct (304 bytes,
                    [0] uint16_t [4] Array01,
                    [8] uint16_t [4] Array02,
                    [16] uint16_t [64] Array03,
                    [144] uint16_t [48] Array04,
                    [240] uint16_t [8] Array05,
                    [256] uint16_t [8] Array06,
                    [272] TestData_t TestData)
    --------------------------------------------------------------------------------
    (uint16_t [4]) array (uint16_t, 8 bytes, 0..3)
    (uint16_t [64]) array (uint16_t, 128 bytes, 0..63)
    (uint16_t [48]) array (uint16_t, 96 bytes, 0..47)
    (uint16_t [8]) array (uint16_t, 16 bytes, 0..7)
    (TestData_t) typedef (struct)
    --------------------------------------------------------------------------------
    (uint16_t) typedef (unsigned int)
    (struct) struct (32 bytes,
                    [0] uint16_t Counter00,
                    [2] uint16_t Counter01,
                    [4] uint16_t Counter02,
                    [6] uint16_t Counter03,
                    [8] uint16_t Counter04,
                    [10] uint16_t Counter05,
                    [12] uint16_t Counter06,
                    [14] uint16_t Counter07,
                    [16] uint16_t Counter08,
                    [18] uint16_t Counter09,
                    [20] uint16_t Counter10,
                    [22] uint16_t Counter11,
                    [24] uint16_t Counter12,
                    [26] uint16_t Counter13,
                    [28] uint16_t Counter14,
                    [30] uint16_t Counter15)
    --------------------------------------------------------------------------------
    (unsigned int) unsigned integer (16 bits)
    */
    
    /*=========================================================================*/
    #endif /* _USE_LOGISTIC_RECORD */
    
    #pragma SET_DATA_SECTION()
    

    Hi George,

    thank you very much for your input. Please find attached to this message the extract file. It has all the needed data inside.

    Please let me know if you have updates about this topic since it is a blocker for our project.

    Thank you,

    Eugen

  • Thank you for the test case.  Unfortunately, I am unable to reproduce the problem.  Please submit the linker command file.  So the forum will accept it, please add the file extension .txt to it.  Also, by copying and pasting the text of the command, show exactly how the linker is invoked.  That additional detail may allow me to reproduce the problem.

    Thanks and regards,

    -George