[CMake] Using CMake with TI armcl and armar

Samyukta Ramnath sramnath at axon.com
Fri Nov 8 18:15:35 EST 2019


Hello Eric,

Thank you – I was able to get the compile options I expected in the make command when I passed in the Toolchain.cmake file as you had specified in your email.

I’m having a few more problems getting the command I want.

I’m looking at Code composer studio and here’s the linker command that I want :

"/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --define=DeviceFamily_CC13X2 -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on -z -m"gpiointerrupt_CC1352P1_LAUNCHXL_tirtos_ccs.map" -i"/Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source" -i"/Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/kernel/tirtos/packages" -i"/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/lib" --diag_wrap=off --display_error_number --warn_sections --xml_link_info="gpiointerrupt_CC1352P1_LAUNCHXL_tirtos_ccs_linkInfo.xml" --rom_model -o "gpiointerrupt_CC1352P1_LAUNCHXL_tirtos_ccs.out" "CMakeFiles/test.dir/CC1352P1_LAUNCHXL.c.obj" "CMakeFiles/test.dir/CC1352P1_LAUNCHXL_fxns.c.obj" "CMakeFiles/test.dir/ccfg.c.obj" "CMakeFiles/test.dir/gpiointerrupt.c.obj" "CMakeFiles/test.dir/main_tirtos.c.obj" "../CC1352P1_LAUNCHXL_TIRTOS.cmd" -l"ti/display/lib/display.aem4f" -l"ti/grlib/lib/ccs/m4f/grlib.a" -l"third_party/spiffs/lib/ccs/m4f/spiffs_cc26xx.a" -l"ti/drivers/rf/lib/rf_multiMode_cc13x2.aem4f" -l"ti/drivers/lib/drivers_cc13x2.aem4f" -l"ti/dpl/lib/dpl_cc13x2.aem4f" -l"../linker.cmd" -l"ti/devices/cc13x2_cc26x2/driverlib/bin/ccs/driverlib.lib" -llibc.a



Here is the linker command that I am currently running :

/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl --run_linker --output_file=test.out --map_file=test.out.map  -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --define=DeviceFamily_CC13X2 -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --xml_link_info=gpiointerrupt_CC1352P1_LAUNCHXL_tirtos_ccs_linkInfo.xml CMakeFiles/test.out.dir/main_tirtos.c.obj CMakeFiles/test.out.dir/CC1352P1_LAUNCHXL_fxns.c.obj CMakeFiles/test.out.dir/CC1352P1_LAUNCHXL.c.obj CMakeFiles/test.out.dir/gpiointerrupt.c.obj CMakeFiles/test.out.dir/ccfg.c.obj  --search_path=/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/lib /Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/lib/libc.a /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/ti/display/lib/display.aem4f /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/ti/grlib/lib/ccs/m4f/grlib.a /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/third_party/spiffs/lib/ccs/m4f/spiffs.a /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.aem4f /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/ti/drivers/lib/drivers_cc13x2.aem4f /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/kernel/tirtos/packages/ti/dpl/lib/dpl_cc13x2.aem4f /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/ti/devices/cc13x2_cc26x2/driverlib/bin/ccs/driverlib.lib /Applications/ti_ccs9/simplelink_cc13x2_26x2_sdk_3_20_00_68/source/third_party/fatfs/lib/ccs/m4/fatfs.a ../linker.cmd liblwipboard.a liblwipcore.a


I want to add a CC1352P1_LAUNCHXL_TIRTOS.cmd  file, which has been added in the CCS linker command, but I am unable to include It in my linker command. I tried the following things :

set(LINKER_SCRIPT "${LWIP_DIR}/CC1352P1_LAUNCHXL_TIRTOS.cmd")
set_target_properties(test.out PROPERTIES LINK_DEPENDS ${LWIP_DIR}/CC1352P1_LAUNCHXL_TIRTOS.cmd)
I have also tried passing it in with the cmake command as

>> cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain_ticomp.cmake -DCMAKE_LINKER=../CC1352P1_LAUNCHXL_TIRTOS.cmd ..

None of these options helped.
This .cmd file has details about stack size, heap size, entry point etc.

I would also like some clarification on where to add the linker command --rom_model as when I add it to the CMAKE_EXE_LINKER_FLAGS variable in the Toolchain.cmake file, my cmake hangs at “Detecting CXX compiler ABI info”


Thanks for your help!

Warm regards,
Samyukta





From: CMake <cmake-bounces at cmake.org> on behalf of Eric Doenges <doenges at mvtec.com>
Organization: MVTec Software GmbH
Date: Friday, November 8, 2019 at 12:23 AM
To: "cmake at cmake.org" <cmake at cmake.org>
Subject: Re: [CMake] Using CMake with TI armcl and armar

Am 07.11.19 um 18:01 schrieb samyuktar:


SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER}  ${CMAKE_C_FLAGS}

--c_file=../main.c -z --map_file=${TARGET_NAME}.map

--output_file=${TARGET_NAME} ${PLATFORM_CONFIG_L_FLAGS} ${CMD_SRCS}   ${LIB}

--include_path ${LWIP_INCLUDE_DIR} --verbose <OBJECTS>"  CACHE STRING

"linker executable")

