[CMake] [Dev] CMake 2.5 tool chain support example

Alexander Neundorf a.neundorf-work at gmx.net
Tue May 29 09:13:07 EDT 2007


Hi,

On Monday 28 May 2007 13:24, Trevor Kellaway wrote:
> Alex,
...
> No problem, when everything is stable I was intending to create a Wiki
> page for this, with extracts from this example.
>
> > Some questions/notes:
> > You are using HC12_CORE. I'm still wondering whether
> > standardizing on CMAKE_SYSTEM_PROCESSOR (which already
> > exists) would be a good idea to use for this.
>
> As Kishore said the problem is that for microcontrollers there is
> normally a family and a specific processor. In this case "HC12" is the
> family, the actual processor is a "MC9S12DP512".
>
> > Maybe the system type should be set to "Generic". Then cmake
> > could automatically try to load ${CMAKE_SYSTEM_NAME}.cmake #
> > does probably nothing ${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER}.cmake
> > # "Generic-hc12.cmake", sets compiler rules and
> > ${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER}-${CMAKE_SYSTEM_PROCES
> > SOR}.cmake
> > # sets the flags for the processor
> >
> > What do you think about this ?
>
> I don't see any difference between
> "${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER}.cmake" and

This one should contain the compile rules for this compiler, common to all 
targets this compiler supports (so if chc12.exe supports only hc12, this 
could also be hc12-family-settings I think).

> "${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER}-${CMAKE_SYSTEM_PROCESSOR}.cmak
> e" as they are both for the same family and use the same settings.

And here CMAKE_SYSTEM_PROCESSOR could be the specific target, 
e.g. "ASL-productxyz-MC9S12DP512". 
I'm not sure we need the "family" level. The compiler file can specify the 
rules for this type of compiler (e.g. gcc, iar, sdcc), and 
the "most-specific" file can specify the exact switches for the actual 
target. E.g. what should be put into ecos-gcc-arm.cmake vs. 
ecos-gcc-ppc.cmake ? The final target will probably need its own fine-tuned 
options. 

> ${CMAKE_C_COMPILER} isn't really "HC12", it is actually "chc12.exe", so
> this could be misleading.
>
> I can see merit in your approach, for my core type, but I also need some
> way of easily embedding the memory model. I'll think about this some
> more, as none of our proposals feel right yet.

Same here.

...
> I've just tried this, adding "SET (CMAKE_C_COMPILER "chc12" CACHE STRING
> "Tool chain C compiler")" and removing CMAKE_SKIP_ASSEMBLY_SOURCE_RULES
> and CMAKE_SKIP_PREPROCESSED_SOURCE_RULES, but the makefile still
> contains the .i and .s rules, so this doesn't appear to disable these
> (and why should it?)

Oh, indeed. You get "feature not implemented", right ?
I thought not having a rule for these two targets would avoid the creation of 
these targets.

> > I'm not sure about the -opt.cmake file. Can't this simply be
> > done in the CMakeLists.txt ?
>
> It could, but I want to be able to move source code to another processor
> environment without editing its CMakeLists.txt, having the "-opt" allows
> me to do this, it also makes importing existing projects easier.

Hmm, ok.

Bye
Alex


More information about the CMake mailing list