vscode + platformIO development stm32f4

My computer environment

win10
vscode 1.36.1

vscode install plug

You will be prompted to install platformIOCore After installing this plug-in, follow the prompts to install. The installation process may slow, may need over the wall.

New Project

Select board type and use framework

Click Finish and wait for the completion of project creation. (For the first time to create a project to be quite a long time, it should also be possible over the wall only)

After the project is created, open view platformio.ini

Modify platformio.ini file

[env:black_f407zg]
platform = ststm32
board = black_f407zg
framework = cmsis

upload = stlink ; 使用stlink烧写代码
debug_tool=stlink ; 使用stlink进行在线调试

; 头文件路径和宏定义
build_flags = 
    -Isrc/Core
    -Isrc/Hardware/inc
    -Isrc/LaSystem/inc
    -Isrc/Lib/inc               ; 添加头文件搜索路径
    -D STM32F40_41xxx           ; 定义全局宏,在keil中也有类似的操作
    -D USE_STDPERIPH_DRIVER     ; 同上

build_type = release ; 这里我这边必须选择debug模式编译,否则代码烧到芯片中无法正常运行

Configuration library functions and other operations

I choose here to use the framework CMSIS, to themselves to copy the corresponding library function 32 to the src directory, you can use

Note that there's just the header file directories and search directories platformio.ini configuration file is corresponding.

Programming the code to the board

First STLink connected, the board for the wires.

The status bar at the bottom left side to the right there is a horizontal arrow symbol, click on it is to upload code.

Checkmark on the bottom status bar is to compile, compile the code before burning it, there is no check what errors.

to sum up

platformIO after real with them is very good, but rarely on the network I own copy of this 32 coming compiled programming, most are based on stm32cube to develop or arduino framework.

The main pit encountered:

  1. platform domestic feeling relatively slow download speeds, do not know is not a good use of my problem is not the node.
  2. As the domestic network environment, the first project of the new platformio time more slowly, and so on for a long time.
  3. There is platformio.ini the configuration file, specifically to see the above comments written more clearly.

Guess you like

Origin www.cnblogs.com/Laggage/p/11263725.html