{
"version": "2.0.0",
"tasks": [
{
"label": "Build", // 任务名
"type": "shell", // 任务执行的是shell命令
"command": "make", // 任务命令
"problemMatcher": "$gcc", // GCC捕获错误
},
{
"label": "Build Clean", // 任务名
"type": "shell", // 任务执行的是shell命令
"command": "make clean", // 任务命令
"problemMatcher": "$gcc", // GCC捕获错误
},
{
"label": "Program", //下载代码
"type": "shell",
"command": "JLinkExe -device stm32f103vb -autoconnect 1 -if SWD -speed 4000 -CommandFile CommandFile.jlink",
"dependsOn": "Build", // 依赖"Build"命令先运行
"problemMatcher": [],
"group": { // 设置为默认"build"组命令,⇧⌘B 按键快速编译烧录
"kind": "build",
"isDefault": true
}
},
{
"label": "Disassembly",
"type": "shell",
"command": "arm-none-eabi-objdump -ldS OBJ/STM32_REG_TEST1.elf > STM32_REG_TEST1.asm",
"problemMatcher": [],
},
{
"label": "GDBServer",
"type": "shell",
"command": "JLinkGDBServer -select USB -device STM32F103RC -endian little -if SWD -speed 4000 -noir -noLocalhostOnly",
"problemMatcher": [],
},
{
"label": "Connect to JLink",
"type": "shell",
"command": "JLinkExe -device stm32f103vb -autoconnect 1 -if SWD -speed 4000",
"dependsOn": "make",
"problemMatcher": [],
},
{
"label": "JLink RTT log",
"type": "shell",
"command": "JLinkRTTClient",
"problemMatcher": [],
}
]
}
{
"version": "0.2.0",
"configurations": [
{
"name": "DGB debug",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "arm",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}", // 工作路径
"environment": [],
"externalConsole": false,
//"preLaunchTask": "Program", // 前置任务
//"postDebugTask": "...", // 后置任务
"MIMode": "gdb",
"miDebuggerPath": "/Users/peixu/toolchain/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gdb", // GDB command路径
"launchCompleteCommand": "None",
"miDebuggerServerAddress": "localhost:2331", // GDBSerevr IP:Port
"customLaunchSetupCommands": [
{
"text": "file /Users/peixu/Documents/Embedded/Project/21_cleaner_x/cleaner_x/sdk/source/mcu/vscode_envirment_bootloader_test/bootloader_vscode_makefile/build/bootloader_vscode_makefile.elf",
"description": "Load symbol file",
"ignoreFailures": false
},
{
"text": "target remote :2331",
"description": "Connet to GDB server",
"ignoreFailures": false
},
{
"text": "break main",
"description": "Set breakpoints at main",
"ignoreFailures": false
},
{
"text": "monitor reset",
"description": "Reset the target",
"ignoreFailures": false
},
]
}
]
}
5. 创建jlink文件
% vim CommandFile.jlink
h
loadbin build/bootloader_vscode_makefile.bin 0x8000000
r
g
qc
% JLinkExe -device stm32f103rc -autoconnect 1 -if SWD -speed 4000 -CommandFile CommandFile.jlink