Using CMake with TI armcl and armar

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using CMake with TI armcl and armar

samyuktar
Hi,

I want to include some open-source stacks in my code for the CC1352P1, so
I'm trying to use cmake with armcl compiler and armar archiver.

Here is my code:

cmake_minimum_required(VERSION 3.10)
 
set (CMAKE_CONFIGURATION_TYPES "Debug;Release")

project(lwIP)

# Example lwIP application
set(LWIP_DIR "/Users/sramnath/lwip_blinky/lwip")

set (LWIP_DEFINITIONS LWIP_DEBUG=1)

set(CMAKE_VERBOSE_MAKEFILE ON)

#include(CMakeForceCompiler)
# this one is important
set(CMAKE_SYSTEM_NAME Generic)

set (cc1352p1_board_SRCS
        ${LWIP_DIR}/CC1352P1_LAUNCHXL_TIRTOS.cmd
        ${LWIP_DIR}/CC1352P1_LAUNCHXL_fxns.c
        ${LWIP_DIR}/CC1352P1_LAUNCHXL.c
        ${LWIP_DIR}/ccfg.c
)

set (LWIP_INCLUDE_DIRS
    "${LWIP_DIR}/src/include"
    "${LWIP_DIR}"
    "${LWIP_DIR}/contrib/"
    "${LWIP_DIR}/contrib/ports/tirtos/include"
    "${LWIP_DIR}/contrib/examples/test"
#    "/Users/sramnath/lwip_out/lwip/contrib/ports/tirtos"
    "${LWIP_DIR}/contrib/ports/tirtos"
    "${LWIP_TIRTOS_SRCS}"
)

set (LWIP_BIOS_OPTS
        "--define=ti_sysbios_BIOS_swiEnabled__D=TRUE"
        "--define=ti_sysbios_BIOS_taskEnabled__D=TRUE"
        "--define=ti_sysbios_BIOS_clockEnabled__D=TRUE"
        "--define=ti_sysbios_BIOS_runtimeCreatesEnabled__D=TRUE"
        "--define=ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS"
        "--define=ti_sysbios_knl_Swi_DISABLE_ALL_HOOKS"
        "--define=ti_sysbios_BIOS_smpEnabled__D=FALSE"
        "--define=ti_sysbios_Build_useHwiMacros"
        "--define=ti_sysbios_knl_Swi_numPriorities__D=6"
        "--define=ti_sysbios_knl_Task_deleteTerminatedTasks__D=FALSE"
        "--define=ti_sysbios_knl_Task_numPriorities__D=16"
        "--define=ti_sysbios_knl_Task_checkStackFlag__D=FALSE"
        "--define=ti_sysbios_knl_Task_initStackFlag__D=TRUE"
        "--define=ti_sysbios_knl_Task_DISABLE_ALL_HOOKS"
       
"--define=ti_sysbios_knl_Clock_TICK_SOURCE=ti_sysbios_knl_Clock_TickSource_TIMER"
       
"--define=ti_sysbios_knl_Clock_TICK_MODE=ti_sysbios_knl_Clock_TickMode_DYNAMIC"
       
"--define=ti_sysbios_hal_Core_delegate_getId=ti_sysbios_hal_CoreNull_getId__E"
       
"--define=ti_sysbios_hal_Core_delegate_interruptCore=ti_sysbios_hal_CoreNull_interruptCore__E"
       
"--define=ti_sysbios_hal_Core_delegate_lock=ti_sysbios_hal_CoreNull_lock__E"
       
"--define=ti_sysbios_hal_Core_delegate_unlock=ti_sysbios_hal_CoreNull_unlock__E"
        "--define=ti_sysbios_hal_Core_numCores__D=1"
        "--define=ti_sysbios_hal_CoreNull_numCores__D=1"
        "--define=ti_sysbios_utils_Load_taskEnabled__D=TRUE"
        "--define=ti_sysbios_utils_Load_swiEnabled__D=FALSE"
        "--define=ti_sysbios_utils_Load_hwiEnabled__D=FALSE"
        "--define=ti_sysbios_family_arm_m3_Hwi_dispatcherSwiSupport__D=TRUE"
       
"--define=ti_sysbios_family_arm_m3_Hwi_dispatcherTaskSupport__D=TRUE"
       
"--define=ti_sysbios_family_arm_m3_Hwi_dispatcherAutoNestingSupport__D=TRUE"
        "--define=ti_sysbios_knl_Semaphore_supportsEvents__D=FALSE"
        "--define=ti_sysbios_knl_Semaphore_supportsPriority__D=FALSE"
        "--define=xdc_runtime_Assert_DISABLE_ALL"
        "--define=xdc_runtime_Log_DISABLE_ALL"
)

