Skip to content
Borys Jeleński edited this page Jul 2, 2020 · 7 revisions

nRF5 CMake is a solution for creating, maintaining and building projects based on CMake for the nRF52 Series of SoCs manufactured by Nordic Semiconductor. It consists of CMake scripts, additional utility scripts, CMake files generation system and Continuous Integration infrastructure. We support all SoCs and development boards from the nRF52 Series. nRF5 CMake covers an extensive range of libraries and examples available in the nRF5 SDK starting from version 15.3.0. Furthermore, our solution is cross-platform and works on Windows, Linux and macOS.

What problems we are addressing?

If you have some experience with embedded programming, you are most likely aware that the development environment for creating software for microcontrollers is far from trivial. Embedded developers often need to worry about their toolchain, compile flags, linker scripts, startup files and other intricacies in order to create a proper binary executable. Sure, you can use an IDE which will take care of most of these problems but you will probably sacrifice the flexibility and cross-platform capability that a tool such as CMake provides. We combine the flexibility of CMake with an ease of setting up an nRF52 project so you can focus on developing the application.

The nRF5 SDK is an extensive package containing a wide variety of drivers, libraries and modules. More complex libraries from the SDK are created using more basic ones which in result makes manually pulling the libraries you need into your project difficult as you have to identify their dependencies and setup all the necessary source files and include directories. The nRF5 CMake simplifies this process greatly as we track the dependencies of all the libraries we support and whenever you specify the library you need, our script automatically pulls all the dependencies of that library too. In the end, you only need to specify the top-level libraries you are going to use in your code directly.

Sometimes, you might want to migrate your project to a different SoC from the nRF52 Series from the one you started your development with. You may either want to reduce the BOM cost by moving to the lower-end SoC like nRF52810 or maybe you've realized you're going to need the extra Flash and RAM and decided to migrate to the nRF52840. Either way, in most cases, you can build the project for different nRF52 SoCs using the same, universal CMakeLists.txt file allowing easy migration.

Features

Here are some useful features of the nRF5 CMake meant to ease you development with nRF52:

  • Consistency checks making create an incorrect build less likely.
  • Build system targets for erasing the target's Flash and programming the application and SoftDevice using SEGGER J-Link and nrfjprog e.g. make flash, make erase etc.
  • Fine control over libraries used in your project so you can use only what you need.
  • Library groups for quick setup by less experienced users.
  • Support for the official examples from the nRF5 SDK which you can use as a starting point for your application.

Prerequisites

Before you start using the nRF5 CMake, you should have a general idea how the nRF5 SDK is organized and how its major components are related to each other. In particular, you should know about nrfx drivers, SoftDevice, SDK configuration file and some commonly used libraries like app_timer, app_scheduler, nrf_log etc. If you're new to nRF52 development, follow the official Getting Started guide for the nRF5 SDK.

On the other hand, you should be familiar with CMake with an emphasis on so called Modern CMake as our CMake scripts rely heavily on targets and requirement propagation. The Awesome CMake provides a comprehensive list of resources for learning CMake.

Known limitations

While we took a lot of effort for making the nRF5 CMake as complete as possible, it is still a work-in-progress project as we keep working on addition support for more libraries, modules, examples. Here are some major aspect which are not currently supported but in the near future (possibly with your help), they might be:

  • No support for ANT stacks and libraries
  • No support for NFC libraries
  • No support for toolchains other than GNU Arm Embedded Toolchain
  • Programming and erasing the device limited to SEGGER J-Link debug probes and nrfjprog
Clone this wiki locally