当前位置:网站首页>Using clion to realize STM32F103 lighting LED

Using clion to realize STM32F103 lighting LED

2022-06-23 21:20:00 AnieaLanie

1. Clion

1.1 Clion brief introduction

Clion It's designed for development C And C++ Designed cross platform IDE. It is a IntelliJ Designed for the foundation , It includes a lot of intelligent functions to improve the productivity of developers .CLion Help developers use intelligent editors to improve code quality 、 Automatic code refactoring and deep integration CMake Compiling system , So as to improve the working efficiency of developers .

1.2 Clion Environmental installation

Software environment :

  • Windows 10
  • STM32CubeMX
  • Clion-2019
  • MinGW
  • OpenOCD
  • arm-none-eabi-gcc

Hardware environment :

  • STM32F103C8T6

Tool installation :

  1. STM32CubeMXhttps://www.st.com/en/development-tools/stm32cubemx.html
  2. OpenOCD:OpenOCD It's for STM32 Tools for downloading simulation , Is an open source software package ,Windows Version from here download

Environment configuration :

stay Clion Middle configuration OpenOCD and STM32CubeMX

Click on File -> Setting

To configure OpenOCD and STM32CubeMX The path of

Installation and compilation environment MinGW:

Clion Need to use MinGW Environment to configure the tool chain , Go to MinGW The home page downloads the latest version of MinGW: Minimalist GNU for Windows

Add... After installation MinGW\bin To the system Path in , And restart the system

Last , Open the command line window , Input gcc -v Check whether the installation is successful

Compile environment 2:arm-none-eabi-gcc

Windows Download here :https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads , choice ZIP Compression package form

Unzip to a folder , And will bin Directory added to environment variable

Use arm-none-eabi-gcc -v Command to view the output information

Clion To configure :

to Clion Good configuration MinGW and CMake Environmental Science

open File -> Settings -> Build,Execution,Deployment, stay ToolChain Add below MinGW and arm-none-eabi-gcc Environmental Science

2. stay CLion Created in STM32CubeMX project

2.1 establish CubeMX engineering

Click on Open With Cubemx, open STM32CubeMX To modify the project configuration

Modify chip as F103C8

Chip modification completed

2.2 To configure CubeMX Project engineering

To configure SYS:

To configure RCC

Configure pins

Set up PC13 Pin for GPIO_Output To light up LED The lamp .

Configure serial port USART1

modify IDE

Preservation works , Overwrite the original project with the original project name

go back to CLion, choice st_nucleo_f103rb.cfg

seek st_nucleo_f103rb.cfg file location

Click on three points , You can view the directory

modify st_nucleo_f103rb.cfg file , Note out the 10 That's ok

Add code , open main.c, add to LED Flashing code

Configuration before compilation

Compile

Successful compilation is visible

Burn program :

Finally, use the serial port program to burn into the development board .

2.3 Program effect

3. Reference resources

CLion2021 The detailed installation is based on CLion Realization stm32F103 Lighten up LED

原网站

版权声明
本文为[AnieaLanie]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/12/202112251400144386.html