其中,需要手动添加.vscode文件夹,并在.vscode文件下添加以下4个文件
c_cpp_properties.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
“version”: 4,
“configurations”: [
{
“name”: “GBA”,
“compilerPath”: “C:/devkitPro/devkitARM/bin/arm-none-eabi-gcc.exe”,
“intelliSenseMode”: “gcc-arm”,
“cStandard”: “gnu11”,
“includePath”: [
“workspaceFolder/source","{workspaceFolder}/source", "workspaceFolder/source","{workspaceFolder}”,
“C:/devkitPro/libgba/include”,
“C:/devkitPro/devkitARM/arm-none-eabi/include”
],
“defines”: [
“GBA”,
“ARM7”
]
}
]
}
launch.json ,注意,这里配置的gba模拟器的路径,用于直接启动mGBA模拟器测试我们开发的程序
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
“version”: “0.2.0”,
“configurations”: [
{
“name”: “Run mGBA”,
“type”: “cppvsdbg”,
“request”: “launch”,
“program”: “C:/dev/Emulator/mGBA-0.10.5-win32/mGBA.exe”,
“args”: [
“workspaceFolder/template.gba"],"cwd":"{workspaceFolder}/template.gba" ], "cwd": "workspaceFolder/template.gba"],"cwd":"{workspaceFolder}”
}
]
}
settings.json
1
2
3
4
5
6
7
8
{
“files.associations”: {
“*.h”: “c”
},
“editor.tabSize”: 4,
“editor.insertSpaces”: true,
“C_Cpp.default.configurationProvider”: “ms-vscode.makefile-tools”
}
tasks.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
“version”: “2.0.0”,
“tasks”: [
{
“label”: “Build GBA”,
“type”: “shell”,
“command”: “make”,
“args”: [],
“group”: {
“kind”: “build”,
“isDefault”: true
},
“problemMatcher”: [
“$gcc”
]
},
{
“label”: “Clean”,
“type”: “shell”,
“command”: “make”,
“args”: [
“clean”
]
}
]
}
最后 Makefile要复制到 C:\devkitPro\examples\gba\template ,否则编译时报错
在source文件下有一个template.c, 按ctrl+shift+b 来编译程序
控制台会输出以下内容