Tips and Tricks – Introduction to ARM CMSIS

Microcontrollers have become extremely sophisticated over the last decade and developing firmware from scratch starting with the reset vector is quickly becoming a thing of the past.  Software complexity is increasing at an exponential rate and causing developers to rely on and leverage 3rd party components at an ever increasing rate.  In order to ease software integration efforts and the possibility for incompatibility, a consortium of silicon and tool vendors along with ARM developed the CMSIS (pronounced see-M-sys) standard.

CMSIS stands for Cortex Microcontroller System Interface Standard and consists of five separate pieces; CMSIS core, CMSIS RTOS, CMSIS DSP, CMSIS SVD, and CMSIS DAP.  CMSIS is not an abstraction layer that dumbs down the peripherals but instead it standardizes the way in which a developer accesses the Cortex-M core and registers.  CMSIS provides developers with a common interface that can be used no matter what silicon vendor is selected.  An overview of how the five pieces interact can be seen in Figure 1.

ARM_CortexM_CMSIS_largeFigure 1 – ARM CMSIS

CMSIS Core provides a number of useful features for developers that ease the pressure when trying to get a microcontroller up and running.  The first, is a set of functions and macros that can be used to access Cortex-M registers such as interrupt control in addition to start-up code such as oscillator selection and configuration.  CMSIS core provides a standard naming convention for device peripheral registers which helps make code portable and also readable.  For example, Figure 2 shows a comparison of how the system tick peripheral would be setup without the use of CMSIS vs the use of CMSIS.

CMSIS-ISR Figure 2 – CMSIS SysTick Example

CMSIS RTOS provides a set of functions that interact with an RTOS.  The functions act as a wrapper so that different RTOS’s can be used without heavy modification to the code base.  A great example and the first available example of an open source CMSIS compliant RTOS is Keil RTX RTOS.

CMSIS DSP is only available on the higher end Cortex-M4 family that has the capability to perform DSP functions.  The CMSIS DSP provides a library of over 60 DSP math functions that are commonly used by embedded software developers.

CMSIS SVD and CMSIS DAP are standards more for silicon and tool vendors than for embedded software developers.  CMSIS SVD provides an XML format that is used by the system viewer to provide MCU peripheral register descriptions.  CMSIS DAP provides the standard for the debug access port.

There are several advantages that developers will want to keep in mind when considering CMSIS.  The first, is that CMSIS provides an avenue for portability and reuse through the common specifications that it provides.  Second, CMSIS follows the MISRA C conventions in addition to being ANSI-C compliant which allows even safety critical developers to make use of the standard.  Finally, all of the CMSIS software is documented using Doxygen.

 

Share >

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.