CMake and TI compilers



  • Hello all together!

    CUrrently I am trying to get the ti-cgt 5.2.5 compiler working with CMake.
    Therefore, I use the blinky sample project from TivaWare.

    To keep it simple in a first try, I added all the original flags from the code composer project into a toolchain file:
    #include(CMakeForceCompiler)
    set(CMAKE_SYSTEM_NAME Generic)

    set(COMPILER_PATH "C:/git/saveris/toolchains/") # TODO
    set(TI_CGT_PATH "${COMPILER_PATH}/arm-ti-cgt-5.2.5")

    # specify the cross compiler
    SET(CMAKE_C_COMPILER ${TI_CGT_PATH}/bin/armcl.exe)
    SET(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
    SET(CMAKE_ASM_COMPILER {TI\_CGT\_PATH}/bin/armasm.exe) #ENABLE_LANGUAGE(ASM) #set(CMAKE\_AR "{TI_CGT_PATH}/bin/armar")
    #set(CMAKE_LINKER "${TI_CGT_PATH}/bin/armcl.exe")

    # skip compiler tests
    set(CMAKE_ASM_COMPILER_WORKS 1)
    set(CMAKE_C_COMPILER_WORKS 1)
    set(CMAKE_CXX_COMPILER_WORKS 1)
    set(CMAKE_DETERMINE_ASM_ABI_COMPILED 1)
    set(CMAKE_DETERMINE_C_ABI_COMPILED 1)
    set(CMAKE_DETERMINE_CXX_ABI_COMPILED 1)

    # Add the default include and lib directories for tool chain
    include_directories(TI_CGTPATH/include)link_directories({TI\_CGT_PATH}/include) link\_directories({TI_CGT_PATH}lib)

    # set target environment
    set(CMAKE_FIND_ROOT_PATH ${TI_CGT_PATH})

    # specifiy target cpu flags
    #set(PLATFORM_CONFIG_C_FLAGS "-mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 -g --gcc -v")

    set(PLATFORM_CONFIG_C_FLAGS "-mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 -g --include_path=C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include --include_path=C:/TI/TivaWare_C_Series-2.1.0.12573 --gcc --define=ccs=ccs --define=PART_TM4C1294NCPDT --diag_warning=225 --display_error_number --diag_wrap=off --gen_func_subsections=on --ual" CACHE STRING "platform config c flags")

    # combine flags to C and C++ flags
    SET(CMAKE_C_FLAGS "${PLATFORM_CONFIG_C_FLAGS} CMAKE_CFLAGS"CACHESTRING"platformconfigcflags")SET(CMAKE_CXX_FLAGS"{CMAKE\_C_FLAGS}" CACHE STRING "platform config c flags") SET(CMAKE\_CXX\_FLAGS "{PLATFORM_CONFIG_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" CACHE STRING "platform config c flags")

    SET(CMAKE_EXE_LINKER_FLAGS "-mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 -g --define=ccs=\"ccs\" --define=PART_TM4C1294NCPDT --diag_warning=225 --display_error_number --diag_wrap=off --gen_func_subsections=on --ual -z --stack_size=256 -mblinky_ccs.map --heap_size=0 -iC:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/lib -iC:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info=blinky_linkInfo.xml --rom_model" CACHE STRING "platform config linker exe files")

    Then, when I run CMake and try to build it with make, I get this error:

    <Linking>

    > WARNING: invalid linker option --code_state=16 (ignored)
    > WARNING: invalid linker option --float_support=FPv4SPD16 (ignored)
    > WARNING: the --abi=eabi option must be specified before the -z; option ignored
    warning: Case insensitivity of options has been deprecated; O must be written
    as o in future releases
    > WARNING: invalid linker option --gen_func_subsections=on (ignored)
    > WARNING: invalid linker option --ual (ignored)
    warning: Option -o is an alias of linker option --output_file. The specified
    argument of 2 is also a valid argument for the compiler option --opt_level
    (-o). If the intent is to specify the optimization level, the option should
    be specified before the --run_linker(-z) option. As specified, the output
    file of the linker will be 2
    warning #10247-D: creating output section ".text" without a SECTIONS
    specification
    warning #10247-D: creating output section ".data" without a SECTIONS
    specification
    warning #10247-D: creating output section ".cinit" without a SECTIONS
    specification

    undefined first referenced
    symbol in file
    --------- ----------------
    --define=ccs=ccs

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "2" not built

    > Compilation failure
    jom: C:\git\saveris\build\none\debug\app/ethernet2cloud/CMakeFiles/ethernet2cloud.dir/build.make [bin\ethernet2cloud] Error 1
    jom: C:\git\saveris\build\none\debug\CMakeFiles/Makefile2 [app\ethernet2cloud\CMakeFiles\ethernet2cloud.dir\all] Error 2
    jom: C:\git\saveris\build\none\debug\Makefile [all] Error 2

    I found out, that in the build.make file, there are some additional flags added to the call of the compiler. “mv7M4” should be the first flag. When I remove the from CMake added flags in between “armcl.exe” and “mv7M4”, the errors disappear:

    cd C:/git/saveris/build/none/debug/app/ethernet2cloud && C:/git/saveris/toolchains/arm-ti-cgt-5.2.5/bin/armcl.exe --run_linker --output_file=../../bin/ethernet2cloud --map_file=../../bin/ethernet2cloud.map --search_path=C:/git/saveris/toolchains/arm-ti-cgt-5.2.5lib -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 -g --define=ccs="ccs" --define=PART_TM4C1294NCPDT --diag_warning=225 --display_error_number --diag_wrap=off --gen_func_subsections=on --ual -z --stack_size=256 -mblinky_ccs.map --heap_size=0 -iC:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/lib -iC:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info=blinky_linkInfo.xml --rom_model $(ethernet2cloud_OBJECTS) $(ethernet2cloud_EXTERNAL_OBJECTS)

    As a comparison, the flags when I use gcc:
    cd C:/git/saveris/build/none/debug/app/ethernet2cloud && C:/git/saveris/toolchains/arm-none-eabi-gcc-4.8/bin/arm-none-eabi-gcc.exe -O0 -fprofile-arcs -ftest-coverage -g -gdwarf-2 -lgcov --coverage $(ethernet2cloud_OBJECTS) $(ethernet2cloud_EXTERNAL_OBJECTS) -o ../../bin/ethernet2cloud

    My question is now: What does CMake do exactly? The flags added to the compiler are compiler specifiv (?). But where does CMake know from, what it has to do? If it would know the TI compiler, then I would guess it should add the correct flags.

    Has anyone over done similar experiences?

    Thank you


Anmelden zum Antworten