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/TMS320F28379D: Linking with --opt_level=4 and --run_linker

Part Number: TMS320F28379D

Tool/software: TI C/C++ Compiler

Hi,

according to the compiler documentation, --opt_level=4 has to be applied to both, the compiler and the linker to enable link time optimizations. I receive error messages when passing the --opt_level=4 switch to the linker (formated):

/Applications/ti/ti-cgt-c2000_20.2.2.LTS/bin/cl2000 
    --run_linker 
    --output_file=pfc.out 
    --map_file=pfc.out.map 
    --opt_level=4 
    --stack_size=0x3F8 
    --heap_size=0 
    --rom_model 
    CMakeFiles/pfc.out.dir/device.c.obj 
    CMakeFiles/pfc.out.dir/pfc.c.obj 
    CMakeFiles/pfc.out.dir/can_adapter.c.obj 
    CMakeFiles/pfc.out.dir/ring_buffer.c.obj 
    CMakeFiles/pfc.out.dir/log.c.obj 
    CMakeFiles/pfc.out.dir/timer.c.obj 
    CMakeFiles/pfc.out.dir/main_thread.c.obj 
    CMakeFiles/pfc.out.dir/parameters.c.obj 
    CMakeFiles/pfc.out.dir/adc_pwm.c.obj 
    CMakeFiles/pfc.out.dir/controller.c.obj   
    --search_path=/Applications/ti/ti-cgt-c2000_20.2.2.LTS/lib  
    --search_path=/Applications/ti/ti-cgt-c2000_20.2.2.LTS/include  
    --search_path=/Applications/ti/c2000/C2000Ware_3_02_00_00/device_support/f2837xd/common/cmd  
    --search_path=/Applications/ti/c2000/C2000Ware_3_02_00_00/device_support/f2837xd/headers/cmd  
    libdriverlib.a 
    libstartup_files.a 
    --library=rts2800_fpu32.lib 
    --library=2837xD_Flash_lnk_cpu1.cmd 
    --library=F2837xD_Headers_nonBIOS_cpu1.cmd 

results in:

<Linking>
>> WARNING: more than one source file is specified; option --output_file is ignored
[_level=4.]
Fatal error: cannot open source file "_level=4"
1 catastrophic error detected in the compilation of "_level=4".
Compilation terminated.

I see that the Eclipse examples do not use the --run_linker switch. Maybe there is a different name for that switch for the linker command line?

best regards,

Torsten

  • Please capture the complete command that cl2000 sees, exactly as it sees it.  Put that in a text file with the file extension .txt.  Attach that text file to your next post.

    Thanks and regards,

    -George

  • linker_invokation.txt
    cd /Users/todi/ambibox/pfc/build/source && /usr/local/Cellar/cmake/3.18.2/bin/cmake -E cmake_link_script CMakeFiles/pfc.out.dir/link.txt --verbose=1
    /Applications/ti/ti-cgt-c2000_20.2.2.LTS/bin/cl2000 --run_linker --output_file=pfc.out --map_file=pfc.out.map --stack_size=0x3F8 --heap_size=0 --rom_model --opt_level=4 CMakeFiles/pfc.out.dir/device.c.obj CMakeFiles/pfc.out.dir/pfc.c.obj CMakeFiles/pfc.out.dir/can_adapter.c.obj CMakeFiles/pfc.out.dir/ring_buffer.c.obj CMakeFiles/pfc.out.dir/log.c.obj CMakeFiles/pfc.out.dir/timer.c.obj CMakeFiles/pfc.out.dir/main_thread.c.obj CMakeFiles/pfc.out.dir/parameters.c.obj CMakeFiles/pfc.out.dir/adc_pwm.c.obj CMakeFiles/pfc.out.dir/controller.c.obj   --search_path=/Applications/ti/ti-cgt-c2000_20.2.2.LTS/lib  --search_path=/Applications/ti/ti-cgt-c2000_20.2.2.LTS/include  --search_path=/Applications/ti/c2000/C2000Ware_3_02_00_00/device_support/f2837xd/common/cmd  --search_path=/Applications/ti/c2000/C2000Ware_3_02_00_00/device_support/f2837xd/headers/cmd  libdriverlib.a libstartup_files.a --library=rts2800_fpu32.lib ../../source/linker_script.cmd --library=F2837xD_Headers_nonBIOS_cpu1.cmd
    

    For completeness, the first line of the command is the command given to cmake, the rest of the file is the content of CMakeFiles/pfc.out.dir/link.txt and that's how the linker is invoked.

  • Thank you for supplying the complete command.  You have found a bug in the compiler.  I can reproduce it.  I filed the entry EXT_EP-10044 to have this investigated.  You are welcome to follow it with the link below in my signature.

    When linking, the option --opt_level=4 must appear before the option --run_linker.  This is true in any case.  But it also avoids this particular bug.

    Thanks and regards,

    -George