C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches
Integrating vendor SDKs

As mentioned before, CMRX does not provide any OS-specific HAL or SDK. You have to integrate vendor-provided HAL. This way, the use of CMRX is as non-intrusive as technically possible. CMRX itself - being a microkernel - uses only minimalistic set of peripherals, almost exclusively only peripherals residing on Cortex core itself. Only architecture dependent part of the kernel code is ever using these peripherals. This part is always written with some HAL in mind. For example the default ARM port is written using CMSIS standard. CMSIS standard is quite broad but minimalistic needs of CMRX kernel can usually be satisfied by the basic CMSIS device header. This header is often present in vendor SDK for a microcontroller in some form usable by the CMRX.

Second part usually present in the vendor SDK is the linker script for your target device which declares base addresses of RAM and FLASH and defines regions for code, data, bss and others. This script is needed to link the binary correctly. CMRX needs this scriupt to be manipulated in order to enable memory protection.

Third part of vendor SDK are the startup and system source files. They might or might not be present, or may be present in slightly different organization. Here vendors are creative and mostly ignore CMSIS standard.

As long as the CMRX kernel itself is concerned, this is all that is needed from the vendor SDK. Your application's need will usually be bigger as you might want to use peripheral drivers and utility libraries provided by the SDK. While the range and way of using these vary from project to project, CMRX does not deal with these at all. It is up to integrator to include them into project.

CMSIS helper

To make integration of CMSIS HAL for needs of the CMRX easier, there is small CMake module which helps to find various CMSIS components and set up defines. This module is called FindCMSIS.cmake. This module will determine include paths for core CMSIS headers and try to find startup and system components of CMSIS, if available. It will copy the linker file to location CMRX expects to find one.

The basic use of FindCMSIS is like:

set(CMSIS_ROOT <path to where CMSIS is located in vendor SDK>)
set(DEVICE <device name recognized by the vendor SDK>)
set(CMSIS_LINKER_FILE <location of the linker file>)
include(FindCMSIS)

If necessary CMSIS components are found, then following is done:

  • library cmsis_core_lib is created. This is an interface library that propagates include paths to all headers of CMSIS core. This ensures that the CMSIS headers can be included into CMRX source. ARM port based on CMSIS HAL expects this library to exist while compiling.
  • file RTE_Components.h is creates in CMAKE_BINARY_DIR. This file contains an alias to device file as per CMSIS specs, so the CMRX kernel code is device-independent. ARM port based on CMSIS HAL expects this file to exist.
  • linker file is copied into file named gen.<DEVICE>.ld into CMAKE_BINARY_DIR. This is where CMRX expects to find the device linker script. If linker script provided in variable CMSIS_LINKER_FILE does not exist, then FindCMSIS will fail with error.
  • variable CMSIS_SRCS is defined which contains list of files found that compose the CMSIS core. Only files named according to CMSIS specs are detected. These files are not handled automatically, rather it is the integrator's task to handle them in a way the vendor SDK is designed to do.