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.

Compiler/TM4C1237H6PZ: Linker 16.9.4 LTS issue with Memory Filling

Part Number: TM4C1237H6PZ

Tool/software: TI C/C++ Compiler

Hi Support,

my customer is having some troubles with the linker in the version 16.9.4 LTS of the compiler.

Basically, it doesn't like the memory filling option in the linker command file stated by the following line

 FLASH (RX)      : origin = FLASH_START, length = START(CRCDATA)-FLASH_START, fill = 0xFFFFFFFF

If the filling option is removed, everything runs fine. Can you help me solving the issue?


This is the linking command displayed in the output console.

'Building target: 4555290_NCC.out'
'Invoking: ARM Linker'
"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --define=ccs="ccs" --define=PART_TM4C1237H6PZ --define=TARGET_IS_BLIZZARD_RB1 --define=__STDC_LIMIT_MACROS --define=_32_BIT_DOUBLE --float_operations_allowed=32 --gcc --diag_suppress=10190 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --check_misra="2.1,2.3,4,5.2,5.3,5.4,6.1,6.2,6.4,6.5,7,8.1,8.2,8.5,8.6,8.8,8.11,8.12,9" -z -m"4555290_NCC.map" --heap_size=2048 --stack_size=0 -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/lib" -i"C:/ti/TivaWare_C_Series-2.1.3.156/driverlib/ccs/Debug" -i"C:/Projects/BIC - 0580181 - Cosmogas/2 - Develop/5 - Firmware/4555290_NCC/Libraries/Lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="4555290_NCC_linkInfo.xml" --rom_model -o "4555290_NCC.out" <object modules> "../tm4c1237h6pz.cmd" "../Libraries/Lib/crc.lib" "../Libraries/Lib/lin_int.lib" "../Sup_Sm_Model/Libraries/Lib/crc.lib" "../Sup_Sm_Model/Libraries/Lib/lin_int.lib"  -llibc.a -ldriverlib.lib
<Linking>
 

This does not happen with the version 17.6.0 STS of the compiler (or 15.X:X).

'Building target: 4555290_NCC.out'
'Invoking: ARM Linker'
"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --define=ccs="ccs" --define=PART_TM4C1237H6PZ --define=TARGET_IS_BLIZZARD_RB1 --define=__STDC_LIMIT_MACROS --define=_32_BIT_DOUBLE --float_operations_allowed=32 --gcc --diag_suppress=10190 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --check_misra="2.1,2.3,4,5.2,5.3,5.4,6.1,6.2,6.4,6.5,7,8.1,8.2,8.5,8.6,8.8,8.11,8.12,9" -z -m"4555290_NCC.map" --heap_size=2048 --stack_size=0 -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/lib" -i"C:/ti/TivaWare_C_Series-2.1.3.156/driverlib/ccs/Debug" -i"C:/Projects/BIC - 0580181 - Cosmogas/2 - Develop/5 - Firmware/4555290_NCC/Libraries/Lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="4555290_NCC_linkInfo.xml" --rom_model -o "4555290_NCC.out" <object modules> "../tm4c1237h6pz.cmd" "../Libraries/Lib/crc.lib" "../Libraries/Lib/lin_int.lib" "../Sup_Sm_Model/Libraries/Lib/crc.lib" "../Sup_Sm_Model/Libraries/Lib/lin_int.lib"  -llibc.a -ldriverlib.lib
<Linking>
'Finished building target: 4555290_NCC.out'
' '
"C:/ti/ccsv7/utils/tiobj2bin/tiobj2bin" "4555290_NCC.out" "4555290_NCC.bin" "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/bin/armofd" "C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/bin/armhex" "C:/ti/ccsv7/utils/tiobj2bin/mkhex4bin"
"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/bin/armdis" "4555290_NCC.out" "4555290_NCC.lst"
Disassembling 4555290_NCC.out into 4555290_NCC.lst
"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_17.6.0.STS/bin/armnm" -o="4555290_NCC.sym" "4555290_NCC.out"
' '

**** Build Finished ****

Can you provide me with some info and tips to solve the issue?
By the way I would also like to use the linker to fill the stack with a specific pattern (say 0xFEFEFEFE). Is it possible?


For your reference, this is the linker command file

/******************************************************************************
 *
 * Default Linker Command file for the Texas Instruments TM4C1237H6PZ
 *
 * This is derived from revision 10691 of the TivaWare Library.
 *
 *****************************************************************************/

--retain=g_pfnVectors

