Skip to content

brondani/cmsis-pack-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CMSIS-Pack-Utils: CMake module PoC

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.

Prerequisites

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 and csolution

  • yq: for converting YAML into JSON for using CMake parser

How to use

  1. Add the module into the CMAKE_MODULE_PATH and include it in the project's CMakeLists.txt:
include(CMSIS-Pack-Utils)
  1. Add the function add_cmsis_library into the CMakeLists.txt:
add_cmsis_library(
  target
  device
  compiler
  packs
  components
)
  • target: cmsis target library name, freely chosen
  • device: device identifier according to the csolution device name convention
  • compiler: one of the supported compilers supported by csolution [AC6, GCC, IAR]
  • packs: list of required pack identifiers according to the csolution pack name convention.
  • components: list of required component identifiers according to the csolution component name convention.
  1. Specify the generated cmsis library among the project dependencies. For example:
target_link_libraries(MyEmbeddedProject cmsis-lib)

Configuration

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.

Example

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

About

CMSIS-Pack-Utils: CMake module PoC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages