vscode配置arm汇编环境
时间: 2023-09-01 09:07:15 浏览: 652
1. 安装插件:在 vscode 中搜索插件 ARM(Cortex-Debug)并安装。
2. 安装工具链:在 Linux 系统中可以使用 apt-get 命令安装 arm-gcc 工具链,如下所示:
```
sudo apt-get install gcc-arm-none-eabi
```
在 Windows 系统中可以从官网下载安装工具链,并将其添加到系统环境变量中。
3. 配置调试器:在 vscode 中打开 launch.json 文件,并添加以下配置:
```
{
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"request": "launch",
"name": "Debug",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build/main.elf",
"servertype": "openocd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32f1x.cfg"
]
}
]
}
```
4. 配置编译器:在 vscode 中打开 tasks.json 文件,并添加以下配置:
```
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "arm-none-eabi-gcc",
"args": [
"-Wall",
"-Werror",
"-g",
"-mcpu=cortex-m3",
"-mthumb",
"-c",
"${workspaceRoot}/src/*.s",
"${workspaceRoot}/src/*.c",
"-o",
"${workspaceRoot}/build/main.o"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
```
5. 编写代码:在 vscode 中创建一个目录,将所有的汇编文件和 C 文件放入其中。
6. 编译代码:在 vscode 中按下 Ctrl+Shift+B 键,将会自动编译代码。
7. 调试代码:在 vscode 中按下 F5 键,将会自动启动调试器。
阅读全文
相关推荐

















