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.

ti-cgt-arm compiler can not work well in a large project with cmake because of --cmd_file option limitation or bug

Hello,

We are using cmake and ti-cgt-arm compiler to set up a build environment for a project. The linker or archiver options will be very long because there are so many object files to be linked or archived. And this would exceed command line limitation of system and cause link or archive failure. Cmake can handle this issue by using response file like this,

   SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS TRUE)
   SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS TRUE)

So if using TI compiler, cmake will  do the following operation,

default command line generated by cmake is like this,

   armar.exe qr library.a <objects>

   armcl.exe --run_linker --output_file=name.out --map_file=name.map <objects>

after using response file, command line will be like this

   armar.exe qr library.a --cmd_file=object.rsp

   armcl.exe --run_linker --output_file=name.out --map_file=name.map --cmd_file=object.rsp

The problem is --cmd_file option can NOT work in above commands. As a result, --cmd_file is basically useless because only the object or library will have a very long characters and need to put it into a file.

Below is the cmake snippet for TI CGT ARM compiler from cmake install directory

set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qr <TARGET> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> qa <TARGET> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "")

# After the --run_linker flag a response file is not possible
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "")  # if TI compiler support, it should be "--cmd_file="
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 0)

set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> <FLAGS> --run_linker --output_file=<TARGET> --map_file=<TARGET_NAME>.map <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")

  • Our build expert is out today but will be back on Monday and may be able to comment further.

    We had the same issue with command lengths in Code Composer Studio in the past.  To work around that limitation we are leveraging the --cmd_file option.

    As part of the build CCS is generating a ccsObjs.opt file

    The contents of that file look like this for one of my projects that builds a library: 

    "./adc.obj" "./asysctl.obj" "./can.obj" "./cla.obj" "./clb.obj" "./cmpss.obj" "./cputimer.obj" "./dac.obj" "./dcsm.obj" "./dma.obj" "./ecap.obj" "./emif.obj" "./epwm.obj" "./eqep.obj" "./flash.obj" "./gpio.obj" "./hrpwm.obj" "./i2c.obj" "./interrupt.obj" "./mcbsp.obj" "./memcfg.obj" "./sci.obj" "./sdfm.obj" "./spi.obj" "./sysctl.obj" "./upp.obj" "./usb.obj" "./version.obj" "./xbar.obj"

    Then when I look at the makefile that CCS is generating I can see that this file is then passed to the archiver using --cmd_file

    @echo 'Invoking: C2000 Archiver'

    "/Applications/ti/ccs1031/ccs/tools/compiler/ti-cgt-c2000_20.2.4.LTS/bin/ar2000" r "driverlib_coff.lib" --cmd_file=./ccsObjs.opt

    What does the .rsp file look like? The --cmd_file option really is just like pasting the contents onto the command line so it has to be in the format that the tool is expecting.

    Regards,

    John

  • rsp file is just a text file and the content is like this, each object is separated by a blank character

    1.c.obj 2.c.obj 3.c.ojb

  • The problem is --cmd_file option can NOT work in above commands.

    Please be more specific about what goes wrong.

    Please attach one of the object.rsp files auto-generated by cmake to your next post.  Since the forum only accepts a few different file types, add the file extension .txt to it.  This forms the file name object.rsp.txt.

    Thanks and regards,

    -George