VSCode 环境配置支持STM32的仿真

  1. 首先下载文件:
    gcc-arm-none-eabi-9-2019-q4-major-win32-sha2
    mingw64
    openocd-0.10.0
    VSCodeSetup-x64-1.42.1

  2. 安装VSCode和openocd-0.10.0。将gcc-arm-none-eabi-9-2019-q4-major-win32-sha2和mingw64解压到C盘。
    make,下载解压后将bin中的mingw32-make.exe重命名为make.exe;然后和openocd一样将make.exe所在完整目录添加到环境变量中;
    在这里插入图片描述

  3. 环境变量包含路径
    在这里插入图片描述

  4. 打开vscode安装插件如下主要安装:c/c++,
    在这里插入图片描述

  5. 通过STM32CubeMX生成make。

  6. 通过vscode打开
    找到launch.json打开后编辑如下。
    {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    “version”: “0.2.0”,
    “configurations”: [
    {
    “cwd”: “${workspaceRoot}”,
    “executable”: “./build/T1.elf”,
    “name”: “Debug Microcontroller”,
    “request”: “launch”,
    “type”: “cortex-debug”,
    “servertype”: “openocd”,
    “configFiles”: [
    “C:/openocd-0.10.0/scripts/interface/stlink-v2-1.cfg”,
    “C:/openocd-0.10.0/scripts/target/stm32f4x.cfg”
    ]
    }
    ]
    }

  7. 找到tasks.json

{
“version”: “2.0.0”,
“tasks”: [
{
“type”: “shell”,
“label”: “Build”,
“command”: “make”,
“args”: [
],
“problemMatcher”: [
KaTeX parse error: Expected 'EOF', got '}' at position 34: …up": "build" }̲, { "type…gcc”
],
“group”: “build”,
“dependsOn”:“Build”
}
]
}

  1. c_cpp_properties.json
    {
    “configurations”: [
    {
    “name”: “Win32”,
    “includePath”: [
    w o r k s p a c e F o l d e r / ∗ ∗ " , " {workspaceFolder}/**", " workspaceFolder/","{workspaceFolder}/Core/Inc”,
    “${workspaceFolder}/Drivers/STM32F4xx_HAL_Driver/Inc”
    ],
    “defines”: [
    “_DEBUG”,
    “UNICODE”,
    “_UNICODE”,
    “-DUSE_HAL_DRIVER”,
    “-DSTM32F411xE”
    ],
    “compilerPath”: “C:\mingw64\bin\gcc.exe”,
    “cStandard”: “gnu17”,
    “cppStandard”: “gnu++14”,
    “intelliSenseMode”: “gcc-arm”
    }
    ],
    “version”: 4
    }

  2. 在编辑中需要用stlink-v2-1.cfg可编译下载成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值