Difference between revisions of "STM32CubeIDE"

From wiki.emacinc.com
Jump to: navigation, search
 
(21 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<span style="background:#00FF00;color:#FF0000;font-size:300%"></span>
 
<span style="background:#00FF00;color:#FF0000;font-size:300%"></span>
The following page demonstrates the process of getting familiar with EMAC Qt Creator and running it on the target machine.
 
 
__TOC__
 
__TOC__
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 46: Line 45:
  
 
===Debug Perspective===
 
===Debug Perspective===
The debug perspective makes available debug options like start, stop, reset, breakpoint set and reset, step into, step over, etc.
+
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:</br>
[[File:DEBUGperspective.png|1200px|left|thumb|Figure 9: Configureing Qt Project]]
 
 
 
 
 
  
 +
[[File:DebugToolbar1.png]]</br>
 +
From left to right these symbol accomplish the following:</br>
 +
<cl>
 +
1. '''Reset the chip and restart the debug session''' 
 +
* '''Skip all breakpoints'''
 +
* '''Terminate and relaunch''', This kills the debug session and re uploads the firmware
 +
* '''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.
 +
* '''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.
 +
* '''Terminate''' kills the debug session
 +
* '''Disconnect''' disconnects from the current debug session
 +
* '''Step into'''  -Steps into a function
 +
* '''Step Over''' Steps over the current line of code
 +
* '''Return''' If in a function, this option will exit the function and stop at the next line to be executed (continue and stop)
 +
</cl></br>
 +
[[File:DebugToolbar2.png]]</br>
 +
In the upper right hand corner of the debug perspective are additional debug views. From top to bottom these are:</br>
 +
<cl>
 +
1. '''variables''' - opening this view while stopped in an active function will reveal variable values and update them as you step through.
 +
* '''Breakpoints''' -This view shows active breakpoints and their locations. It also allows you to toggle them off and on and delete them.
 +
* '''expressions''' -Type in an expression (a variable or an equation of variables and constants) and this view will evaluate them for you.
 +
* '''live expression''' - Updates expression values while the code is running ('live'). Only available with Segger J-link
 +
* '''SFRs''' - shows values of peripheral registers
 +
</cl>
 +
Other views are available by navigating to the top of the window and selection '''Window->Show View''' and selecting one of the available views.
  
==== STM32CubeMX and Code Generation ====
 
  
 +
===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.
  
 +
[[File:breakpoint.png]]</br>
  
{{:Templateimpl:bg | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
+
The breakpoint can be turned off by double clicking line, or by deleting it through the breakpoint view.  
Qt Creator is a cross-platform Open Source Integrated Development Environment (IDE) that can be used to develop software for many different languages. It includes a visual debugger and an integrated GUI layout and forms designer.  
 
  
For more information visit the Qt Project site http://qt-project.org/wiki/Category:Tools::QtCreator.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************  General Information  *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:geninfo | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
=== Tools Required ===
 
These tools should already be installed if you installed the EMAC SDK using the automatic installer.
 
* [[Getting_Started_with_the_EMAC_OE_SDK | EMAC OE 5.X SDK]]
 
* EMAC Qt Creator
 
* GNU <code>make</code>
 
* CMake
 
=== Setup ===
 
# Make sure the system has the [[Getting_Started_with_the_EMAC_OE_SDK | EMAC OE 5.X SDK and tools installed. ]]
 
# Launch EMAC Qt Creator.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************  Using/Working With  ******************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:using | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
  
1. Launch Qt Creator using one of the following methods:
 
* Click the Qt Creator icon on the the desktop
 
* In the terminal, execute the following commands:
 
{{cli | username=developer | hostname=ldc | cd ~/EMAC-SDK/emac-QtCreator/bin }}
 
{{cli | username=developer | hostname=ldc | pwd=~/EMAC-SDK/emac-QtCreator/bin | ./qtcreator.sh }}
 
  
 +
=== STM32CubeMX and Code Generation ===
  
2. To generate a new project from Qt Creator, select '''New Project''' on the opening splash window. The examples being used are all written in the <code>C programming</code> language.
+
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.
  
[[File:QtCreatorGUInew.png|600px|left|thumb|Figure 1: Qt Creator GUI]]
 
<br clear=all>
 
  
3. After selecting '''New Project''' a new window will pop up. To run a <code>C programming</code> example using EMAC hardware, select '''EMAC Project''' under the Projects tab. Then select '''EMAC C Project (CMake Build)'''. Click the '''Choose''' button on the bottom right of the window to continue to the next page as shown in Figure 3.
+
{{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'' }}
  
[[File:EMAC_C_Project.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]
 
<br clear=all>
 
  
4. The next page will be '''Introduction and Project Location'''. Select a name for the <code> C </code> project. Once the project name is given, choose a directory to store the project. Note: It is highly recommended to store your project somewhere other than the default location. For this example, we used <code>/home/developer/Projects</code>.
+
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}
 
 
[[File:Project_location1.png|600px|left|thumb|Figure 3: Qt Creator Project Location]]
 
<br clear=all>
 
 
 
5. The next page summarizes the '''EMAC C Project'''. Click '''Finish''' to continue.
 
 
 
[[File:Project_summary1.png|600px|left|thumb|Figure 4: Qt Creator Project Summary]]
 
<br clear=all>
 
 
 
6. The next step is to set up the device you will be using for the Qt Creator examples. Click Tools -> Options
 
{{note|The board used for this example is the iPac-9x25. The iPac-9x25 is a 32-bit ARM architecture. Make sure to connect power, Ethernet, and serial to the board.}}
 
 
 
7. Select '''Devices''' from the left pane.
 
 
 
[[File:Options_devices.png|600px|left|thumb|Figure 5: Qt Creator Device Option]]
 
<br clear=all>
 
 
 
8. Click the '''Add''' button
 
 
 
9. Select Generic Linux Device, then click '''Start Wizard'''.
 
 
 
[[File:Generic_linux.png|600px|left|thumb|Figure 6: Qt Creator Wizard Selection]]
 
<br clear=all>
 
 
 
10. Type in a name, the IP address, the user name, and the password for the device. Use the credentials below to sign in.
 
 
 
{| class="wikitable"
 
!colspan="2"|Table 4: Default Login Credentials
 
|-
 
! Username !! Password
 
|-
 
| root || emac_inc
 
|}
 
 
 
[[File:Device_connection.png|600px|left|thumb|Figure 7: Qt Creator Configuration Setup]]
 
<br clear=all>
 
 
 
11. Click '''Next'''.
 
 
 
12. Click '''Finish'''.
 
 
 
13. A connection will be established with the target device.
 
  
[[File:Device_test.png|600px|left|thumb|Figure 8: Qt Creator Device Test]]
 
<br clear=all>
 
  
14. Click '''Close'''.
 
  
15. Click '''Apply'''.
+
[[ Getting Started with CutiPy and FreeRTOS | Getting Started with CutiPy and FreeRTOS ]]
  
16. Navigate to the '''Projects''' tab. Here, Qt Creator will ask you to select which kits you will be using with the project. For this example,  we made sure the '''arm''' kit was selected. Then click '''Configure Project'''.
+
[[CutiPy FreeRTOS Documentation | CutiPy FreeRTOS Documentation]]
  
[[File:Configproject.png|600px|left|thumb|Figure 9: Configureing Qt Project]]
+
[[FreeRTOS | FreeRTOS]]
<br clear=all>
 
 
 
17. Now, on the left side of Qt Creator, you will see the project icon, which looks like a monitor. Click this and make sure '''Arm''' is selected under '''Kit''', '''Default''' is selected under '''Build''', and the project is set to be run on the remote device under '''Run'''.
 
 
 
[[File:Kitselection.png|600px|left|thumb|Figure 10: Selecting Qt Kit]]
 
<br clear=all>
 
 
 
18. Now, simply press the green play button. The program should run on the target device and yield an output.
 
 
 
[[File:Qtoutput.png|900px|left|thumb|Figure 11: Successfully running Qt Project]]
 
<br clear=all>
 
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************    Conclusion      ******************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:conclusion | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
This page is a quick getting started tutorial on how to use EMAC Qt Creator for the first time. It shows you how to create an EMAC C Project, how to set up the necessary kits for your target board, how to set up your target board, and how to build and run example projects.
 
 
 
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!--{{:Templateimpl:moreinfo | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}
 
* -->
 
 
 
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}
 
* [[Getting_Started_with_the_EMAC_OE_SDK | Getting Started with the EMAC OE SDK ]]
 

Latest revision as of 09:54, 24 March 2020

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