From fd8fe29ef3c743d48651b4d202e4cee0134af576 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 5 Dec 2018 10:54:28 -0500 Subject: [PATCH] vscode update targets and gdb debugging --- .vscode/cmake-kits.json | 8 +-- .vscode/cmake-variants.yaml | 73 ++++++++++++++++++------- .vscode/extensions.json | 1 + .vscode/launch.json | 63 +++++++++++++-------- .vscode/settings.json | 2 + .vscode/tasks.json | 15 +++-- platforms/posix/cmake/sitl_target.cmake | 3 + 7 files changed, 111 insertions(+), 54 deletions(-) diff --git a/.vscode/cmake-kits.json b/.vscode/cmake-kits.json index 2624a2e50b..5f09a21261 100644 --- a/.vscode/cmake-kits.json +++ b/.vscode/cmake-kits.json @@ -1,10 +1,6 @@ [ { - "name": "arm-none-eabi-gcc", - "toolchainFile": "cmake/toolchains/Toolchain-arm-none-eabi.cmake" - }, - { - "name": "native", - "toolchainFile": "cmake/toolchains/Toolchain-native.cmake" + "name": "PX4 default", + "preferredGenerator": "Ninja" } ] \ No newline at end of file diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml index 5b52735df2..98c87d0da9 100644 --- a/.vscode/cmake-variants.yaml +++ b/.vscode/cmake-variants.yaml @@ -1,33 +1,68 @@ CONFIG: - default: posix_sitl_default + default: px4_sitl_default choices: - posix_sitl_default: - short: sitl + px4_sitl_default: + short: px4_sitl buildType: RelWithDebInfo settings: - CONFIG: posix_sitl_default - nuttx_px4fmu-v2_default: - short: px4fmu-v2 + CONFIG: px4_sitl_default + px4_sitl_default_Debug: + short: px4_sitl (Debug) + buildType: Debug + settings: + CONFIG: px4_sitl_default + px4_sitl_rtps: + short: px4_sitl_rtps + buildType: RelWithDebInfo + settings: + CONFIG: px4_sitl_rtps + px4_fmu-v2_default: + short: px4_fmu-v2 buildType: MinRelSize settings: - CONFIG: nuttx_px4fmu-v2_default - nuttx_px4fmu-v3_default: - short: px4fmu-v3 + CONFIG: px4_fmu-v2_default + px4_fmu-v3_default: + short: px4_fmu-v3 buildType: MinRelSize settings: - CONFIG: nuttx_px4fmu-v3_default - nuttx_px4fmu-v4_default: - short: px4fmu-v4 + CONFIG: px4_fmu-v3_default + px4_fmu-v4_default: + short: px4_fmu-v4 buildType: MinRelSize settings: - CONFIG: nuttx_px4fmu-v4_default - nuttx_px4fmu-v4pro_default: - short: px4fmu-v4pro + CONFIG: px4_fmu-v4_default + px4_fmu-v4pro_default: + short: px4_fmu-v4pro buildType: MinRelSize settings: - CONFIG: nuttx_px4fmu-v4pro_default - nuttx_px4fmu-v5_default: - short: px4fmu-v5 + CONFIG: px4_fmu-v4pro_default + px4_fmu-v5_default: + short: px4_fmu-v5 buildType: MinRelSize settings: - CONFIG: nuttx_px4fmu-v5_default \ No newline at end of file + CONFIG: px4_fmu-v5_default + px4_fmu-v5_rtps: + short: px4_fmu-v5_rtps + buildType: MinRelSize + settings: + CONFIG: px4_fmu-v5_rtps + airmind_mindpx-v2_default: + short: airmind_mindpx-v2 + buildType: MinRelSize + settings: + CONFIG: airmind_mindpx-v2_default + av_x-v1_default: + short: av-x + buildType: MinRelSize + settings: + CONFIG: av_x-v1_default + intel_aerofc-v1_default: + short: intel_aerofc-v1 + buildType: MinRelSize + settings: + CONFIG: intel_aerofc-v1_default + nxp_fmuk66-v3_default: + short: nxp_fmuk66-v3 + buildType: MinRelSize + settings: + CONFIG: nxp_fmuk66-v3_default diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 086dda8cb4..adc40a5579 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,6 +6,7 @@ "github.vscode-pull-request-github", "chiehyu.vscode-astyle", "marus25.cortex-debug", + "ms-python.python", "vector-of-bool.cmake-tools" ] } diff --git a/.vscode/launch.json b/.vscode/launch.json index 7d5492a988..d3f0c9829c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,43 +2,58 @@ "version": "0.2.0", "configurations": [ { - "name": "(lldb) Launch", + "name": "(gdb) Launch (shell)", "type": "cppdbg", "request": "launch", "program": "${command:cmake.launchTargetPath}", - "args": [], + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", "etc/init.d-posix/rcS", + "-t", "${workspaceFolder}/test_data" + ], "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": true, - "MIMode": "lldb", - }, - { - "name": "(gdb) Launch", - "type": "cppdbg", - "request": "launch", - // Resolved by CMake Tools: - "program": "${command:cmake.launchTargetPath}", - "args": [], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "externalConsole": true, + "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "environment": [{"name": "PX4_SIM_MODEL", "value": "shell"}], + "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", - "ignoreFailures": true + + "ignoreFailures": true, + + "text": "handle SIGCONT nostop noprint nopass", } ] - } + }, { - "cwd": "${workspaceRoot}", - "executable": "${command:cmake.launchTargetPath}", - "name": "Debug Microcontroller", + "name": "(gdb) Launch (jmavsim iris)", + "type": "cppdbg", "request": "launch", - "type": "cortex-debug", - "servertype": "jlink" + "program": "${command:cmake.launchTargetPath}", + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", "etc/init.d-posix/rcS", + "-t", "${workspaceFolder}/test_data" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "environment": [{"name": "PX4_SIM_MODEL", "value": "iris"}], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + + "ignoreFailures": true, + + "text": "handle SIGCONT nostop noprint nopass", + + } + ], + "preLaunchTask": "jmavsim" }, ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c5ef40b8a2..52fe1b80eb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,4 +5,6 @@ "C_Cpp.default.cppStandard": "c++11", "C_Cpp.default.cStandard": "c99", "cmake.buildDirectory": "${workspaceRoot}/build/${variant:CONFIG}", + "cmake.autoRestartBuild": true, + "cmake.configureOnOpen": true, } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d171d02bb4..a5b30e9aeb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,11 +6,16 @@ { "label": "jmavsim", "type": "shell", - "command": "make posix_sitl_default jmavsim", - "group": { - "kind": "build", - "isDefault": true + "command": "Tools/jmavsim_run.sh", + "isBackground": true, + "args": ["-r", "500"], + "options": { + "cwd": "${workspaceRoot}" + }, + "presentation": { + "reveal": "always", + "panel": "dedicated" } - } + }, ] } diff --git a/platforms/posix/cmake/sitl_target.cmake b/platforms/posix/cmake/sitl_target.cmake index 78f55b92f3..524131c8d4 100644 --- a/platforms/posix/cmake/sitl_target.cmake +++ b/platforms/posix/cmake/sitl_target.cmake @@ -1,5 +1,6 @@ set(SITL_WORKING_DIR ${PX4_BINARY_DIR}/tmp) file(MAKE_DIRECTORY ${SITL_WORKING_DIR}) +file(MAKE_DIRECTORY ${SITL_WORKING_DIR}/rootfs) # add a symlink to the logs dir to make it easier to find them add_custom_command(OUTPUT ${PX4_BINARY_DIR}/logs @@ -7,6 +8,8 @@ add_custom_command(OUTPUT ${PX4_BINARY_DIR}/logs WORKING_DIRECTORY ${PX4_BINARY_DIR}) add_custom_target(logs_symlink DEPENDS ${PX4_BINARY_DIR}/logs) +add_dependencies(px4 logs_symlink) + add_custom_target(run_config COMMAND Tools/sitl_run.sh $