[CMake] XMOS ASM / C Compiler support progress and questions

Alexander Neundorf a.neundorf-work at gmx.net
Wed Oct 12 15:37:44 EDT 2011


Hi,

On Wednesday 12 October 2011, Bernhard Sputh wrote:
> Hi List,
> 
> I'm currently working on better integrating the XMOS toolchain [1]
> (version 11.2.2) into CMake 2.8.5, among other things (such as TI
> C6000 support). 

Cool :-)
Please create an entry in the bug tracker for that, so it doesn't get lost.

> I've today managed to integrate the detection of the
> XMOS assembler. Basically, all I had to do is to insert these three
> lines in the file CMakeDetermingASMCompiler.cmake (find my modified
> version attached, feel free to include in future versions):
> 
> LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XMOS )
> SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XMOS "--version")
> SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XMOS "XMOS Limited")
> 
> Furthermore, the file XMOS-ASM.cmake (attached, may be included as
> well) has to be added to Modules/Compilers/. In this file the valid
> extensions get set, which in our case are xc (special language from
> XMOS to program their CPUs), s and S. I'm cheating a bit when
> specifying the assembler executable because I use xcc instead of xas,
> but this is necessary in order to get the xc-files processed
> correctly. I'll clean this up at one point, but this workaround has
> worked for us the past two years, and nothing lasts longer than a
> working workaround.

Since 2.8.5 the "ASM" language is the one to use for assembler files which are 
processed by the C or C++ compiler, i.e. which may need to be preprocessed.
I.e. you shouldn't even have to set CMAKE_ASM_COMPILER, when enabling ASM it 
will use the value of CMAKE_C_COMPILER for CMAKE_ASM_COMPILER.

> The toolchain file to use looks as follows:
> 
> SET(CMAKE_SYSTEM_VERSION 2.8)
> INCLUDE(CMakeForceCompiler)
> SET(CMAKE_SYSTEM_NAME generic)
> CMAKE_FORCE_C_COMPILER(xcc GNU)
> CMAKE_FORCE_CXX_COMPILER(xcc GNU)
> SET(CMAKE_COMPILER_IS_GNUCXX 1)
> SET(CMAKE_ASM_COMPILER "xcc")
 
Why do you set the compiler id to GNU ?
That's not a good idea I'd say.
 
> I would prefer to not to have not force the compiler, but the recent
> XMOS toolchain require an additional command line argument to specify
> the processor to compile for: `-target'. As far as I'm aware there is
> no way to pass additional compiler flags to the compiler checking
> operations.

How does the syntax look exactly ?

xcc -target Foo ....
or
xcc -target=Foo ...
?

In the second case, it should work if you do
set(CMAKE_C_COMPILER xcc -target=Foo)

Alex


More information about the CMake mailing list