mbed-os/tools/cmake
Hugues Kamba 66f65c0e89 CMake: Fix third party toolchain file suppport
Compile defintions are always included. However, functions that set compile options
are only called if a third party toolchain file is not used
2020-11-06 17:25:23 +00:00
..
cores CMake: Create separate function to set MCU core compile defintions 2020-11-06 17:25:23 +00:00
profiles CMake: add mbed-os and mbed-baremetal targets 2020-11-06 17:25:22 +00:00
toolchains CMake: Set compile defintions for supported toolchain at top level input source file 2020-11-06 17:25:23 +00:00
README.md CMake readme: update mbed-tools to 3.4 2020-11-06 17:25:23 +00:00
app.cmake CMake: Fix third party toolchain file suppport 2020-11-06 17:25:23 +00:00
core.cmake CMake: Rename Mbed OS path variable for consistency 2020-11-06 17:25:23 +00:00
profile.cmake CMake: Rename Mbed OS path variable for consistency 2020-11-06 17:25:23 +00:00
toolchain.cmake CMake: ninja reponse files disabled for ARMClang on Windows 2020-11-06 17:25:23 +00:00

README.md

CMake for Mbed OS

In order to replace the traditional Mbed tools, we are adding CMake support to allow the generation of build systems instructions to build Mbed OS as a library.

This is still at the experimental stage and still in development. It does not yet completely replace our current build tools. If you find a bug, please report it or raise a pull request as contributions are welcome!

Mbed OS is built as collection of all core libraries. Application project executables can be linked with the mbed-os library (which includes the core libraries of Mbed OS) and optional mbed-os- prefixed libraries depending on the additional features required by the projects and supported by the Mbed target.

The list of optional libraries for each component can be seen in the CMake input source file at the root of each component directory.

The following features are not yet supported and will be progressively added:

  • Application profile selection (bare metal)
  • Features that require altering compiler/linker command line options (except for printf library and C selections)

The full profile with the selected printf and C libraries.

Supported targets

Only a limited set of targets is supported at the moment.

The following targets are supported:

  • DISCO_L475VG_IOT01A
  • K64F
  • K66F
  • NRF52840_DK
  • NUCLEO_F303K8
  • NUCLEO_F401RE
  • WIO_3G

Supported toolchains

Arm Compiler 6 and GNU Arm Embedded toolchains are supported.

Examples

Supported examples can be identified by the presence of a top level CMakelists.txt input source file.

Known issues

How to build an application

Prerequisities:

  • CMake >=3.19.0
  • mbed-tools >=3.4.0

From the application root or wherever mbed-os.lib is found:

  1. Run the following command to create the Mbed OS configuration CMake module:

    mbedtools configure -m <mbed-target> -t <toolchain>
    
  2. Run the following command to create a build directory, generate the project configuration and build the project using Ninja:

    mkdir build && cd build && cmake .. -GNinja && cmake --build .
    

The default build type is Develop. Use CMAKE_BUILD_TYPE to select Develop, Release or Debug as follows:

cmake .. -GNinja -DCMAKE_BUILD_TYPE=<supported-build-type> && cmake --build .