set(CCS_PATH "/Applications/ti_ccs9/ccs9/ccs")
# set(CMAKE_MAKE_PROGRAM ${CCS_PATH}/utils/bin/gmake CACHE PATH "make
program" FORCE)
set(CG_TOOL_ROOT ${CCS_PATH}/tools/compiler/ti-cgt-arm_18.12.2.LTS)

# specify the cross compiler
SET(CMAKE_C_COMPILER_FLAGS "")
# SET(CMAKE_C_COMPILER   "${CG_TOOL_ROOT}/bin/armcl ${cc1352p1_board_SRCS}"
CACHE PATH "c compiler")
SET(CMAKE_C_COMPILER  
"/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl")



SET(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER}  CACHE PATH "cxx compiler")
#SET(CMAKE_ASM_COMPILER ${CG_TOOL_ROOT}/bin/armasm  CACHE PATH "assembler")
SET(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}  CACHE PATH "assembler")
SET(CMAKE_LINKER ${CMAKE_C_COMPILER} CACHE PATH "linker")


# Add the default include and lib directories for tool chain
include_directories(${CG_TOOL_ROOT}/include)
link_directories(${CG_TOOL_ROOT}/lib)
message("link_directories(${CG_TOOL_ROOT}/lib)")

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

# specifiy target cpu flags
set(PLATFORM_CONFIG_C_FLAGS    "-mv7M4 --code_state=32
--float_support=VFPv3D16 --abi=eabi -me -g --diag_warning=225
--display_error_number --diag_wrap=off --enum_type=packed
--include_path=${CG_TOOL_ROOT}/include --define=_RM46x_
--define=_VFP_SUPPORT_=1" CACHE STRING "platform config c flags")
set(PLATFORM_CONFIG_L_FLAGS    "-i ${CG_TOOL_ROOT}/lib --reread_libs
--warn_sections --rom_model")

# combine flags to C and C++ flags
SET(CMAKE_C_FLAGS "${PLATFORM_CONFIG_C_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING
"platform config c flags")
SET(CMAKE_CXX_FLAGS "${PLATFORM_CONFIG_C_FLAGS} ${CMAKE_CXX_FLAGS}" CACHE
STRING "platform config cxx flags")
SET(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}")
SET(LIB "-l rtsv7R4_T_le_v3D16_eabi.lib")
SET(CMD_SRCS
"/Users/sramnath/lwip_blinky/lwip/CC1352P1_LAUNCHXL_TIRTOS.cmd")

set(TARGET_NAME "cc1352p1_launchxl")


# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
${PLATFORM_CONFIG_L_FLAGS}" CACHE STRING "platform config linker exe files")

set(LIB "liblwipboard.a")


set(CMAKE_C_OUTPUT_EXTENSION ".obj")

# cross-compiler
# CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER})

#executable type
set(CMAKE_EXECUTABLE_SUFFIX ".obj")



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")



MESSAGE( STATUS "Compile flags for C:         " ${CMAKE_C_FLAGS} )
MESSAGE( STATUS "Compile flags for asm:       " ${CMAKE_ASM_FLAGS} )
MESSAGE( STATUS "linker flags for asm:        " ${CMAKE_EXE_LINKER_FLAGS} )
MESSAGE( STATUS "linker executable is         " ${CMAKE_C_LINK_EXECUTABLE} )
MESSAGE( STATUS "here is the compiler you are using " ${CMAKE_C_COMPILER})

add_executable(test ${cc1352p1_board_SRCS} "../main.c" )




The trouble is, "add_executable" by default adds a -o  -c <source file>
command, which is different from wha the armcl compiler is expecting (it
expects a format that is given in the CMAKE_C_LINK_EXECUTABLE variable). As
a result, it does not actually compile any of the source files to produce .o
files and I am unable to build the project.

How do I actually execute the command specified in the
CMAKE_C_LINK_EXECUTABLE variable?
When I remove the "add_executable" command, I get the following message :

/usr/local/Cellar/cmake/3.15.5/bin/cmake -S/Users/sramnath/lwip_blinky/lwip
- B/Users/sramnath/lwip_blinky/lwip/build --check-build-system
CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start
/Users/sramnath/lwip_blinky/lwip/build/CMakeFiles
/Users/sramnath/lwip_blinky/lwip/build/CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Nothing to be done for `all'.
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start
/Users/sramnath/lwip_blinky/lwip/build/CMakeFiles 0

 and when I do add it, I get

/usr/local/Cellar/cmake/3.15.5/bin/cmake -S/Users/sramnath/lwip_blinky/lwip
-B/Users/sramnath/lwip_blinky/lwip/build --check-build-system
CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start
/Users/sramnath/lwip_blinky/lwip/build/CMakeFiles
/Users/sramnath/lwip_blinky/lwip/build/CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make -f
CMakeFiles/test.dir/build.make CMakeFiles/test.dir/depend
cd /Users/sramnath/lwip_blinky/lwip/build &&
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_depends "Unix Makefiles"
/Users/sramnath/lwip_blinky/lwip /Users/sramnath/lwip_blinky/lwip
/Users/sramnath/lwip_blinky/lwip/build
/Users/sramnath/lwip_blinky/lwip/build
/Users/sramnath/lwip_blinky/lwip/build/CMakeFiles/test.dir/DependInfo.cmake
--color=
Scanning dependencies of target test
/Library/Developer/CommandLineTools/usr/bin/make -f
CMakeFiles/test.dir/build.make CMakeFiles/test.dir/build
[ 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

It seems to make the .o file, but when I try to link the files, I get the
following message:
[ 60%] Linking C static library liblwipboard.a
/usr/local/Cellar/cmake/3.15.5/bin/cmake -P
CMakeFiles/lwipboard.dir/cmake_clean_target.cmake
/usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_link_script
CMakeFiles/lwipboard.dir/link.txt --verbose=1
/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armar
-av liblwipboard.a  CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL_fxns.c.o
CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL.c.o
CMakeFiles/lwipboard.dir/ccfg.c.o
  ==>  new archive 'liblwipboard.a'
  ==>  building archive 'liblwipboard.a'
  -->  error: 'CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL_fxns.c.o' not
found
  -->  error: 'CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL.c.o' not found
  -->  error: 'CMakeFiles/lwipboard.dir/ccfg.c.o' not found
make[2]: *** [liblwipboard.a] Error 1
make[2]: *** Deleting file `liblwipboard.a'
make[1]: *** [CMakeFiles/lwipboard.dir/all] Error 2
make: *** [all] Error 2


Please let me know how I can proceed.




--
Sent from: http://cmake.3232098.n2.nabble.com/
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Using CMake with TI armcl and armar

Eric Doenges
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
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

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

 

MVTec Software GmbH Logo

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Using CMake with TI armcl and armar

samyuktar

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 <[hidden email]> on behalf of Eric Doenges <[hidden email]>
Organization: MVTec Software GmbH
Date: Friday, November 8, 2019 at 12:23 AM
To: "[hidden email]" <[hidden email]>
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
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

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

 


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Using CMake with TI armcl and armar

Eric Doenges
Am 09.11.19 um 00:15 schrieb Samyukta Ramnath:
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.

As I said, the project using cgtools never went anywhere, so I never got to the point that I needed to worry about linker command files, so I can only give general hints, not a specific solution. That being said, setting CMAKE_LINKER will not work, because that specifies the executable to use as the linker. You could try adding CC11352P1_LAUNCHXL_TIRTOS.cmd with add_link_options() or target_link_options() like so:

target_link_options(<target> <path to CC1352P1_LAUNCHXL_TIRTOS.cmd>)


cmake should simply pass the command file through to the linker.

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”

CMAKE_EXE_LINKER_FLAGS should be the correct place to do this if you want any target you build with this toolchain to use --rom_model. However, if you are going to set this in the toolchain file, you should set CMAKE_EXE_LINKER_FLAGS_INIT instead. This is because cmake will set CMAKE_EXE_LINKER_FLAGS based on the contents of CMAKE_EXE_LINKER_FLAGS_INIT and compiler-specific knowledge when it encounters the project() command after reading the toolchain file.

Alternatively, you could try adding the --rom_model using the add_link_options or target_link_options commands

--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

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

 

MVTec Software GmbH Logo

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake