[CMake] [Dev] CMake 2.5 tool chain support example
Trevor Kellaway
tkellaway at asl-electronics.co.uk
Mon May 28 13:24:18 EDT 2007
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
> ${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
"${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER}-${CMAKE_SYSTEM_PROCESSOR}.cmak
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 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.
> Why are CMAKE_C_COMPILER, CMAKE_CXX_COMPILER not in the
> toolchain file ?
> This would then automatically disable also
> CMAKE_SKIP_ASSEMBLY_SOURCE_RULES,
> CMAKE_SKIP_PREPROCESSED_SOURCE_RULES (which you do currently
> manually).
Err, because I didn't know this! <g>
> 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.
- TrevK
More information about the CMake
mailing list