UM0892 User Manual: STM32 ST-LINK Utility Software Description
UM0892 User Manual: STM32 ST-LINK Utility Software Description
UM0892 User Manual: STM32 ST-LINK Utility Software Description
User manual
Introduction
The STM32 ST-LINK Utility software facilitates fast in-system programming of the STM32
microcontroller families in development environments via the tools, ST-LINK and
ST-LINK/V2.
This is the STM32 ST-LINK Utility user manual, describing its software functions. When
working with the STM32 ST-LINK Utility, you are encouraged to download the ST-LINK
in-circuit debugger/programmer user manual (UM0627) or the ST-LINK/V2 in-circuit
debugger/programmer user manual (UM1075) for the STM8 and STM32 which provide
more information about the ST-LINK tools.
Contents
1 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Installing the STM32 ST-LINK Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Uninstalling the STM32 ST-LINK Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
5 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1 Getting started
This section describes the requirements and procedures to install the STM32 ST-LINK Utility
software.
Title bar
Menu bar
Main window
Status bar
The main window is composed of three zones and three bars as illustrated in Figure 1:
● Memory display zone
● Device information zone
● Memory contents zone
● Title bar: The name of the current menu
● Menu bar: Use the menu bar to access the following STM32 ST-LINK Utility functions:
– File menu
– View menu
– Target menu
– Help menu
(These menus are described in more detail in Section 2.2)
● Status window: The status bar displays:
– Connection status and debug interface
– Device ID
The STM32 ST-LINK Utility user interface also provides additional forms and descriptive
pop-up error messages.
Connect Connects to the target device and displays the Device Type, Device ID
and Flash memory size in the device information zone.
Disconnect Disconnects from the target device.
Erase Chip Performs a Flash memory mass erase and then displays the Flash
memory content in the memory panel.
Erase Bank1 Erases bank 1 of the Flash memory. This menu is enabled only when
connected to an XL-density device.
Erase Bank2 Erases bank 2 of the Flash memory. This menu is enabled only when
connected to an XL-density device.
Erase Sectors… Selects sector(s) to erase using the erase sectors dialog window (see
Section 3.3: Flash memory erase for more details).
Program… Loads a binary file into the device memory (Flash or RAM). To do this,
select a binary file, enter the start address (where to put the file in the
device) in the program dialog window and then click on program button
(see Section 3.4: Device programming).
Program & Verify… Loads a binary file into the device memory (Flash or RAM) then
performs a verification of the programmed data.
Blank Check Verifies that the STM32 Flash memory is blank. If the Flash memory is
not blank, the first address with data is highlighted in a prompt
message.
Compare with file Compares the MCU device memory content with hex, binary or srec
file.
Option Bytes… Opens the Option Bytes dialog window (See Section 3.5: Option bytes
configuration for more details).
MCU Core… Opens the MCU Core dialog window (See Section 3.6: MCU core
functions for more details).
Automatic Mode... Opens the Automatic mode dialog window (See Section 3.7: Automatic
mode functions for more details).
Settings... Opens the Settings dialog box to select the debug interface (JTAG or
SWD).
The “connect under reset” option allows you to connect to the target
before executing any instruction.
This is useful in many cases like when the target contains a code that
disables the JTAG/SWD pins.
When connecting to the target via an ST-LINK/V2, the “Supply voltage”
combo box displays the target voltage.
When connecting to an STM32 F2 or STM32 F4 device using an
ST-LINK, the “Supply voltage” combo allows you to select the supply
voltage of your target to be able to correctly program the Flash
memory.
Note: The “connect under reset” option is available only with ST-LINK/V2 and in SWD mode.
The RESET pin of the JTAG connector (pin 15) should be connected to the device reset pin.
STM32 ST-LINK Utility User Manual Opens the STM32 ST-LINK Utility User Manual.
ST-LINK User Manual Opens the ST-LINK User Manual.
ST-LINK/V2 User Manual Opens the ST-LINK/v2 User Manual.
About... Displays STM32 ST-LINK Utility software version
and copyright information.
This section provides a detailed description of how to use STM32 ST-LINK Utility features:
● Device information
● Memory display and modification
● Flash memory erase
● Device programming
● Option bytes configuration
● MCU core functions
● Automatic mode functions
Device: Family of the connected STM32 device. Each device type includes
many devices with different characteristics such as Flash memory size,
RAM size and peripherals.
Device ID: MCU device ID code located in the external PPB memory map
Revision ID: The revision ID of the connected MCU device
Flash size: Size of the on-chip Flash memory(1)
1. This field is not available for STM32 F2 and STM32 F4 series devices.
Memory data: This zone displays the data read from a binary file or the memory content of
a connected device. You can modify the content of the file before downloading.
● To use this zone to display the content of binary file, go to File | Open file...
● To use this zone to read and display memory content of a connected device, enter the
memory start Address, data Size and the Data Width in the Memory display zone and
then press Enter.
● After reading data, you can also modify each value merely by double clicking on the
concerned cell as illustrated by Figure 8. You can also save the device memory content
into a binary file using the menu File | Save file as...
Note: When the Memory data zone displays device memory contents, any modification is
automatically applied to the chip. You can modify user Flash memory, RAM memory and
peripherals registers.
For the STM32 F2 and STM32 F4 devices, you can modify the OTP area directly from the
memory data zone.
Note: To erase the Flash data memory sector of the ultralow power STM32 L1 devices, select the
data memory box at the end of the list and click Apply.
4. Finally, click on the Program button to start programming. If you selected Target |
Program & Verify... in the first step, a check is done at the end of the programming
operation (see Figure 12).
Note: 1 The STM32 F2 and STM32 F4 series supports different programming modes depending of
the MCU supply voltage. When using ST-LINK, the MCU supply voltage should be specified
in the Target | Settings Menu to be able to program the device with the correct mode. When
using ST-LINK/V2, the supply voltage is detected automatically.
2 If the device is read protected, the protection will be disabled. If some Flash memory pages
are write protected, the protection will be disabled during programming and then recovered.
– nRST_STDBY: if not checked, reset is generated when entering Stop mode (all
clocks are stopped). If checked, no reset is generated when entering Stop mode.
– BFB2: If not checked, and if the boot pins are set to make the device boot from
user Flash at startup, the device boots from Flash memory bank 2, otherwise it
boots from Flash memory bank 1. This option is enabled only when connected to a
device containing two Flash banks.
● User data storage option bytes: Contains two bytes for user storage. These two
option bytes are not available in the STM32 F2, STM32 F4 and STM32 L1 devices.
● Write Protection: Depending on the device, Flash sectors are grouped by a defined
number of sectors. You can modify the write protection of each Flash sector group here.
For more details, please refer to the Option Bytes section in the Flash programming manual
available from www.st.com.
Note: The PC and MSP registers can be modified from this panel.
Note: 1 If user deselects Flash programming action while the STM32 Flash memory is readout
protected, it will be automatically unprotected.
2 If user deselects Flash programming action while some or all STM32 Flash memory are
write protected, they will be automatically unprotected and restored after programming
operation.
3 Connection to the device should be established to be able to select the option Bytes
configuration using the configure button.
4 The connected devices should be derivatives of the same STM32 family and will be all
connected in the same mode (JTAG or SWD).
–w8
Description: Writes 8-bit data to the specified memory address.
Syntax: -w8 <Address> <data>
Example: –w8 0x20000000 0xAA
Note: -w8 supports writing to Flash memory, OTP, SRAM and R/W registers.
–w32
Description: Writes 32-bit data to the specified memory address.
Syntax: -w32 <Address> <data>
Example: –w32 0x08000000 0xAABBCCDD
Note: -w32 supports writing to Flash memory, OTP, SRAM and R/W registers.
–r8
Description: Reads <NumBytes> memory.
Syntax: -r8 <Address> <NumBytes>
Example: –r8 0x20000000 0x100
-HardRst
Description: Hardware reset.
Syntax: -HardRst
Note: -HardRst command is available only with ST-LINK/V2. The RESET pin of the JTAG
connector (pin 15) should be connected to the device reset pin.
–Run
Description: Sets the Program Counter and Stack pointer as defined at user application
and performs a run operation. This is useful if the user application is loaded
with an offset (e.g. 0x08003000). If the address is not specified,
0x08000000 is used.
Syntax: -Run [<Address>]
Example: –run 0x08003000
–Halt
Description: Halts the core.
Syntax: -Halt
–Step
Description: Executes Step core instruction.
Syntax: -Step
–SetBP
Description: Sets the software or hardware breakpoint at a specific address. If an
address is not specified, 0x08000000 is used.
Syntax: -SetBP [<Address>]
Example: –SetBP 0x08003000
–ClrBP
Description: Clears all hardware breakpoints, if any.
Syntax: -ClrBP
–CoreReg
Description: Reads the Core registers.
Syntax: -CoreReg
–SCore
Description: Detects the Core status.
Syntax: -SCore
-SE
Description: Erase Flash sector(s).
Syntax: -SE <Start_Sector> [<End_Sector>]
Example: -SE 0 => Erase sector 0
-SE 2 12 => Erase sectors from 2 to 12
-P
Description: Load binary, Intel Hex or Motorola S-record file into device memory without
verification. For hex and srec format, the address is relevant.
Syntax: -P <File_Path> [<Address>]
Examples: -P “C:\file.srec”
-P “C:\file.bin” 0x08002000
-P “C:\file.hex”
Note: 1 STM32 F2 and STM32 F4 series supports different programming modes depending on the
MCU supply voltage. When using ST-LINK/V2, the supply voltage is detected automatically.
Therefore, the correct programming mode is selected. When using ST-LINK, the 32-bit
programming mode is selected by default.
2 If the device is read protected, the protection will be disabled. If some Flash memory pages
are write protected, the protection will be disabled during programming and then recovered.
-V
Description: Verifies that the programming operation was performed successfully.
Syntax: -V
Example: -P “C:\file.srec” -V
-OB
RDP=<Level>:
RDP=<Level> sets the Flash memory read protection level.
The <Level> could be one of the following levels:
0 : Protection disabled
1 : Protection enabled
2 : Protection enabled (debug and boot in SRAM features are DISABLED)
Note: Level 2 is available on STM32 F2, STM32 F4 and STM32 L1 series only.
BOR_LEV=<Level>:
BOR_LEV sets the Brownout Reset threshold level.
For STM32 L1 series:
0 : BOR OFF, 1.45 to 1.55 V voltage range
1 : 1.69 to 1.8 V voltage range
2 : 1.94 to 2.1 V voltage range
3 : 2.3 to 2.49 V voltage range
4 : 2.54 to 2.74 V voltage range
5 : 2.77 to 3.0 V voltage range
For STM32 F2 and STM32 F4 series:
0 : BOR OFF, 1.8 to 2.10 V voltage range
1 : 2.10 to 2.40 V voltage range
2 : 2.40 to 2.70 V voltage range
3 : 2.70 to 3.60 V voltage range
IWDG_SW=<Value>:
The <Value> should be 0 or 1:
0 : Hardware independent watchdog
1 : Software independent watchdog
nRST_STOP=<Value>:
The <Value> should be 0 or 1:
0 : Reset generated when CPU enters the Stop mode
1 : No reset generated.
nRST_STDBY=<Value>:
The <Value> should be 0 or 1:
0 : Reset generated when CPU enters the Standby mode
1 : No reset generated.
BFB2=<Value>:
The <Value> should be 0 or 1:
0 : Boot from Flash bank 2 when boot pins are set in boot from user Flash position
(default)
1 : Boot from Flash bank 1 when boot pins are set in boot from user Flash position
(default).
Note: BFB2 is available only on devices containing two Flash banks.
Data0=<Value>:
Data0 sets the Data0 option byte.
The <Value> should be in [0..0xFF].
Note: Not available on STM32 F2, STM32 F4 and STM32 L1 devices.
Data1=<Value>:
Data1 sets the Data1 option byte.
The <Value> should be in [0..0xFF].
Note: Not available on STM32 F2, STM32 F4 and STM32 L1 devices.
WRP=<Value>:
WRP enables/disables write protection of the MCU flash sectors.
Each bit will Enable/Disable the write protection of one sector or more depending on the
connected device.
For STM32 L1 devices, WRP[i] = 0 : Flash sector(s) is protected.
For other devices, WRP[i] = 1 : Flash sector(s) is protected.
This command is sufficient to enable/disable all flash sectors protection except for STM32
L1 High density where WRP2 and WRP3 commands are needed.
The <Value> should be in [0..0xFFFFFFFF]
WRP2=<Value>:
WRP2 is available only for STM32 L1 high density devices to enable/disable the protection
of flash sectors from sector 512 to sector 1023.
The <Value> should be in [0..0xFFFFFFFF]
WRP3=<Value>:
WRP3 is available only for STM32 L1 high density devices to enable/disable the protection
of flash sectors from sector 1024 to sector 1535.
The <Value> should be in [0..0xFFFFFFFF]
5 Revision history
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.