AN2606
Application note
STM32 microcontroller system memory boot mode
Introduction
The bootloader is stored in the internal boot ROM memory (system memory) of STM32
devices. It is programmed by ST during production. Its main task is to download the
application program to the internal Flash memory through one of the available serial
peripherals (USART, CAN, USB, I
2
C, SPI, etc.). A communication protocol is defined for
each serial interface, with a compatible command set and sequences.
This document applies to the products listed in
Table 1.
They are referred as STM32
throughout the document.
Table 1. Applicable products
Type
Part number or product series
STM32L0 series: STM32L051xx, STM32L052xx, STM32L053xx, STM32L062xx,
STM32L063xx
STM32L1 series.
STM32L4 series: STM32L476xx, STM32L486xx
STM32F0 series: STM32F03xxx, STM32F04xxx, STM32F05xxx, STM32F07xxx
STM32F1 series.
Microcontrollers STM32F2 series.
STM32F3 series: STM32F301xx, STM32F302xx, STM32F303xx, STM32F318xx,
STM32F328xx, STM32F334xx, STM32F358xx, STM32F373xx,
STM32F378xx
STM32F4 series: STM32F401xx, STM32F405xx, STM32F407xx, STM32F411xx,
STM32F415xx, STM32F417xx, STM32F427xx, STM32F429xx,
STM32F437xx, STM32F439xx, STM32F446xx
The main features of the bootloader are the following:
•
•
It uses an embedded serial interface to download the code with a predefined
communication protocol
It transfers and updates the Flash memory code, the data, and the vector table sections
This application note presents the general concept of the bootloader. It describes the
supported peripherals and hardware requirements to be considered when using the
bootloader of STM32 devices. However the specifications of the low-level communication
protocol for each supported serial peripheral are documented in separate documents. For
specifications of the USART protocol used in the bootloader, refer to AN3155. For the
specification of the CAN protocol used in the bootloader, refer to AN3154. For the
specification of the DFU (USB device) protocol used in the bootloader, refer to AN3156. For
the specification of the I
2
C protocol used in the bootloader, refer to AN4221. For the
specification of the SPI protocol used in the bootloader, refer to AN4286.
March 2015
DocID13801 Rev 21
www.st.com
1/155
1
Contents
AN2606
Contents
1
2
3
Related documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
General bootloader description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.1
3.2
3.3
3.4
Bootloader activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Bootloader identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Hardware connection requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Bootloader Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4
STM32F10xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1
4.2
4.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5
STM32F105xx/107xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . 25
5.1
5.2
5.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.1
5.3.2
5.3.3
5.3.4
How to identify STM32F105xx/107xx bootloader versions . . . . . . . . . . 28
Bootloader unavailability on STM32F105xx/STM32F107xx devices
with a date code below 937 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
USART bootloader Get-Version command returns 0x20
instead of 0x22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
PA9 excessive power consumption when USB cable is plugged
in bootloader V2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6
STM32F10xxx XL-density devices bootloader . . . . . . . . . . . . . . . . . . . 31
6.1
6.2
6.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7
STM32L1xxx6(8/B) devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.1
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2/155
DocID13801 Rev 21
AN2606
Contents
7.2
7.3
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
8
STM32L1xxxC devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
8.1
8.2
8.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9
STM32L1xxxD devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.1
9.2
9.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
10
STM32F2xxxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.1
Bootloader V2.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.1.1
10.1.2
10.1.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.2
Bootloader V3.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.2.1
10.2.2
10.2.3
11
STM32F40xxx/41xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . 49
11.1
Bootloader V3.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
11.1.1
11.1.2
11.1.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
11.2
Bootloader V9.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
11.2.1
11.2.2
11.2.3
12
STM32F05xxx and STM32F030x8 devices bootloader . . . . . . . . . . . . . 59
12.1
12.2
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
DocID13801 Rev 21
3/155
7
Contents
AN2606
12.3
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
13
STM32F03xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
13.1
13.2
13.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
14
STM32F373xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
14.1
14.2
14.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
15
STM32F302xB(C)/303xB(C) devices bootloader . . . . . . . . . . . . . . . . . . 66
15.1
15.2
15.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
16
STM32F378xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
16.1
16.2
16.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
17
STM32F358xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
17.1
17.2
17.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
18
STM32F42xxx/43xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . 73
18.1
Bootloader V7.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
18.1.1
18.1.2
18.1.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
18.2
Bootloader V9.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
18.2.1
18.2.2
18.2.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
DocID13801 Rev 21
4/155
AN2606
Contents
19
STM32F04xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
19.1
19.2
19.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
20
STM32F07xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
20.1
20.2
20.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
21
STM32F301xx/302x4(6/8) devices bootloader . . . . . . . . . . . . . . . . . . . 92
21.1
21.2
21.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
22
STM32F318xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
22.1
22.2
22.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
23
STM32F303x4(6/8)/334xx/328xx devices bootloader . . . . . . . . . . . . . . 98
23.1
23.2
23.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
24
STM32F401xB(C) devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . 100
24.1
24.2
24.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
25
STM32F401xD(E) devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . 106
25.1
25.2
25.3
Bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
Bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
DocID13801 Rev 21
5/155
7