The CMake module CMSIS-Pack-Utils.cmake
is an experimental proof of concept for yet another approach aimed at closing the gap between generic CMake based projects and CMSIS-Packs. It generates csolution.yml
and cproject.yml
and orchestrates calls to csolution
and cpackget
to download required packs and generate build instructions. It parses the generated cbuild.yml
for getting source files, include paths and defines and then it generates CMake library targets. Several limitations such as device attributes, pre-includes and generators handling are currently not addressed in this PoC.
The following applications are required to be installed before calling functions from CMSIS-Pack-Utils
. Make sure they are in the system PATH
.
-
CMSIS Toolbox 2.0.0: for using
cpackget
andcsolution
-
yq: for converting YAML into JSON for using CMake parser
- Add the module into the
CMAKE_MODULE_PATH
and include it in the project'sCMakeLists.txt
:
include(CMSIS-Pack-Utils)
- Add the function
add_cmsis_library
into theCMakeLists.txt
:
add_cmsis_library(
target
device
compiler
packs
components
)
target
: cmsis target library name, freely chosendevice
: device identifier according to thecsolution
device name conventioncompiler
: one of the supported compilers supported bycsolution
[AC6
,GCC
,IAR
]packs
: list of required pack identifiers according to thecsolution
pack name convention.components
: list of required component identifiers according to thecsolution
component name convention.
- Specify the generated cmsis library among the project dependencies. For example:
target_link_libraries(MyEmbeddedProject cmsis-lib)
The location of the pack repository can be configured by setting the environment variable CMSIS_PACK_ROOT
. By default the module CMSIS-Pack-Utils
uses the folder ${CMAKE_BINARY_DIR}/cmsis-packs
.
The location of configuration files and related PLM
files belonging to CMSIS components is set to ${CMAKE_CURRENT_LIST_DIR}/${target}/RTE
.
The HelloWorld example uses the open-iot-sdk
toolchain setup as it's done in other open-iot-sdk examples. Make sure CMake
, ninja
and ARMClang
are available on the PATH before running this example.
Configure:
cmake -B __build -GNinja --toolchain=toolchains/toolchain-armclang.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m4
Build:
cmake --build __build