Cross compilation with Renesas ccrx compiler

Hi,

I was pleased to learn about the support for the Renesas CCRX compiler since version 4.1 but I am still encountering difficulties setting it up.

My crosstoolchain file defines the compiler path and other stuff

...
SET(CMAKE_C_COMPILER "${CCRX_ROOT}/bin/ccrx.exe")
...

The configure step failed with the following error. The CCRX compiler does not seem to be detected. Why ? Should I need specific definition to hepl CMake to detect the compiler ?

[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is unknown
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/Tools/Renesas/RX/2_8_0/bin/ccrx.exe
[cmake] -- Check for working C compiler: C:/Tools/Renesas/RX/2_8_0/bin/ccrx.exe - broken
[cmake] -- Configuring incomplete, errors occurred!
[cmake] CMake Error at C:/Tools/CMake/share/cmake-4.1/Modules/CMakeTestCCompiler.cmake:67 (message):
[cmake]   The C compiler
[cmake] 
[cmake]     "C:/Tools/Renesas/RX/2_8_0/bin/ccrx.exe"
[cmake] 
[cmake]   is not able to compile a simple test program.
[cmake] 
[cmake]   It fails with the following output:
[cmake] 
[cmake]     Change Dir: 'C:/Users/gallain/Documents/Sources/CMake-ccrx/build/CMakeFiles/CMakeScratch/TryCompile-r2cmwt'
[cmake]

I tried forcing the compiler with :

...
SET(CMAKE_C_COMPILER "${CCRX_ROOT}/bin/ccrx.exe")
SET(CMAKE_C_COMPILER_ID CCRX)
SET(CMAKE_C_COMPILER_ID_RUN TRUE)
SET(CMAKE_C_COMPILER_FORCED TRUE)
...

But this implies adding in my crosstoolchain :

SET(CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -output=obj=<OBJECT> <SOURCE>")

And in the CMakeLists.txt

set(CMAKE_INCLUDE_FLAG_C "-include=")

Could you tell me where I’m going wrong?

Any assistance is appreciated.

Regards,

Gildas

Which CC-RX Version are you using? For me it failed with CC-RX Version 3.1.0 but the compiler identification for version 3.7.0 did work.

Edit… Just saw it: According to your compiler location you are probably using a compiler version < 3, which seems to fail the compiler identification

For reference, this is my toolchain file:

# Toolchain file for Renesas RX Compiler
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR rx)

# Specify the cross compiler
# Note: CC-RX Version 3.1.0 does not work!!
set(TOOLCHAIN_PREFIX "C:/Program Files (x86)/Renesas/RX/3_7_0/bin")
set(CMAKE_C_COMPILER "${TOOLCHAIN_PREFIX}/ccrx.exe")
set(CMAKE_ASM_COMPILER "${TOOLCHAIN_PREFIX}/ccrx.exe") 

# Common compiler options 
#  -isa must be set, otherwise compiler identification fails
#  -nologo suppresses the logo banner on each invocation
set(CCRX_COMMON_OPTIONS "-isa=rxv2 -nologo")
set(CMAKE_C_FLAGS "${CCRX_COMMON_OPTIONS}")
set(CMAKE_ASM_FLAGS "${CCRX_COMMON_OPTIONS}")

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)

@jrast, I’m using CCRX v2.08 and now all is working fine.

The following configuration was mandatory to get the compiler detected by CMake. Try to add BIN_RX/INC_RX and TMP_RX to your Windows env.

  1. Add variable BIN_RX = C:\Tools\Renesas\RX\2_8_0\bin
  2. Add variable INC_RX = C:\Tools\Renesas\RX\2_8_0\include
  3. Add varaible TMP_RX = C:\Tools\Renesas\RX\2_8_0\
  4. Add to path : C:\Tools\Renesas\RX\2_8_0\bin

My toolchain file is now :

SET(CMAKE_SYSTEM_NAME Generic)
SET(CCRX_ROOT "C:/Tools/Renesas/RX/2_8_0")
SET(CMAKE_C_COMPILER "${CCRX_ROOT}/bin/ccrx.exe")
SET(CMAKE_C_FLAGS "-isa=rxv1 -nologo")

Regards