-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Add directions in using STM32CubeIDE #79148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mmahadevan108
merged 1 commit into
zephyrproject-rtos:main
from
rm5248:add-stm32cube-directions
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,5 @@ Tools and IDEs | |
|
|
||
| clion.rst | ||
| coccinelle.rst | ||
| stm32cubeide.rst | ||
| vscode.rst | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| .. _stm32cube_ide: | ||
|
|
||
| STM32CubeIDE | ||
| ############ | ||
|
|
||
| STM32CubeIDE_ is an Eclipse-based integrated development environment from STMicroelectronics designed for the STM32 series of MCUs and MPUs. | ||
|
|
||
| This guide describes the process of setting up, building, and debugging Zephyr | ||
| applications using the IDE. | ||
|
|
||
| A project must have already been created with Zephyr and west. | ||
|
|
||
| These directions have been validated to work with version 1.16.0 of the IDE | ||
| on Linux. | ||
|
|
||
| Project Setup | ||
| ************* | ||
|
|
||
| #. Before you start, make sure you have a working Zephyr development environment, as per the | ||
| instructions in the :ref:`getting_started`. | ||
|
|
||
| #. Run STM32CubeIDE from your Zephyr environment. Example: | ||
|
|
||
| .. code-block:: | ||
|
|
||
| $ /opt/st/stm32cubeide_1.16.0/stm32cubeide | ||
|
|
||
| #. Open your already existing project by going to | ||
| :menuselection:`File --> New --> STM32 CMake Project`: | ||
|
|
||
| .. figure:: img/stm32cube_new_cmake.webp | ||
| :align: center | ||
| :alt: Create new CMake project | ||
|
|
||
| #. Select :guilabel:`Project with existing CMake sources`, then click :guilabel:`Next`. | ||
|
|
||
| #. Select :menuselection:`Next` and browse to the location of your sources. The | ||
| folder that is opened should have the ``CMakeLists.txt`` and ``prj.conf`` files. | ||
|
|
||
| #. Select :menuselection:`Next` and select the appropriate MCU. | ||
| Press :guilabel:`Finish` and your project should now be available. | ||
| However, more actions must still be done in order to configure it properly. | ||
|
|
||
| #. Right-click on the newly created project in the workspace, and select | ||
| :guilabel:`Properties`. | ||
|
|
||
| #. Go to the :guilabel:`C/C++ Build` page and set the Generator | ||
| to ``Ninja``. In :guilabel:`Other Options`, specify the target ``BOARD`` in | ||
| CMake argument format. If an out-of-tree board is targeted, the ``BOARD_ROOT`` | ||
| option must also be set. The resulting settings page should look similar to this: | ||
|
|
||
| .. figure:: img/stm32cube_project_properties.webp | ||
| :align: center | ||
| :alt: Properties dialog for project | ||
|
|
||
| These options may or may not be needed depending on if you have an | ||
| out-of-tree project or not. | ||
|
|
||
| #. Go to the :menuselection:`C/C++ General --> Preprocessor Include` page. | ||
| Select the :guilabel:`GNU C` language, and click on the | ||
| :menuselection:`CDT User Settings Entries` option. | ||
|
|
||
| .. figure:: img/stm32cube_preprocessor_include.webp | ||
| :align: center | ||
| :alt: Properties dialog for preprocessor options | ||
|
|
||
| Click :guilabel:`Add` to add an :guilabel:`Include File` | ||
| that points to Zephyr's ``autoconf.h``, which is located in | ||
| ``<build dir>/zephyr/include/generated/autoconf.h``. This will ensure | ||
| that STM32CubeIDE picks up Zephyr configuration options. | ||
| The following dialog will be shown. Fill it in as follows: | ||
|
|
||
| .. figure:: img/stm32cube_add_include.webp | ||
| :align: center | ||
| :alt: Add include file dialog | ||
|
|
||
| Once the include file has been added, your properties page should look | ||
| similar to the following: | ||
|
|
||
| .. figure:: img/stm32cube_autoconf_h.webp | ||
| :align: center | ||
| :alt: Properties page after adding autoconf.h file | ||
|
|
||
| #. Click :guilabel:`Apply and Close` | ||
|
|
||
| #. You may now build the project using the :guilabel:`Build` button on the toolbar. | ||
| The project can be run using the :guilabel:`Run` button, as well as debugged | ||
| using the :guilabel:`Debug` button. | ||
|
|
||
| Troubleshooting | ||
| *************** | ||
|
|
||
| When configuring your project you see an error that looks similar to: | ||
|
|
||
| .. code-block:: | ||
|
|
||
| Error message: Traceback (most recent call last): | ||
|
|
||
| File "/path/to/zephyr/scripts/list_boards.py", line 11, in <module> | ||
| import pykwalify.core | ||
|
|
||
| ModuleNotFoundError: No module named 'pykwalify' | ||
|
|
||
|
|
||
| This means that you did not start the IDE in a Zephyr environment. You must | ||
| delete the ``config_default`` build directory and start STM32CubeIDE again, | ||
| making sure that you can run ``west`` in the shell that you start STM32CubeIDE | ||
| from. | ||
|
|
||
| .. _STM32CubeIDE: https://www.st.com/en/development-tools/stm32cubeide.html | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a note indicating that
config_defaultcomes from the default build folder name chosen by CubeIDE is worth adding here? If the user changes the build folder, or the default name changes in the future, this could save headaches.