Some tips to configure Eclipse based IDE as TrueSTUDIO/STM32CubeIDE

STMicroelectronics has adopted TrueSTUDIO from the former Atollic as its free development environment.

TrueSTUDIO is based on Eclipse, it is mature and stable. We continue to use it despite the availability of STM32cubeIDE which is heavier (it takes twice as long to compile and start debugging).

Here are some tips to configure Eclipse based IDE as TrueSTUDIO or STM32cubeIDE.

To migrate a project from TrueSTUDIO to STM32CubeIDE see this document. More explanation below


How to update TrueSTUDIO

TrueSTUDIO is declared obsolete by STM, which replaced it by STM32CubeIDE. But the latter is heavy and slow.
For those who use TrueSTUDIO it is a pain to have to part with it. However there is a way to extend its life: update the toolchain. The native GCC version of TrueSTUDIO is 6.3.1 20170215. To date the latest version is 9.2.1-1.1. Here’s how to install it for Windows platforms.

The tools have a standard name like “arm-none-eabi-cpp.exe”, but TrueSTUDIO uses names like “arm-atollic-eabi-cpp.exe”.
It is possible to set the new names of the tools in the tool settings of every tool in every project. This is tedious. It’s easier to change the name of the tools:

  • Start a PowerShell as administrator: right clic on Start, select “Windows PowerShell (admin)”
  • Go to the directory “gcc-9.2.1-1.1\bin”
  • Use the command: “Dir | Rename-Item -NewName { $_.name -replace “none”,”atollic” }”

Now there is only one thing left to do: in the project properties select the tab “C / C ++ Build / Settings / ToolchainVersion”

  • Check the “Fixed toolchain location” radio button
  • Browse to your new binary tool chain, like “C:/Program Files (x86)/Atollic/TrueSTUDIO for STM32 9.3.0/gcc-9.2.1-1.1/bin”

That’s all! In less than half an hour.
Now you have the latest GCC toolchain, and a simple radio button allows you to select the default TrueSTUDIO toolchain or the new one (it may be useful to easily revert to the original version).


How to create a new workspace

The first thing to do is to create a Workspace to host the projects.

For STM32CubeIDE

In the folder that should contain the Workspace, create a new folder with the name of the Workspace.
Then start STM32CubeIDE. In the first screen select the newly created folder.

That’s all.

For TrueSTUDIO

Start TrueSTUDIO. The first screen allows to create a workspace:

Click the “Browse…” button.
Navigate to the target directory, where the workspace directory will be created.
Click “Create a new folder”, then give the name of the new workspace.

Be sure to have the workspace directory name in the “Directory” field, then click OK.

Click OK in the Eclipse Launcher, and the new empty workspace is created:


How to import an existing project in a workspace

For STM32CubeIDE

To migrate a project from TrueSTUDIO to STM32CubeIDE first see this document.

Here is a more complete explanation.

  • Copy (not move!) the project folder into the STM32CubeIDE workspace folder.
  • Delete the “Debug” folder of the project.
  • Launch STM32CubeIDE, and select the workspace.
  • In the workspace menu “File” then “Open Project From File System…”. The project will be migrated.
  • In the “Project Explorer” right click the project name then “Properties”:
    • C/C++ Builds / Behaviour tab.
    • Check “Enable parallel Build” and “Use optimal jobs”.
  • Build the project.

On the migration process the debug and run configurations are forgotten. We have to recreate them after building the project. To create the debug configuration:

  • In the “Project Explorer” select the project.
  • In the workspace menu “Run” then “Debug Configurations…”.
  • Right click “STM32 Cortex-M C/C++ Application” and select “New Configuration”.
  • In the Main tab : Give a name: “xxx Debug”.
  • In the Debugger tab: Setect your debug probe (if not automatically detected).
  • In the Startup tab: Uncheck “Set breakpoint at:” (if there is no main in the project).
  • In tab Common: check “Shared file:” and in Display in favorite menu check “Debug”.
  • Apply / Close.

To create the run configuration, it’s almost the same thing:

  • In the “Project Explorer” select the project.
  • In the workspace menu “Run” then “Run Configurations…“.
  • Right click “STM32 Cortex-M C/C++ Application” and select “New Configuration”.
  • In the Main tab : Give a name: “xxx Run“.
  • In the Debugger tab: Setect your debug probe (if not automatically detected).
  • In the Startup tab: the “Set breakpoint at:” is grayed.
  • In tab Common: check “Shared file:” and in Display in favorite menu check “Run“.
  • Apply / Close.


