August 2017 DocID030752 Rev 2 1/32
1
AN5044
Application note
STM32 standard peripheral library to
STM32Cube low-layer migration
Introduction
Part of the STM32 value proposition is the availability of complete and full firmware libraries,
providing developers with an initial framework to build their embedded application.
The central brick of this framework is the well-known Standard Peripheral Library (SPL),
which is used by all the middleware components to access STM32 peripherals.
Over years, the STM32 portfolio has continued to grow and to offer to developers a variety
of solutions for balancing cost, power and performance, notably the STM32Cube Low Layer
(LL) drivers.
For designers of STM32 microcontroller applications, it is important to be able to easily
upgrade the microcontroller type and/or a firmware solution to another. This migration is
often needed, since the development for the SPL has stopped and when product
requirements and specifications grow, putting extra demands on the variety of used
peripherals.
This application note shows the steps to migrate from an existing STM32-based application
developed under the STM32 SPL to any one of the other microcontroller types using the
STM32Cube LL drivers.
This application note groups together all the most important information needed for a
successful migration of STM32 SPL-based application to STM32Cube LL APIs usage.
It is composed of three sections:
STM32 SPL vs. STM32Cube LL Architecture Overview: presenting a description of both
solutions and a comparison between both.
STM32 SPL to STM32Cube LL Manual Migration: detailing the steps to migrate manually
an application based on standard peripheral library.
STM32 SPL to STM32Cube LL Automatic Migration: presenting the SPL2LL-Converter
migration tool as a solution for automatic migration of StdPeriph-based application.
www.st.com
Contents AN5044
2/32 DocID030752 Rev 2
Contents
1 STM32 SPL vs. STM32Cube LL architecture overview . . . . . . . . . . . . . 5
1.1 STM32 SPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Inclusion Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 STM32Cube Low Layer drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.2 Inclusion model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.3 APIs definition levels and classification . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 STM32 SPL to STM32Cube LL manual migration . . . . . . . . . . . . . . . . 14
2.1 STM32 SPL and STM32Cube LL APIs equivalence . . . . . . . . . . . . . . . . 14
2.1.1 NVIC interrupt configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1.2 Peripheral drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.3 Migration cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2 Project creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3 STM32 SPL to STM32Cube LL automatic migration . . . . . . . . . . . . . . 20
3.1 SPL2LL-Converter migration tool specifications . . . . . . . . . . . . . . . . . . . 20
3.1.1 Overview and features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.2 SPL2LL-Converter migration tool block diagram . . . . . . . . . . . . . . . . . . 22
3.2 SPL2LL-Converter migration tool usage guidelines . . . . . . . . . . . . . . . . . 23
3.2.1 Migration tool package architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.2 SPL2LL-Converter migration tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.3 User application migration steps with initial application environment . . 27
3.2.4 User application migration steps using available LL templates . . . . . . . 28
3.2.5 SPL2LL-Converter migration tool limitations . . . . . . . . . . . . . . . . . . . . . 28
3.2.6 GUI application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31