#defineFLASH_START   0x00000000
#defineFLASH_SIZE    0x00040000
#defineFLASH_END     (FLASH_START + FLASH_SIZE -1)
#defineRAM_START     0x20000000
#defineRAM_SIZE      0x00008000
#defineRAM_END       (RAM_START + RAM_SIZE -1)
#defineROM_START     0x01000000
#defineROM_END       0x010087FF
#defineROM_SIZE      (ROM_END - ROM_START + 1)


#defineVESTA_SIZE    (0x00008000 - CRCDATA_SIZE)
#defineCRCDATA_SIZE  (SIZE(CRCDATA)

MEMORY
{
    CRCDATA (R)     : origin = 0x3FFFC, length = 0x00000004, fill = 0xFFFFFFFF
    FLASH (RX)      : origin = FLASH_START, length = START(CRCDATA)-FLASH_START, fill = 0xFFFFFFFF

    SRAM (RWX)      : origin = RAM_START, length = 0x00007F00, vfill = 0x00000000
    PERSISTENT (RW) : origin = 0x20007F00, length = 0x00000100
}

/* The following command line options are set as part of the CCS project.    */
/* If you are building using the command line, or for some reason want to    */
/* define them here, you can uncomment and modify these lines as needed.     */
/* If you are using CCS for building, it is probably better to make any such */
/* modifications in your CCS project and leave this file alone.              */
/*                                                                           */
/* --heap_size=0                                                             */
/* --stack_size=256                                                          */
/* --library=rtsv7M4_T_le_eabi.lib                                           */

/* Section allocation in memory */

SECTIONS
{
    .intvecs:   > 0x00000000
    .text  :   > FLASH
    .const :   > FLASH
    .cinit :   > FLASH
    .pinit :   > FLASH
    .init_array : > FLASH
    .crcval1 :   >CRCDATA

    //.vtable :   > 0x20000000
    .stack :     > RAM_START /* fill = 0xFEFEFEFE */
    //.vtable :   > SRAM
    .sysmem:     > SRAM (HIGH) { __SYSMEM_START = .; }
    .data  :     > SRAM (HIGH)
    .bss   :     > SRAM (HIGH)
    .persistent : > PERSISTENT, type=NOINIT
}

__STACK_SIZE = __SYSMEM_START - RAM_START;

__XX = __SYSMEM_START;
__STACK_TOP = __SYSMEM_START - 0x08;
__STACK_END = __STACK_TOP + 0x04;

__CRCDATA_START = FLASH_END+1-CRCDATA_SIZE;
__ROM_START = ROM_START;
__ROM_END = ROM_END;
__ROM_SIZE = ROM_SIZE;
__CRCVAL1_START = START(CRCDATA);
__PERSISTENT_START = START(PERSISTENT);
__FLASH_START = START(FLASH);
__FLASH_SIZE = START(CRCDATA)-FLASH_START;
__FLASH_END = __FLASH_START + __FLASH_SIZE - 1;
__RAM_START = START(SRAM);
__RAM_SIZE = RAM_SIZE;
__RAM_END = __RAM_START + __RAM_SIZE - 1;

  • I presume the linker simply never finishes.  Is that correct?

    To understand this problem, I need to reproduce it.  Then I can turn it over to the linker experts for in-depth analysis.  To reproduce it, I need a test case.  For linker issues, this means I need everything the linker sees.  Is this organized as a CCS project?  If so, then please package up the project as described in the article Project Sharing, and attach the resulting .zip file to the next post.

    Thanks and regards,

    -George

  • 0871.Test.zipGeorge,

    This is a sample project where 16.9.4 LTS hangs linking, while 17.6.0 STS works.

    By the way, is there a rule to state the order of the output sections in memory? The order in the linker command file seems not related to it. Isn't it?

    What they would like to achieve is to have the system sections (sysmem, data and bss) allocated in the bottom (high addresses) of the RAM and use all of the remaining RAM as stack area. How can I know the lowest address used by the system?

    Please also find attachment

    Thanks.

    Alberto

  • By default, the linker orders the sections by descending size in an attempt to get an optimal packing. If there are alignment gaps between larger sections, it may squeeze a smaller section into that gap.

    Consider using the HIGH linker command file specifier on sections you want to push to higher addresses.
  • Thank you for submitting a test case.  I can reproduce the problem.  I filed CODEGEN-3591 in the SDOWP system to have this addressed.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George

  • George,

    sorry for late reply but both customer and myself were ooo in the last weeks.
    I'm not able to find the CODEGEN-3591 file under SDOWP, can you kindly highlight the location where I can download the file?
    Thanks and regards,
    Alberto
  • I'm sorry, this one wasn't published externally; I've done so just now, and it will be visible in a few hours. CODEGEN-3591 is fixed in ARM compiler version 16.9.6.LTS and 17.6.0.STS or later.