Set the mode to Asynchronous, and check that the baud rate is set to 115200 Bits/s, with 8-bit word length, no parity, and 1 stop bit. With the "Pinout & Configuration" tab open, we'll expand the "Connectivity" pane, and then select USART2. This is useful to skip manually setting up GPIO for the user button and LEDs. If you are selecting a board rather than a bare microcontroller, CubeMX will prompt if the peripherals should be configured in their default mode. In this example, we'll be setting up ElectricUI to operate over USART2 which corresponds to pins PA2 and PA3. This article will use the trusty STM32F407 Discovery Board. The template doesn't start with our target microcontroller selected, clicking the name of the microcontroller in the top breadcrumb bar next to "Home" will take you to the device selection page.įind your microcontroller or development board. ioc file which you need to edit in CubeMX. We'll also cover project creation basics, but will configure the peripherals and change firmware needed to actually get things running.Ĭreate a new project with the STM32CubeMX template.
This JetBrains article shows the process and covers dependancy resolution and configuration. We'll basically follow the normal project creation process with CLion's embedded support. We also have a Github repo with a DMA based UART example for the STM32F4 which is a bit more advanced than this guide.Ī STM32F407 Discovery development board is used, but most STM32 targets should also work fine. Close configuration window.This guide uses CLion 2019.1 with integrated embedded support, and will cover the entire process of creating a new STM32F4 project, setting up the UART, and then integrating Electric UI. Please navigate to the “Peripheral” tab in a “Debug” view, press the “Configure” iconĪnd select registers to monitor. Please select PlatformIO DebugĬonfiguration and press the “Debug” button: Peripheral Registers ¶ “PlatformIO for CLion” supports Debugging which allows you to debug yourĪpplication with 1-Click without extra steps. Please note that you need to manually close/stop device monitor before firmware uploading. You can also configureĭevice monitor per project using Monitor options. Please open CLion terminal and use Device Manager CLI. Select PlatformIO Upload configuration and use the “Build” button for projectĬompilation or the “Run” for a firmware uploading: Remove pre-task (“Build”) from PlatformIO Upload and PlatformIO DebugĬonfigurations to avoid double project building. PlatformIO Debug configurations (you can add the rest configurations if you need them): Open project configuration wizard and add PlatformIO Upload and */ #include "Arduino.h" // Set LED_BUILTIN if it is not defined by Arduino framework // #define LED_BUILTIN 13 void setup () Build & Upload ¶ ** * Blink * * Turns on an LED on for one second, * then off for one second, repeatedly. Rename main.c file in src folder to main.cpp (right click on a file Please USE ONLY Latin characters (a-z) in a project name toĪvoid further issues with project compilation. Please open “New Project” wizard, select board and framework, and create a new
CLION TUTORIAL HOW TO
Have a general understanding of how to work with projects in the CLion IDE. You a creation process of a simple “Blink” example. This tutorial introduces you to the basics of PlatformIO for CLion workflow and shows Intermediate CMakeLists.txt, but there is no ETA for this feature. At the moment we’re working on better integration with CLion without this Because of this approach, there is a conflict betweenĬMakeLists.txt used by ESP-IDF and CMakeLists.txt which PlatformIO generatesįor CLion. Provide more seamless integration, PlatformIO uses the CMake file-based API to extractīuild configurations.
Starting with version 4.0, ESP-IDF uses a build system based on CMake. See how to Convert Arduino file to C++ manually. As a result, itĭoesn’t support the Arduino files ( *.ino and.
CLION TUTORIAL CODE
ino files are not supported ¶ĬLion uses “CMake” tool for code completion and code linting. Press “+” button and PlatformIO-based project profiles: Arduino. Please open CLion Settings and navigate to “Build, Execution, Deployment > CMake”.
This is a known issue CLion CPP-19478: CLion does not handle “CMAKE_CONFIGURATION_TYPES” from CMakeLists.txt.Ī temporary solution is to manually configure project profiles in CLion.
CLION TUTORIAL UPDATE
Update CLion configuration: “Tools > PlatformIO > Re-Init” CLion does not load project build environments from “platformio.ini” ¶ There is a feature request CLion #CPP-18367: Follow platformio.ini changes and update the project. Please note that “PlatformIO for CLion” plugin does not update automatically CLionĬonfiguration.