STM32CubeIDE

From wiki.emacinc.com
Jump to: navigation, search

Intro

STM32CubeIDE is an all in one integrated development environment, possessing MCU Pin Configuration, Middleware selection, code generation, compilation, build analysis, and debugging capabilities. 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. A full product description is given HERE.

STM32CubeIDE is used for CutiPy FreeRTOS development. Essential feature descriptions are given below.

Supported Systems

Windows®, Linux®, and macOS®, 64-bit versions only

Download

STM32CubeIDE can be downloaded HERE


Importing a Project

After intalling STM32CubeIDE to your development machine and downloading an EMAC STM32Cube Project (Like CutiPy_FreeRTOS), import the project as follows:

  1. Open the STM32CubeIDE and navigate to the Project Explorer window. Right click in the empty window and select Import..., to open the Import window.

  2. Select General->Existing Projects into Workdspace and click Next> to advance.

  3. Now select Browse and navigated to the folder containing the dowloaded project. The project will appear in the Projects: box. Check the box next to the project name, and then select Finish, the project will then be imported.

Building and Upload

Setup

  1. Connect the ST-Link programmer to the board for programming

  2. Power on your board

  3. If needed, upgrade your ST-LINK firmware by navigating to Help and selecting ST-LINK Upgrade. The ST Link upgrade window will open. Select refresh device list, and then select Open in update mode, and finally Upgrade

The project now ready to be built and uploaded.

Build and Upload

Toolbar.png
The project can be built by selecting the hammer symbol on the upper toolbar. The selected build can also be toggled by clicking on the down arrow next to the hammer. The default options available are Debug (a build with debug symbols, and optimizations turned off), and Release (a build with optimizations ON and no debug sybols). The project can be built and uploaded by selecting the green bug symbol. After upload this will automatically launch the debug perspective, from which debugging can commence.



NOTE
In current release of the IDE there is no 'upload without launching debug perspective' option available. ALL uploads are accomplished by the green debug symbol, but meaningful debugging can only be accomplished through upload of a Debug build.


Debugging

Debugging is accomplished by building and uploading a Debug build. This done by selecting the Debug build with the down arrow next to the hammer symbol, then selecting the green bug symbol for upload. The debug perspective should launch automatically. if not the debug perspective can be selected by clicking the green bug symbol in the right hand corner.

Debug Perspective

The debug perspective makes available debug options like start, stop, reset, breakpoint set and reset, step into, step over, etc. The following items on the upper tool bar are of particular use:

DebugToolbar1.png
From left to right these symbol accomplish the following:

  1. Reset the chip and restart the debug session

  2. Skip all breakpoints

  3. Terminate and relaunch, This kills the debug session and re uploads the firmware

  4. Resume (The play symbol), This option becomes available when code execution is suspended. Selecting this option resumes/continues code execution until the next breakpoint is encountered.

  5. Suspend (The pause symbol), This option becomes available while the code is running (after clicking Resume), Selecting this option pauses code at the next line to be executed.

  6. Terminate kills the debug session

  7. Disconnect disconnects from the current debug session

  8. Step into -Steps into a function

  9. Step Over Steps over the current line of code

  10. Return If in a function, this option will exit the function and stop at the next line to be executed (continue and stop)


DebugToolbar2.png
In the upper right hand corner of the debug perspective are additional debug views. From top to bottom these are:

  1. variables - opening this view while stopped in an active function will reveal variable values and update them as you step through.

  2. Breakpoints -This view shows active breakpoints and their locations. It also allows you to toggle them off and on and delete them.

  3. expressions -Type in an expression (a variable or an equation of variables and constants) and this view will evaluate them for you.

  4. live expression - Updates expression values while the code is running ('live'). Only available with Segger J-link

  5. SFRs - shows values of peripheral registers

Other views are available by navigating to the top of the window and selection Window->Show View and selecting one of the available views.


Setting Breakpoints

Breakpoints are set by opening a file in debug perspective and double clicking the line number at which you'd like to place your breakpoint. A blue circle with a checkmark should appear to the left of the line number-This indicates a breakpoint has been set successfully.

Breakpoint.png

The breakpoint can be turned off by double clicking line, or by deleting it through the breakpoint view.


STM32CubeMX and Code Generation

Code generation will result if the projects .ioc file is modified. Double clicking this file will open it through the STM32CubeMX perspective. There the pinout of the device, configured peripherals, middlewares, and clock information will be available. 'Modification' of the baseline settings is not recommended, though 'additions' by the user should be fine. This feature may be used for configuring header pins in alternate function modes (Something other than ANALOG, INPUT, or OUTPUT). Or configuring various other options. After modifying the .ioc file (Changing the setting in STM32CubeMX), code can be generated by clicking the build symbol on the tool bar.




NOTE
Generation of code will result in the build settings and source folders having to be reset through the IDE. Items needing to be re-set include # Symbols (MACROS), Includes and Source Locations located at Properties->C/C++ General->Paths and Symbols. These can be uploaded by importing EMACsettings.xml. This will upload the necessary symbols and includes. Source locations will have to be manually added on an individual folder basis or by selecting Source Location->Add Folder-><root folder> and clicking OK, then Apply and Close


Pages with Related Content

Getting Started with CutiPy and FreeRTOS

CutiPy FreeRTOS Documentation

FreeRTOS