Electronic – STM32F4 – CMSIS & Board Specific Libraries

armstm32stm32f4

I recently purchased a STM32F4 board to learn the ARM architecture. I am fairly comfortable with embedded programming having worked with AVR series for about a year.

I was going through this tutorial at here

In this the author has mentioned that usually in the ARM boards world, you have 2 set of libraries:

  1. Cortex M Software Interface Standard (CMSIS) – general HAL layer/interface for Cortex M specific features
  2. STM32 libraries – specifically for the onboard peripherals on the STM development board (I2C, SPI, CAN etc)

The author also mentions that just like any HAL layer, the purpose of these is for one to quickly develop rather than waste time on setting things up.

Coming from AVR side where I am using minimal/no libraries and setting up everything by hand (for example spi configuration, rx and tx interrupt driven functions etc) I find this bit strange. By using the STM specific libraries, wouldn't one be constricted to using their microcontrollers only? Then in future if I use some other vendors chip, I'll have to learn to use their specific library

I would like to get an opinion that if this is the right way to go. Being new to ARM should I just use these libraries for now till I become more comfortable or should I from the start get into the habit of doing everything myself?

The idea is to lean ARM independently of any vendor specific board or microcontroller.

Best Answer

I strongly recommend the libraries. A big advantage of cortex M is to be able to easily move your code to other members of the same family (i.e. STMF0 to STMF4), or even to different manufacturers, and you lose this advantage if you don't use the libraries.

BTW, many vendor specific libraries are CMSIS compliant.

I've avoided families that don't supply CMSIS compliant libraries. Also, I've not tried STM Cube for much the same reasons.