CMake build system for RTEMS

Nickolay Kolchin nbkolchin at
Mon Jul 25 01:56:56 UTC 2016

CMake build system for RTEMS

Nickolay Semyonov <snob at>
Version 0.5


1. Use ninja as build tool to improve compile time performance.
2. Get rid of Cygwin/MSYS on Windows. I.e. under Windows we need only
cmake and ninja.
3. Better dependencies tracking.


- No changes to RTEMS source code were made
- Only i386 currently supported. PowerPC (QoriQ) will be pushed in next
- All checks 'really used in RTEMS code' are performed. I.e. we check for
  functions, include files, prototypes, type sizes, etc.
- 99% samples, sptests, libtests, tmtests, psxtests and psxtmtests are
- 4.11 branch was used. Can be easily adopted to 4.12.

Sample usage:

  $ git clone -b cmake rtems-cmake
  $ cd rtems-cmake
  $ mkdir .build
  $ cd .build
  $ cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/cc/i386.cmake ..
  $ ninja

Samples will be in 'testsuites/samples'.

Technically we demonstrate that everything from current RTEMS build system
be done in CMake.

We are interested in inclusion this in official RTEMS and are ready to
support if required.

Comparison with Autotools

It should be noted that currently autotools and cmake build different
code sets, so direct comparison is unfair. But I don't think numbers will
change drastically.

Also on Windows, performance gap is much wider due to Cygwin/MSYS slowness.

TODO: Windows benchmarks.

Tested on Macbook Pro, Retina, Mid 2012, 2,7 GHz Intel Core i7, 16GB.

On all tests 'ninja' wass executed as 'ninja' without additional arguments.

Make was executed with '-j9'.

Configure line:

  --target=i386-rtems \
  --enable-rtemsbsp=pc386 \
  --enable-cxx=yes \

  "-DCMAKE_TOOLCHAIN_FILE=../cmake/cc/i386.cmake -GNinja

CMake "debug" addition: "-DCMAKE_BUILD_TYPE=Debug".
CMake "release" addition: "-DCMAKE_BUILD_TYPE=Release"

Complete testsuite build (--enable-tests)

- autotools bootstrap: 9m27.421s.
- autotools configure: 0m12.043s.
- autotools make: 5m15.640s
- autotools make (without changes): 0m19.523s
- autotools make clean: 0m4.509s
- autotools make (after clean): 3m50.755s

- cmake: 0m7.470s
- ninja (default): 0m43.871s
- ninja (debug): 2m34.534s
- ninja (release): 1m17.895s
- ninja (without changes): 0m0.210s
- ninja clean: 0m0.528s
- ninja (after clean): 0m43.288s

After changing 'cpukit/score/include/rtems/system.h':

- autotools make: 3m46.446s
- ninja (default): 0m40.253s

After changing 'cpukit/rtems/src/clockgettod.c' (real code change):

- autotools make: 0m20.993s (tests NOT rebuild !!!)
- ninja (default): 0m7.871s (tests rebuilded)

Only samples build from testsuite

- autotools configure: 0m12.043s.
- autotools make: 1m30.290s

- cmake: 0m5.807s
- ninja (default): 0m19.323s
- ninja (debug): 0m32.176s
- ninja (release): 0m31.434s


- For automated CI with 'pull, bootstrap, configure, make' build cycle,
  time difference is sounding.
- For 'normal' development 2.5x-5x time improvement is also nice.

Things not implemented

- 'managers' selection. Not sure about that. Never used this stuff.
- RTEMS_MULTIPROCESSING support. Need instructions for testing.
- RTEMS_SMP. On TODO list. Currently we don't have multicore systems in
  production, but this can be emulated in qemu-i386 as I understand.
- wrapup. High priority. Currently we don't combine RTEMS libraries in
  and rtemsbsp. We don't like manual repacking process, but direct linking
  require changes in RTEMS source code.
- Documentation. Low priority.
- We generate 'exe' file as RTEMS_XXX_EXECUTABLE result. No 'nxe', 'ralf',
  'bin' or other. It is assumed, that 'exe' file is passed directly to CI
  firmware making script.
- ADA support. Need help with testing.
- jffs2, zlib. On TODO list.
- drvmgr. Need help with testing.
- nfsclient. On TODO list, low priority.
- tar tests. On TOOD list.
- Building several BSP at once. This can be done. Low priority.
- Makefile compatibility. This will be pushed in next days.
- libdl. Need help with testing.
- 'rel' files are dropped. They are needed for 'managers' and probably to
  improve code locality. Currently no plans for support.
- Consider using 'FeatureSummary' for RTEMS configuration options.
- RTEMS_NEWLIB is always TRUE. I'm not sure if RTEMS can be compiled
- native tools are not build. I.e. no bin2boot.
- CPack support and RTEMS_C_EXECUTABLE recipe will be pushed in next days.
- Support for Eclipse, QCreator and CLion project creation via CMake is not
  tested. 100% includes won't show in project list. No plans to support

P.S. I'm aware about 'waf' build system for RTEMS, but haven't checked. It
would be interesting to compare performance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list