mbed-os/tools/cmake
Jamie Smith 32a9080c7d
Enable Arduino Nano 33 BLE (#55)
* Add upload target for Arduino Nano 33 BLE, fix linker script preprocessing, add option for USB serial by default

* astyle error

* Use HINTS instead of PATHS so that the Arduino dir is searched first

* Enable OpenOCD and PyOCD for Nano 33 BLE in SWD mode

* Fix missing dependency for USB tests on Windows

* Add RAM defines for nrf52840

* Fix mbed-storage-kv-config depending on SD card library even if said library was not enabled

* Update dsrdtr value

* No longer need to modify linker script now that we aren't using whole-archive!

* Add OPENOCD_ADAPTER_SERIAL

* Add handling for cmsis dap

* Fix typo

* Fix weak symbol issue causing Bluetooth to not work.  In this case, the weak implementation can simply be removed, because there's no legitimate case where it is used.
2022-10-16 10:32:38 -07:00
..
cores CMake: Enable improved armclang support in CMake 3.21 2021-07-23 15:56:58 +01:00
profiles CMake: Fix Mbed TLS compilation for Cortex-M0/0+/1/M23 2021-04-15 11:04:40 +01:00
tests MBED_APP_JSON_PATH should no longer be required, as some projects don't need it 2022-09-14 00:25:31 -07:00
toolchains Don't use whole-archive linking (#71) 2022-10-09 12:16:15 -07:00
upload_methods Enable Arduino Nano 33 BLE (#55) 2022-10-16 10:32:38 -07:00
CheckPythonPackage.cmake Whitespace formatting changes. 2021-02-03 14:12:29 -08:00
README.md Revert "update README for new CMake version" 2021-10-05 17:17:51 +02:00
UploadMethodManager.cmake Switch to cortex-debug plugin for VS Code to improve debugging experience 2022-09-14 00:25:31 -07:00
app.cmake Don't use whole-archive linking (#71) 2022-10-09 12:16:15 -07:00
mbed-run-greentea-test.in.cmake Fix issue with Python exit codes that masked failures (#56) 2022-09-25 09:08:56 -07:00
mbed_create_distro.cmake Don't use whole-archive linking (#71) 2022-10-09 12:16:15 -07:00
mbed_generate_config_header.cmake Write defines into a disk file instead of passing 100s of them on the command line directly. Fixes some issues with build commands on my machine, and makes it a lot easier to view the make VERBOSE=1 output. 2022-09-14 00:25:25 -07:00
mbed_generate_configuration.cmake Fix issue with Python exit codes that masked failures (#56) 2022-09-25 09:08:56 -07:00
mbed_greentea.cmake Print the command when a greentea test is being run. Also fix mbedhtrun not being on PATH causing all tests to pass! (#51) 2022-09-19 21:38:57 -07:00
mbed_ide_debug_cfg_generator.cmake Switch to cortex-debug plugin for VS Code to improve debugging experience 2022-09-14 00:25:31 -07:00
mbed_profile.cmake CMake: add mbed_ prefix to our CMake files 2021-04-14 13:09:27 +01:00
mbed_set_linker_script.cmake Enable Arduino Nano 33 BLE (#55) 2022-10-16 10:32:38 -07:00
mbed_target_functions.cmake Don't use whole-archive linking (#71) 2022-10-09 12:16:15 -07:00
mbed_toolchain.cmake Oops, missed a file 2022-09-14 00:25:32 -07: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:

  • Ambiq Micro targets
  • Analog Devices targets
  • ARM FM targets
  • ARM SSG targets
  • Cypress targets
  • Freescale targets
  • GigaDevice targets
  • MAXIM targets
  • Nordic targets
  • NXP targets
  • Renesas targets
  • Samsung targets
  • Silicon Labs targets
  • STM targets
  • Toshiba targets

The post build operations are supported for the following Mbed boards: LPC1114, LPC1768, ARCH_PRO, LPC54114, LPC546XX, FF_LPC546XX, CY8CKIT064B0S2_4343W, CYTFM_064B0S2_4343W, CYSBSYSKIT_01, ARM_MUSCA_B1, ARM_MUSCA_S1.

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:

From the application root or wherever mbed-os.lib is found, run the following command to:

  • create the Mbed OS configuration CMake module

  • create a build directory

  • generate the project configuration

  • build the project using the Ninja build system

    mbedtools compile -m <mbed-target> -t <toolchain>
    

CMAKE_BUILD_TYPE can overridden with Mbed specific values: Develop (default value), Release and Debug.

mbed-tools will pass -DCMAKE_BUILD_TYPE=<supported-build-type> for you when using the --build-type optional argument of the build subcommand as follows:

mbedtools compile -m <mbed-target> -t <toolchain> -b <supported-build-type>

If you're running CMake directly, you may need to pass it in yourself as follows:

cmake -S <source-dir> -B <build-dir> -DCMAKE_BUILD_TYPE=debug

How to build a greentea test

Install prerequisites suggested in the previous section and follow the below steps to build:

  • Set your current directory to the test suite directory

  • Run the following command for the configuration CMake module to be generated

    mbedtools configure -t <TOOLCHAIN> -m <MBED_TARGET> --mbed-os-path /path/to/mbed-os
    
  • Build the test binary with the full profile

    cd cmake_build/<MBED_TARGET>/<PROFILE>/<TOOLCHAIN>/ && cmake ../../../.. -G Ninja && cmake --build .
    

    Or build the test binary with the baremetal profile

    cd cmake_build/<MBED_TARGET>/<PROFILE>/<TOOLCHAIN>/ && cmake ../../../.. -G Ninja -DMBED_GREENTEA_TEST_BAREMETAL=ON && cmake --build .
    

Notes:

  • These steps will change when mbedtools implements a sub-command to invoke Greentea tests
  • Some Greentea tests require specific application configuration files in order to build and run successfully. For example, the connectivity/mbedtls/tests/TESTS/mbedtls/sanity test requires the configuration file found at TESTs/configs/experimental.json.

Naming convention

  • mbed namespace: Mbed CMake targets must have mbed- prefix
  • all characters are lower case
  • words separated by hyphens

For example: mbed-ble-cordio