My interest in ARM Cortex-M3 based micros recently turned into some practical exercises with
STM32-H103, GCC and
Cortex Microcontroller Software Interface Standard (CMSIS) library. CMSIS is a useful set of definitions of Cortex-M0/M3 core architecture registers, data structures and interfaces to access core resources of a Cortex-M0/M3 based microcontroller. However, if you use GCC with CMSIS (v1.2.0 or v1.3.0) the definition of
__INLINE
macro provided in
core_cm3.h
and
core_cm0.h
:
#define __INLINE inline
does not force the compiler to actually inline the body of a function defined with
__INLINE
attribute. To tell GCC to inline the define should be:
#define __INLINE __attribute__((always_inline)) inline
Furthermore,
__get_xxx
,
__set_xxx
,
__LDREX
,
__STREX
groups of a single assembly line functions implemented as a regular functions as oppose to inline functions. Change of these functions to inline style allowed two times improvement of the performance of certain fragments of my code.