Difference between revisions of "STM32CubeIDE"

From wiki.emacinc.com
Jump to: navigation, search
Line 49: Line 49:
  
 
[[File:DebugToolbar1.png]]
 
[[File:DebugToolbar1.png]]
 +
From left to right these symbol accomplish the following:
 +
<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)
 +
 +
 +
  
 
[[File:DebugToolbar2.png]]
 
[[File:DebugToolbar2.png]]

Revision as of 12:12, 18 March 2020

The following page demonstrates the process of getting familiar with EMAC Qt Creator and running it on the target machine.

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: <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)



DebugToolbar2.png



STM32CubeMX and Code Generation

Background

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

Tools Required

These tools should already be installed if you installed the EMAC SDK using the automatic installer.

Setup

  1. Make sure the system has the EMAC OE 5.X SDK and tools installed.
  2. Launch EMAC Qt Creator.

Getting Started with Qt Creator

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:
developer@ldc:~# cd ~/EMAC-SDK/emac-QtCreator/bin
developer@ldc:~/EMAC-SDK/emac-QtCreator/bin# ./qtcreator.sh


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 C programming language.

File:QtCreatorGUInew.png
Figure 1: Qt Creator GUI


3. After selecting New Project a new window will pop up. To run a C programming 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.

Figure 2: Qt Creator EMAC Project


4. The next page will be Introduction and Project Location. Select a name for the C 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 /home/developer/Projects.

Figure 3: Qt Creator Project Location


5. The next page summarizes the EMAC C Project. Click Finish to continue.

Figure 4: Qt Creator Project Summary


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.

Figure 5: Qt Creator Device Option


8. Click the Add button

9. Select Generic Linux Device, then click Start Wizard.

Figure 6: Qt Creator Wizard Selection


10. Type in a name, the IP address, the user name, and the password for the device. Use the credentials below to sign in.

Table 4: Default Login Credentials
Username Password
root emac_inc
Figure 7: Qt Creator Configuration Setup


11. Click Next.

12. Click Finish.

13. A connection will be established with the target device.

Figure 8: Qt Creator Device Test


14. Click Close.

15. Click Apply.

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.

Figure 9: Configureing Qt Project


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.

Figure 10: Selecting Qt Kit


18. Now, simply press the green play button. The program should run on the target device and yield an output.

Figure 11: Successfully running Qt Project


Conclusion

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.


Pages with Related Content