cancel
Showing results for 
Search instead for 
Did you mean: 

What is the relationship between STM32 HAL drivers and Keil CMSIS-Drivers?

ziffusion
Associate

Please help me understand the relationship / layering between STM32 HAL drivers and Keil drivers.

  1. Is it fair to say that STM32 HAL drivers are layered above CMSIS-CORE?
  2. Is it fair to say that Keil drivers are CMSIS compliant (CMSIS-Drivers), also layered above CMSIS-CORE?
  3. Are these two sets of drivers equivalent (functionality / scope)?

Keil DFP seems to include STM32 HAL drivers. But they also provide their own drivers, which I assume are CMSIS-Drivers.

  1. Does that mean that you have two flavors of drivers available to you - STM32 HAL drivers and Keil CMSIS-Drivers?
  2. What is the layering for the Keil drivers? Are they layered on top of STM32 HAL at all? Or is CMSIS-CORE their only dependency?

Thanks for your help!

1 REPLY 1
KnarfB
Principal III

CMSIS = Common Microcontroller Software Interface Standard is from ARM. CMSIS-Core is a (mostly?) "header only" software view of the MCU containing register&bit definitions for the ARM core and STM32 peripherals like SPI. It is good for register level programming from

GPIOB->BSRR = GPIO_PIN_3;

for switching a LED, to sophisticated peripheral programming. Register and bit naming highly corresponds to the STM32 reference manuals and the debugger SFR view (.svd files). CMSIS-Core contains few functions for ARM components like NVIC and startup.

HAL builds up upon this with its own API. Some use it, some don't. You may mix both, e.g. let STM32CubeMX generate code for clock initialization and peripheral setup and use register-level prog for a time-critical interrupt handler. HAL makes starting easier, but you may hit its limits or bugs in complex scenarios.

Haven't used the Keil driver API, but IIRC have seen them using HAL. Might be useful if you need some cross-vendor compatability. Sure, CMSIS has some extras like FFT, DSP,... not covered by STM32 HAL at all.

hth

KnarfB