This repository contains a simple C++ demo with Application/application.cpp file. It is based on
- 🔗STM32CubeMX (v6.17.0)
- 🔗Visual Studio Code (v1.117.0) with the
- ST extension pack 🔗 STM32CubeIDE for Visual Studio Code (v3.8.0)
nucleo-h753zi-threadx-demo/ ....... # Root folder of repository.
├─ STM32Project/ .................. # Root folder of STM32 firmware project.
│ ├─ .settings/
│ │ ├─ bundles.store.json ....... # Versions of st bundles, see System Bundle Manager in STM32CubeIDE for Visual Studio Code extension.
│ │ ├─ bundles-lock.store.json .. # Versions of st bundles, see System Bundle Manager in STM32CubeIDE for Visual Studio Code extension.
│ │ └─ ide.store.json ........... # Board information.
│ ├─ .vscode/
│ │ ├─ launch.json .............. # Debugger configuration.
│ │ └─ task.json ................ # Task to restart incl. build during debugging.
│ ├─ Application/
│ │ ├─ application.cpp .......... # Simple demo application.
│ │ └─ CMakeLists.txt ........... # Changed compiler settings, automatic include sources in 'Application' folder.
│ ├─ Core/
│ │ └─ Src/
│ │ └─ main.c ................ # Added the call of C++ functions Setup() and Loop().
│ ├─ .clangd ..................... # Clangd configuration
│ ├─ .clang-format ............... # Example of clang formatter configuration.
│ ├─ .gitignore .................. # Git ignore configuration.
│ ├─ CMakeLists.txt .............. # Link to 'Application' subdirectory added, this includes the CMakeLists.txt in Application folder.
│ ├─ README.doc .................. # GitHub readme file.
│ ├─ STM32Firmware.ioc ........... # STM32 configuration file for STM32CubeMX
│ └─ STM32Project_open_in_VSCode.code-workspace # VSCode workspace to open the project via double click.
Install and configure the tools:
-
Install STM32CubeMx 🔗STM32CubeMX
-
Install the 🔗STM32CubeH7 MCU Package in SMT32CubeMX
-
Install the 🔗STLink Upgrade Tool.
-
Connect the CN1 Micro-USB of your NUCLEO-H753ZI board to your PC.
-
Start the tool by double-clicking the
STLinkUpgrade.jarfile. -
Set
MCO OutputtoHSE/5 (5MHz)
This is the clock that is provided to the STM32 as the HSE clock.🔍 Background:
The 5 MHz value has been selected to make it easier to reach the STM32H753ZI's maximum CPU clock of 480 MHz. For other controllers, different values may be required. Please refer to the relevant STM32 configuration page or use the STM32CubeMx tool to find the correct value.
-
Install 🔗Visual Studio Code
-
Create a
STM32 DevVSCode profile for STM32 development (see: https://code.visualstudio.com/docs/configure/profiles). -
In this
STM32 Devprofile install the extension pack 🔗 STM32CubeIDE for Visual Studio Code
-
Clone this repo.
-
Open
STM32Firmware.iocin STM32CubeMX and generate the sources. -
Open VSCode and switch to the
STM32 Devprofile. -
Select 'File' / 'Open Workspace from File...' and search the file
STM32Project_open_in_VSCode.code-workspace -
Click
yesif the message boxWould you like to configure discovered CMake project(s) as STM32Cube project(s)?appears in the lower right corner.💡 Hint:
If this dialog box does not appear, or if it disappears after a few seconds, try closing the project folder via 'File' / 'Close workspace' and > opening it again in VSCode. Please be patient, it may take more than 30 seconds for the dialog box to appear. -
Click
DebugifSelect a configure preset for STM32Projectappears in top command bar.💡 Hint:
If you miss this selection, enter the command >CMake: Select Configure Preset to show it again.
- Open the project by double clicking the
STM32Project_open_in_VSCode.code-workspacefile.
-
Perform the command
>CMake: Delete Cache and Reconfigure.💡 Hint:
This will rebuild the CMake structure. This is only needed if you change something on CMakeLists.txt or you add, rename or delete a source file.
If you have some changes on clangd or other issues delete the complete build folder and try again. -
Perform a complete clean rebuild with the command
>CMake: Clean Rebuild. -
Or build only the changes with the command
>CMake: Build
-
Connect the CN1 Micro-USB of your NUCLEO-H753ZI board to your PC.
-
Switch to the 'Run and Debug' view in the right sidebar.
-
Click on the green play button.