STM32Cube Command Line Toolset User Manual

June 9, 2024
ST

ST X-NUCLEO logo UM3088
STM32Cube command-line toolset quick start guide
User manual

Introduction

This document is a brief guide for users to get started quickly with STM32CubeCLT, the STMicroelectronics command-line toolset for STM32 MCUs.
STM32CubeCLT offers all the STM32CubeIDE facilities packaged for command- prompt use by third-party IDEs, or continuous integration and continuous development (CD/CI).

The streamlined single STM32CubeCLT package includes:

  • CLI (command-line interface) versions of ST tools like toolchain, probe connection utility, and flash memory programming utility
  • Up-to-date system view descriptor (SVD) files
  • Any other IDE relevant metadata STM32CubeCLT allows:
  • Building a program for STM32 MCU devices using an enhanced GNU toolchain for STM32
  • Programming STM32 MCU internal memories (flash memory, RAM, OTP, and others) and external memories
  • Verifying the programming content (checksum, verification during and after programming, comparison with file)
  • Automating the STM32 MCU programming
  • Debugging applications through the interface of STM32 MCU products, which provides access to MCU internal resources using basic debug features

General information

The STM32CubeCLT command-line toolset for STM32 MCUs provides tools to build, program, run, and debug applications targeting STM32 microcontrollers based on the Arm® Cortex® ‑M processor.
Note:
Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.

Reference documents

  • Command-line toolset for STM32 MCUs (DB4839), STM32CubeCLT data brief
  • STM32CubeCLT installation guide (UM3089)
  • STM32CubeCLT release note (RN0132)

Screenshots in this document
The screenshots provided in Section 2, Section 3, and Section 4 are only examples of the tool usage from a command prompt.
The integration in third-party IDEs or the use in CD/CI scripts is not illustrated in this document.

Building

The STM32CubeCLT package contains the GNU tools for STM32 toolchain to build a program for an STM32 microcontroller. A Windows® console window example is shown in Figure 1.

  1. Open a console in the project folder.
  2. Execute the following command to build the project: > make -j8 all -C .\Debug

STM32Cube Command Line Toolset User -

Note: The make utility might require a separate installation step.

Board programming

The STM32CubeCLT package contains the STM32CubeProgrammer (STM32CubeProg), which is used to program the build obtained previously into the target STM32 microcontroller.

  1. Make sure that the ST-LINK connection is detected
  2. Select the project folder location in the console window
  3. Optionally, erase all the flash memory content (refer to Figure 2): > STM32_Programmer_CLI.exe -c port=SWD freq=4000 -e all
  4. Upload the program file to the 0x08000000 flash memory address (refer to Figure 3): > STM32_Programmer_CLI.exe -c port=SWD freq=4000 -w .\Debug\YOUR_PROGRAM.elf 0x08000000

STM32Cube Command Line Toolset User - erase output

Debugging

In addition to the GNU tools for STM32 toolchain, the STM32CubeCLT package contains also the ST-LINK GDB server. Both are needed to start a debug session.

  1. Start the ST-LINK GDB server in another Windows® PowerShell® window (refer to Figure 4): > ST-LINK_gdbserver.exe -d -v -t -cp C:\ST\STM32CubeCLT\STM32CubeProgrammer\bin
  2. Use the GNU tools for STM32 toolchain to start the GDB client in the PowerShell® window:

    arm-none-eabi-gdb.exe
    (gdb) target remote localhost:port (use the port indicated in the GDB server opened connection)
    The connection is established and GDB server session messages are displayed as shown in Figure 5. It is then possible to run GDB commands in the debug session, for instance to reload an .elf program using GDB: > (gdb) load YOUR_PROGRAM.elf

STM32Cube Command Line Toolset User - GDB server
output

Revision history

Table 1. Document revision history

Date Revision Changes
16-Feb-23 1 Initial release.

IMPORTANT NOTICE – READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgment.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. For additional information about ST trademarks, refer to www.st.com/trademarks. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.

UM3088 – Rev 1 – February 2023
For further information contact your local STMicroelectronics sales office.
www.st.com
© 2023 STMicroelectronics – All rights reserved

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals