Skip to content

Project Setup: Command Line

Jamie Smith edited this page Aug 28, 2022 · 9 revisions

This page will show you how to take an existing Mbed CE project and build it using command line tools.

  1. Open a terminal in the project directory.
  2. Make sure you have the needed Python requirements: python3 -m pip install -r mbed-os/tools/requirements.txt (use python instead of python3 on Windows)
  3. Create and enter a build directory: mkdir build && cd build
  4. Run CMake: cmake -GNinja -DCMAKE_BUILD_TYPE=Develop .. -DMBED_TARGET=<your mbed target>
    • Valid options for the MBED_TARGET option are any supported Mbed OS board target, such as LPC1768 or NUCLEO_F429ZI
    • The Develop build type is recommended for normal development work, but there is also the Debug build type which disables optimizations, and the Release build type which disables debug information.
  5. Build the project by running ninja
  6. If the project has an executable which can be flashed, run ninja flash-<executable> to upload it to a connected device.