For TrueSTUDIO

Start TrueSTUDIO with the target workspace.
Select the File menu then “Import…”
Under “General” select “Existing Projects into Workspace”, then “Next”.

Click the “Browsee…” button and select the old project directory you would like to import.
Check “Copy project into workspace”
Then click “Finish”.

Your project is ready to compile and download:

You can delete the old project folder because the project has been copied to the workspace.


Enable multi core build

To benefit from an accelerated compilation it may be necessary to validate the use of several processor cores.

  • Right click on the project name, then “Properties”.
  • Select the “C/C++ Build / Behaviour” tab
  • Check “Enable parallel build” and “Use optimal jobs”.

File search dialog

The file search should be the most used search. There are two tips to facilitate this search.

First: set the file search tab as default.
The search dialog has several tabs. It would be useful if the “Search for files” tab was selected by default.

  • In the menu “Search” select “Search…”. Select the “File search” tab.
  • Click the “Customize” button at the bottom of the window.
  • Then check “Remember last used page”.

Second: set a shortcut to open the file search dialog.
The shortcut to open the search dialog is CTRL+H. If it is not configured:

  • In the menu “Window” select “Preference / General / Keys”.
  • Type the filter text “search” and find the “Open search dialog” command. Click it.
  • Clear the binding field and stroke CTRL and H.
  • Click Apply/OK.

Build selected file(s)

Sometimes it is very useful to build only a selected file or a set of few selected files:

  • Select the file(s) you want to buid (with CTRL for more than one file)
  • Right click on one file you want to build
  • Click on “Build Selected File(s)”.

The menus to build or clean selected files is only available if “Build automatically” is not enabled:

To enable these commands:

  • Menu “Project”:
  • Uncheck “Build Automatically”.

On some other IDE as TrueSTUDIO:

  • Menu “Windows” select “Preference / General / Workspace”
  • Uncheck “Build automatically”.

Download to MCU target without debug

Sometimes it is useful to flash the application in the target without launching the debugger. To do this, a special “Run configuration” must be created.

STM32CubeIDE

Build a “Run Configuration” as explained here.

TrueSTUDIO

The difference between Run and Debug configurations is only the script content:

  • In the Project Explorer select your project.
  • In the menu Run select “Debug Configuration…”
  • Right click “Embedded C/C++ Application” and select “New”
  • Give it a name, example “L4R5 Run”
  • In “C++ Application” select “Browse..” and select your application .elf file in the Debug folder. Then remove the absolute path and leave only “Debug\project_name.elf”.
  • In the “Debugger” tab select your debugger probe.
  • In the “Startup Script” tab, replace the end of the script with “quit”
  • In the “Common” tab, select “Shared file”, and check “Debug” under “Display in favorites menu”.

The run script looks like:

# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers
# Uncomment next line, 2=32 bit, 1=16 bit and 0=8 bit parallelism mode
#monitor flash set_parallelism_mode 2

# Set character encoding
set host-charset CP1252
set target-charset CP1252

# Reset to known state
monitor reset

# Load the program executable
load		

# Reset the chip to get to a known state. Remove "monitor reset" command 
#  if the code is not located at default address and does not run by reset. 
monitor reset

quit


If you already have a working debug configuration, there is a simpler procedure:

  • In the Project Explorer select your project.
  • In the menu Run select “Debug Configuration…”
  • Right click your configuration and select Duplicate
  • Modify the name, example “L4R5 Run”
  • In the “Startup Script” tab, modify the scrip.


Customize the current perspective to launch your debug / run configurations:

  • In the menu “Windows” select “Perspective / Customize Perspective”
  • In the “Tool Bar Visibility” tab expand the “Launch” item.
  • Uncheck and check again the “Debug” subitem.

Now in the toolbar you should have a “Debug”button with a drop-down list to select the desired debug configurations.

Thanks to: https://calinradoni.blogspot.com/2016/09/atollic-truestudio-download-without.html for this tip.


Leave a Comment

Your email address will not be published. Required fields are marked *

Solve : *
21 × 20 =