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

Alexander Neundorf a.neundorf-work at gmx.net
Wed Jun 6 16:58:37 EDT 2007

Hi Trevor,

On Monday 28 May 2007 13:24, Trevor Kellaway wrote:
> Alex,
> > > Attached is an example set of scripts for adding tool chain support
> > > for Freescale HC12 embedded 16-bit microcontroller. This is
> >
> > intended
> >
> > > as a demonstration to others for how to add additional tool chain
> > > support (see the ReadMe.txt in the ZIP).
> >
> > Thanks for your efforts, this looks really good !
> > But before publishing this as tutorial, please wait until
> > everything is tested a bit more and we found the final form
> > for everything.
> 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
> > SOR}.cmake
> > # sets the flags for the processor
> >
> > What do you think about this ?
> I don't see any difference between
> e" as they are both for the same family and use the same settings.
> ${CMAKE_C_COMPILER} isn't really "HC12", it is actually "chc12.exe", so
> this could be misleading.

I checked in a change in cvs yesterday.

Now cmake tries to load:


So if you set up CMAKE_MODULE_PATH to point to some directory where you have 
your cmake files, and if you set CMAKE_SYSTEM and CMAKE_SYSTEM_PROCESSOR 
accordingly, it should work (if you put them in a subdir "Platform").
I suggest the following:
Generic.cmake       // basically empty, will be added to cmake
Generic-chc12.cmake // rules for this compiler, might be added to cmake
Generic-chc12-MySpecificTargetHardware.cmake // everything for your target
                    // hardware, in general no such file will be added to
                    // cmake, since this is very user specific

This might now already work if you simply specify CMAKE_SYSTEM, 
CMAKE_SYSTEM_PROCESSOR and CMAKE_C_COMPILER via -D from the command line 
(i.e. without toolchain  file).

Let me know how this works for you.


More information about the CMake mailing list