As far as I can tell, you are trying to combine the compile and link steps, but CMake expects these to be separate steps. Furthermore, cmake knows about the TI compiler (see <...>/share/cmake-3.xx/Modules/Compiler/TI-C.cmake and friends), so you shouldn't need to mess around with CMAKE_C_LINK_EXECUTABLE - let cmake handle that for you. The flags you need for linking that cmake doesn't already add for you by default should go into CMAKE_EXE_LINKER_FLAGS_<CONFIG>_INIT (see the cmake documenation for details), or be set using the add_link_options and/or target_link_options commands (again, see the cmake documentation for details).

[ 50%] Building C object CMakeFiles/test.dir/main.c.o

/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl

-I/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include

-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk   -o

CMakeFiles/test.dir/main.c.o   -c /Users/sramnath/lwip_blinky/lwip/main.c

WARNING: object file specified, but linking not enabled

That compiler invocation looks wrong - I'm pretty sure the TI compiler doesn't use the MacOS10.14.sdk sysroot. I think what's happening here is that you set your toolchain settings (CMAKE_C_COMPILER and friends) after the project() command - but the project() command tells cmake to check what compiler you are using to figure out how it must be called, and it is using your host system's compiler (probably Apple's clang) to do so. You should put the toolchain definitions into a toolchain file as described in the cmake-toolchains(7) documentation and tell cmake to use it my specifying -DCMAKE_TOOLCHAIN_FILE=<path to your toolchain file> on the cmake command line.

I once played around a bit with cgtools 5.2.9 for Arm using the following toolchain file:

--- SNIP ---

# TI cgt-arm_5.2.9 cmake toolchain script
#
# This file is based on the cmake-toolchains(7) documentation.

# Set the operating system and processor architecture
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSTEM_VERSION 1)

# Setup CMake's rules for using the CMAKE_FIND_ROOT_PATH for cross-compilation
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# TI cgtools command line programs
set(SDK_PATH "/proj/he/opt/ti/ti-cgt-arm_5.2.9")
set(SDK_BIN "${SDK_PATH}/bin")

# This compiler doesn't work with CMAKE_SYSROOT, but we do need to set our
# CMAKE_FIND_ROOT_PATH. Note that setting a variable will override the value in
# the cache if the CACHE option was not used, so if we want to be able to use a
# CMAKE_FIND_ROOT_PATH passed to cmake via the command line, we must make sure
# not to overwrite any value that was already set.
if(NOT CMAKE_FIND_ROOT_PATH)
  set(CMAKE_FIND_ROOT_PATH ${SDK_PATH})
endif()

set(CMAKE_C_COMPILER "${SDK_BIN}/armcl")
set(CMAKE_CXX_COMPILER "${SDK_BIN}/armcl")
set(CMAKE_ASM_COMPILER "${SDK_BIN}/armasm")
set(CMAKE_AR "${SDK_BIN}/armar")
set(CMAKE_LINKER "${SDK_BIN}/armlnk")

string(CONCAT ARCH_C_FLAGS
  "-mv=7A8 --abi=eabi -me --float_support=VFPv3 --neon --printf_support=full")
set(CMAKE_C_FLAGS_INIT "${ARCH_C_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT "${ARCH_C_FLAGS}")

# Normally, cmake checks if the compiler can compile and link programs. For
# TI's cgtools the link step doesn't work, and there seems to be no easy way
# to fix this. Instead, we simply disable the compiler checks for C and C++.
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

--- SNIP ---

Note that the project this was intended for thankfully never got anywhere so I didn't pursue this much further than being able to compile libz with it ("thankfully" because the TI compiler is pretty awful).
--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doenges at mvtec.com<mailto:mustermann at mvtec.com> | Tel: +49 89 457 695-0 | www.mvtec.com<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mvtec.com&d=DwMDaQ&c=0hefKdg9jtsMu47wpF0ovg&r=o586HWVZJhNwBW8dbPk_mkuWj9xBIkNv8JGn6ZzrHVk&m=9xqRbgLd4ef5iN_IgCjAatXM09OQjP54z-vOk1WaLwo&s=xCceegc730gUKWh-r88nE_5UYJ5CR3BmKSdGG4Ky1WE&e=>

Find our privacy policy here<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mvtec.com_imprint&d=DwMDaQ&c=0hefKdg9jtsMu47wpF0ovg&r=o586HWVZJhNwBW8dbPk_mkuWj9xBIkNv8JGn6ZzrHVk&m=9xqRbgLd4ef5iN_IgCjAatXM09OQjP54z-vOk1WaLwo&s=rHmc1hkkulJAijbaOuEmsVbIxQpUI8ljgPslDqs2qdY&e=>.

[Image removed by sender.] Sign up<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mvtec.com_newsletter&d=DwMDaQ&c=0hefKdg9jtsMu47wpF0ovg&r=o586HWVZJhNwBW8dbPk_mkuWj9xBIkNv8JGn6ZzrHVk&m=9xqRbgLd4ef5iN_IgCjAatXM09OQjP54z-vOk1WaLwo&s=YMPDC_RmNAWQTbElsqzH7eXyWoPb1N1T6mAI0vsK2SU&e=> for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695


[Image removed by sender. MVTec Software GmbH Logo]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191108/e326d99e/attachment-0001.html>


More information about the CMake mailing list