diff --git a/.gitignore b/.gitignore index f6d04ee1aaa6e8bda674c6cfea715c2217d44b10..b10e5009d877c731dfd1f6c82de0357b5c94a996 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +doc/source/_build doc/_build +.vscode diff --git a/vscode/.vscode/launch.json b/vscode/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..464a128a878c09802baede1fe4cd0a451159799a --- /dev/null +++ b/vscode/.vscode/launch.json @@ -0,0 +1,41 @@ +{ + // 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": [ + + { + "name": "(gdb) Zephyr", + "type": "cppdbg", + "request": "launch", + // 需要调试的zephyr镜像地址,由于launch.json在build目录下,此处的${workspaceFolder}为build目录的 + //路径 + "program": "${workspaceFolder}/zephyr/zephyr.elf", + //嵌入式开发,一般无法指定参数所以为空 + "args": [], + //在程序入口中停止 + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + //一般不用设,因为ninja已经处理好了 + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + // qemu的debugserver默认打开1234端口 + "miDebuggerServerAddress": "localhost:1234", + // gdb路径 + "miDebuggerPath": "/opt/zephyr-sdk/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gdb", + // -nx 意为不调用.gdbinit来进行初始化 + "miDebuggerArgs": "-nx", + // 基于qemu的调试需要首先启动qemu的debugserver, 所以需要preLanuchTask, 真实硬件调试可以不需要 + "preLaunchTask":"zephyr_debugserver", + }, + ] +} \ No newline at end of file diff --git a/vscode/.vscode/tasks.json b/vscode/.vscode/tasks.json new file mode 100644 index 0000000000000000000000000000000000000000..75453b4289ac044ae050192365ddb862cd54db52 --- /dev/null +++ b/vscode/.vscode/tasks.json @@ -0,0 +1,105 @@ +{ + "options": { + "env": { + // 定义你的目标开发板 + "ZEPHYR_BOARD": "qemu_cortex_a53", + // 定义你的应用所在目录 + "ZEPHYR_APPLICATION": "${workspaceFolder}/../zephyr/samples/subsys/ipc/openamp_qemu_cortexa53", + } + }, + "tasks": [ + // 调用ninja 构建zephyr应用 + { + "type": "shell", + "label": "Zephyr 构建", + "command": "ninja", + "args": [ + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + } + // 清楚Zephyr的目标文件,如.o, .a等等 + { + "type": "shell", + "label": "Zephyr 清除", + "command": "ninja", + "args": [ + "clean" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + ], + } + // 调用menuconfig 配置Zephyr + { + "type": "shell", + "label": "Zephyr Menuconfig", + "command": "ninja", + "args": [ + "menuconfig" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + ], + "detail": "Zephyr menuconfig" + } + //清楚所有工程文件 + { + "type": "shell", + "label": "Zephyr清除所有工程文件", + "command": "rm -r *", + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + ], + } + // Zephyr Cmake Configuration + { + "type": "shell", + "label": "Zephyr 配置", + "command": "cmake", + // cmake的额外参数在此添加 + "args": [ + "-GNinja", // 使用Ninja作为构建后端,Ninja比makefile速度更快 + "-DBOARD=$ZEPHYR_BOARD", + "$ZEPHYR_APPLICATION", + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + ], + } + // 通过ninja debugserver, 调用qemu开始调试 + { + "type": "shell", + "label": "zephyr_debugserver", + "command": "ninja", + // cmake的额外参数在此添加 + "args": [ + "debugserver", + ], + //必须为true, 否则会阻塞gdb的运行 + "isBackground": true, + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + ], + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/vscode/zephyr.code-workspace b/vscode/zephyr.code-workspace new file mode 100644 index 0000000000000000000000000000000000000000..1ab4c2afa2930532a6b0268461ba09c64b896b9f --- /dev/null +++ b/vscode/zephyr.code-workspace @@ -0,0 +1,21 @@ +{ + "folders": [ + { + "path": "zephyr" + }, + { + "path": "build" + }, + { + "path": "modules/lib/open-amp" + }, + { + "path": "modules/hal/libmetal" + } + ], + "settings": { + "C_Cpp.default.compileCommands": "${workspaceFolder}/../build/compile_commands.json", + "C_Cpp.default.cStandard": "c99", + "C_Cpp.default.cppStandard": "c++11", + } +} \ No newline at end of file