STM32CubeIDE

Revision as of 13:59, 2 July 2020 by Registered User (Merge articles)

STM32CubeIDE is an advanced C/C++ development platform with peripheral configuration, code generation, code compilation, and debug features for STM32 microcontrollers and microprocessors. It is based on the ECLIPSE™/CDT framework and GCC toolchain for the development, and GDB for the debugging. It allows the integration of the hundreds of existing plugins that complete the features of the ECLIPSE™ IDE. STM32CubeIDE integrates all STM32CubeMX functionalities to offer all-in-one tool experience and save installation and development time. This article explains some of the basics of STM32CubeIDE. It is an all-in-one multi-OS development tool, which is part of the STM32Cube software ecosystem.

1. Prerequisites[edit source]

The following tools are prerequisites for understanding the tutorial on this wiki page and developing an application based on the STM32MP1 Series:

  • STM32CubeIDE 1.1.0 or newer
  • STM32Cube_FW_MP 1.1.0 or newer
  • STM32CubeMX 5.4.0 or newer

2. How to get started with STM32CubeIDE[edit source]

This section links to two different how to articles depending on if you are moving from SW4STM32 to STM32CubeIDE or if you are starting a new project with STM32CubeIDE.

2.1. How to get started with STM32CubeIDE from scratch[edit source]

How to get started with STM32CubeIDE from scratch.

2.2. How to move from SW4STM32 to STM32CubeIDE[edit source]

How to move from SW4STM32 to STM32CubeIDE.

3. Project structure[edit source]

When an MPU project is created, its structure is automatically made hierarchical. The project structure for single-core projects is flat. On the contrary, in a multi-core project, the hierarchical project structure is used. When the user creates or imports an MPU project, it consists of one root project together with sub-projects, referred to as MCU projects, for each core. A hierarchical structure example is shown below.

Hierarchical project structure

4. Debug Cortex-M on MPU[edit source]

Two modes are used to debug Cortex-M firmware on MPU.

4.1. Engineering mode[edit source]

Dedicated to preliminary Cortex-M debug, it implies a specific boot mode: the Engineering Boot Mode where Cortex-M only is started. Firmware is loaded via JTAG/SWD into its dedicated RAM.

This mode is not the default one, it has to be set in the Debug Configuration, in Debugger tab, check "thru JTGA/SWD link (Engineering mode)". Please note that initialization normally done in Cortex-A like (clock tree set-up, ...) have to be handled by Cortex-M.

Debugging in Engineering Mode is very similar to a standard MCU Debug in term of functionality, expect that here Cortex-M has only a dedicated memory, no flash memory type.

4.2. Production mode[edit source]

It targets a debug closer to final product and means:

  • a MPU target up and running,
  • firmware to debug network downloaded to Cortex-A Linux file system,
  • and loaded to Cortex-M thanks to Cortex-A Linux remoteproc framework,
  • then Cortex-M debug session launched via JTAG/SWD connection.

Target is booted in Production mode from flash memory, for example from SD-Card; it is network and JTAG/SWD connected. Using ST-Link automatically brings support for Cortex-A Linux console via VCP (Virtual COM Port). It also enable Target Status widget for target IP address discovery.

Network connection is available via :

  • Ethernet port onto :
    • a managed network with DHCP Server
    • or unmanaged network meaning target IP address to be configured
  • or via dedicated USB OTG connection for Ethernet point to point. This setup is OS-depend please check details here.

This production mode is the default one when you create a new Debug Configuration: "thru Linux core (Production Mode)" in Debugger tab. So if your target is Linux booted, JTAG/SWD and network connected the Serial Console is discovered and the target IP address is retrieve thanks to Target Status widget. This allows to fulfill Debug Configuration information.

frameless

More information on how to use STM32CubeIDE Target Status, here.

On Debug launch some specific pop-up will appear:

  • The SSH Password is to complete: the default one is root.
frameless
  • The RSA key is to be approved.
Error creating thumbnail: Unable to save thumbnail to destination

4.2.1. Updating MPU target for Cortex-M[edit source]

Defining an Cortex-M project in MPU context also means to define where are downloaded on Cortex-A Linux file system:

  • the Cortex-M Firmware: <ProjectName>.elf
  • the load/unload script fw_cortex_m4.sh used by the IDE if present it can be customized
  • and a README, informing a user having a direct connection onto the target.

This is the purpose of "Remote Path Setting" property which is linked to the project. Its default value at creation is /usr/local/project/<ProjectName>, but can also be changed thanks to the Remote Settings properties item.

frameless

Inside project structure,directory "<ProjectName>_CM4/Core/RemoteProc/" defines the tree downloaded when debugging in Production Mode.

4.3. ST-Link Server support[edit source]

From release 1.2.0, it is possible to connect to ST-Link via ST-Link Server just like on standard MCU. This is enable by checking Shared ST-Link inside Debug Configuration > Debugger > ST-Link Client Setup.

5. FAQ[edit source]

How to copy/paste in the STM32CubeIDE console