![]() Set a breakpoint on the HAL_GPIO_WritePin() call and press F5 to begin debugging:.You can build it by pressing Ctrl-Shift-B: If VisualGDB suggests installing the WinUSB driver, proceed with it: On the next page select OpenOCD as the debug method, connect your board, press “detect” and “test selected OpenOCD settings”.On the next page proceed with the default LEDBlink sample and specify the LED port according to the STM32-Nucleo-F411RE schematics:.If it is not available, click “download support for more devices”: Select the STM32F411RE device from the device list.If it is not present, VisualGDB will download it automatically: On then next page select the ARM toolchain.Proceed with the default “binary” settings on the first page:.Select File->New->Project and select the Embedded Project Wizard from the VisualGDB wizards. We will create a simple ‘blinking LED’ project, build it, step through it in debugger and use the Code Map to visualize the structure of the HAL library. You will need the following hardware and software to follow this tutorial: The project created throughout this guide can be used as a boilerplate for the next projects based on the STM32 Nucleo-F401RE board.This tutorial shows how to create a simple project for the STM32-Nucleo-F411RE board with Visual Studio. This guide showed how to start developing for STM32 microcontrollers from within Visual Studio Code and the PlatformIO ecosystem. The initialization of a debug session will take some time and when the first line after the main function is highlighted the project is ready for debugging:ĭuring a debug session it’s possible to step through the code using control buttons, set breakpoints, see peripheral registers, and add variables to the Watch window: To start a debugging session you can use the Start Debugging option in the PlatformIO Quick Access menu, Debug: Start debugging from the top menu, or the hotkey button F5: PlatformIO offers the easiest way to debug your applications. > PlatformIO: UploadĪfter successful uploading, the green LED2 should start blinking. Command Palette View: Command Palette > PlatformIO: Upload.Upload option on the Project Tasks menu.The following options can be used to upload the firmware to the board: If you see errors, please check your typing carefully and try again. If everything went well, the successful result should be printed in the terminal window: Command Palette View: Command Palette > PlatformIO: Build.The following options are available to compile the final firmware: Void LED_Init () int main ( void ) Īfter this step the project is ready for compiling and uploading. #define LED_GPIO_CLK_ENABLE() _HAL_RCC_GPIOA_CLK_ENABLE() ![]() Right click on the src in the project window: Firstly, a new file main.c should be created in the src folder. Now some actual code can be added to the project. After these steps a fully configured project is ready for developing code with the STM32Cube framework. Processing the selected project may take a considerable amount of time as PlatformIO will download and install all required packages. In the next step, ST Nucleo-F401RE should be selected as the development board, STM32Cube as the framework, and a path to the project location (or use the default one): The same PlatformIO Home App is used to create a new project: When all installation steps are completed, a dialog window will pop up to tell you that the ststm32 platform has been installed. The easiest way to install any development platform is the PlatformIO Home App: This way PlatformIO will do all the heavy lifting by installing everything that is needed (toolchain, framework, etc) automatically. Once the PlatformIO IDE is ready, the ST STM32 development platform can be installed. The most up-to-date and detailed installation instructions can be found in the official PlatformIO IDE for VSCode documentation. In this guide Visual Studio Code is used as the editor. Some software needs to be installed before diving into the development process. It has out-of-the-box support for STM32 microcontrollers and allows working with low-level libraries like CMSIS, STM32Cube, and LibOpenCM3 as well as with popular high-level frameworks like Arduino, Mbed, or Zephyr without changing your development environment.Ī detailed overview of the PlatformIO ecosystem and its philosophy can be found in the official documentation. PlatformIO is a professional collaborative platform for embedded development that includes lots of instruments for the most common development tasks. The goal of this guide is to show you how simple it is to set up PlatformIO with Visual Studio Code and use it to compile, upload, and debug STM32Cube-based application on the STM32 Nucleo-F401RE board. This guide will help you take the first steps with programming STM32 microcontrollers using the PlatformIO ecosystem. Note that this tutorial is written by and maintained by the PlatformIO team.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |