From 86dc4c5a005281528703389cf508fc1eddfcfd34 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 19 Sep 2019 17:42:51 -0400 Subject: [PATCH] cmake generate vscode launch.json --- .vscode/.gitignore | 3 + .vscode/cmake-variants.yaml | 32 +-- .vscode/launch.json | 260 ------------------------ .vscode/tasks.json | 74 ++++++- platforms/nuttx/CMakeLists.txt | 53 +++++ platforms/nuttx/Debug/launch.json.in | 44 ++++ platforms/posix/Debug/launch.json.in | 246 ++++++++++++++++++++++ platforms/posix/cmake/sitl_target.cmake | 3 + 8 files changed, 433 insertions(+), 282 deletions(-) delete mode 100644 .vscode/launch.json create mode 100644 platforms/nuttx/Debug/launch.json.in create mode 100644 platforms/posix/Debug/launch.json.in diff --git a/.vscode/.gitignore b/.vscode/.gitignore index 1ea7f74304..0b06c7f95a 100644 --- a/.vscode/.gitignore +++ b/.vscode/.gitignore @@ -2,5 +2,8 @@ .cortex-debug.registers.state.json compile_commands.json +# generated by cmake +launch.json + # C/C++ extension does some local caching in this folder ipch/ diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml index 11aac057e2..59c4c25900 100644 --- a/.vscode/cmake-variants.yaml +++ b/.vscode/cmake-variants.yaml @@ -2,67 +2,57 @@ CONFIG: default: px4_sitl_default choices: px4_sitl_default: - short: px4_sitl + short: px4_sitl_default buildType: RelWithDebInfo settings: CONFIG: px4_sitl_default - px4_sitl_default_Debug: - short: px4_sitl (Debug) - buildType: Debug - settings: - CONFIG: px4_sitl_default - px4_sitl_default_ASan: - short: px4_sitl (Address Sanitizer) - buildType: AddressSanitizer - settings: - CONFIG: px4_sitl_default px4_fmu-v2_default: - short: px4_fmu-v2 + short: px4_fmu-v2_default buildType: MinSizeRel settings: CONFIG: px4_fmu-v2_default px4_fmu-v3_default: - short: px4_fmu-v3 + short: px4_fmu-v3_default buildType: MinSizeRel settings: CONFIG: px4_fmu-v3_default px4_fmu-v4_default: - short: px4_fmu-v4 + short: px4_fmu-v4_default buildType: MinSizeRel settings: CONFIG: px4_fmu-v4_default px4_fmu-v4pro_default: - short: px4_fmu-v4pro + short: px4_fmu-v4pro_default buildType: MinSizeRel settings: CONFIG: px4_fmu-v4pro_default px4_fmu-v5_default: - short: px4_fmu-v5 + short: px4_fmu-v5_default buildType: MinSizeRel settings: CONFIG: px4_fmu-v5_default px4_fmu-v5x_default: - short: px4_fmu-v5x + short: px4_fmu-v5x_default buildType: MinSizeRel settings: CONFIG: px4_fmu-v5x_default airmind_mindpx-v2_default: - short: airmind_mindpx-v2 + short: airmind_mindpx-v2_default buildType: MinSizeRel settings: CONFIG: airmind_mindpx-v2_default av_x-v1_default: - short: av-x + short: av_x-v1_default buildType: MinSizeRel settings: CONFIG: av_x-v1_default intel_aerofc-v1_default: - short: intel_aerofc-v1 + short: intel_aerofc-v1_default buildType: MinSizeRel settings: CONFIG: intel_aerofc-v1_default mro_ctrl-zero-f7_default: - short: mro_ctrl-zero-f7 + short: mro_ctrl-zero-f7_default buildType: MinSizeRel settings: CONFIG: mro_ctrl-zero-f7_default diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index b87dd7f4a2..0000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Debug SITL (shell)", - "type": "cppdbg", - "request": "launch", - "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": "shell" - } - ], - "linux": { - "MIMode": "gdb", - "externalConsole": false, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "PX4 ignore wq signals", - "text": "handle SIGCONT nostop noprint nopass", - "ignoreFailures": true - } - ] - }, - "osx": { - "MIMode": "lldb", - "externalConsole": true, - "setupCommands": [ - { - "text": "pro hand -p true -s false -n false SIGCONT", - } - ] - } - }, - { - "name": "Debug SITL (gazebo iris)", - "type": "cppdbg", - "request": "launch", - "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, - "preLaunchTask": "gazebo iris", - "postDebugTask": "gazebo kill", - "linux": { - "MIMode": "gdb", - "externalConsole": false, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "PX4 ignore wq signals", - "text": "handle SIGCONT nostop noprint nopass", - "ignoreFailures": true - } - ] - }, - "osx": { - "MIMode": "lldb", - "externalConsole": true, - "setupCommands": [ - { - "text": "pro hand -p true -s false -n false SIGCONT", - } - ] - } - }, - { - "name": "Debug SITL (jmavsim iris)", - "type": "cppdbg", - "request": "launch", - "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" - } - ], - "preLaunchTask": "jmavsim", - "postDebugTask": "jmavsim kill", - "linux": { - "MIMode": "gdb", - "externalConsole": false, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "PX4 ignore wq signals", - "text": "handle SIGCONT nostop noprint nopass", - "ignoreFailures": true - } - ] - }, - "osx": { - "MIMode": "lldb", - "externalConsole": true, - "setupCommands": [ - { - "text": "pro hand -p true -s false -n false SIGCONT", - } - ] - } - }, - { - "name": "Debug px4_fmu-v2/v3/v4 (jlink)", - "device": "STM32F427VI", - "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F427.svd", - "executable": "${command:cmake.launchTargetPath}", - "request": "launch", - "type": "cortex-debug", - "servertype": "jlink", - "interface": "swd", - "cwd": "${workspaceRoot}", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchCommands": [ - "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", - "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", - "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", - "set mem inaccessible-by-default off", - "set print pretty", - ] - }, - { - "name": "Debug px4_fmu-v2/v3/v4 (blackmagic)", - "device": "STM32F427VI", - "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F427.svd", - "executable": "${command:cmake.launchTargetPath}", - "request": "launch", - "type": "cortex-debug", - "servertype": "bmp", - "BMPGDBSerialPort": "/dev/ttyACM0", - "interface": "swd", - "cwd": "${workspaceRoot}", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchCommands": [ - "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", - "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", - "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", - "set mem inaccessible-by-default off", - "set print pretty", - ] - }, - { - "name": "Debug px4_fmu-v4pro (jlink)", - "device": "STM32F469VI", - "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F469.svd", - "executable": "${command:cmake.launchTargetPath}", - "request": "launch", - "type": "cortex-debug", - "servertype": "jlink", - "interface": "swd", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchCommands": [ - "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", - "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", - "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", - "set mem inaccessible-by-default off", - "set print pretty", - ] - }, - { - "name": "Debug px4_fmu-v5/v5x (jlink)", - "device": "STM32F765VI", - "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F7x5.svd", - "executable": "${command:cmake.launchTargetPath}", - "request": "launch", - "type": "cortex-debug", - "servertype": "jlink", - "interface": "swd", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchCommands": [ - "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", - "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", - "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", - "set mem inaccessible-by-default off", - "set print pretty", - ] - }, - { - "name": "Debug av_x-v1/mro_ctrl-zero-f7 (jlink)", - "device": "STM32F777NI", - "svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/STM32F7x7.svd", - "executable": "${command:cmake.launchTargetPath}", - "request": "launch", - "type": "cortex-debug", - "servertype": "jlink", - "interface": "swd", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchCommands": [ - "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", - "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", - "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", - "set mem inaccessible-by-default off", - "set print pretty", - ] - }, - { - "name": "Debug nxp_fmuk66-v3 (jlink)", - "device": "MK66FN2M0xxx18", - //"svdFile": "${workspaceRoot}/../cmsis-svd/data/STMicro/XXXX.svd", - "executable": "${command:cmake.launchTargetPath}", - "request": "launch", - "type": "cortex-debug", - "servertype": "jlink", - "interface": "swd", - "cwd": "${workspaceRoot}", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchCommands": [ - "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", - "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", - "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", - "set mem inaccessible-by-default off", - "set print pretty" - ] - } - ] -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 818ef508c7..cab5a988f2 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -68,7 +68,79 @@ "PX4_SIM_SPEED_FACTOR": "1" } }, - "command": "gzserver --verbose ${workspaceRoot}/Tools/sitl_gazebo/worlds/iris.world & gzclient", + "command": "gzserver ${workspaceRoot}/Tools/sitl_gazebo/worlds/iris.world & gzclient", + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated" + }, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": ".", + } + } + ] + }, + { + "label": "gazebo plane", + "type": "shell", + "dependsOn": "gazebo build", + "options": { + "cwd": "${workspaceRoot}", + "env": { + "GAZEBO_PLUGIN_PATH": "${workspaceRoot}/build/px4_sitl_default/build_gazebo", + "GAZEBO_MODEL_PATH": "${workspaceRoot}/Tools/sitl_gazebo/models", + "PX4_SIM_SPEED_FACTOR": "1" + } + }, + "command": "gzserver ${workspaceRoot}/Tools/sitl_gazebo/worlds/plane.world & gzclient", + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated" + }, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": ".", + } + } + ] + }, + { + "label": "gazebo standard_vtol", + "type": "shell", + "dependsOn": "gazebo build", + "options": { + "cwd": "${workspaceRoot}", + "env": { + "GAZEBO_PLUGIN_PATH": "${workspaceRoot}/build/px4_sitl_default/build_gazebo", + "GAZEBO_MODEL_PATH": "${workspaceRoot}/Tools/sitl_gazebo/models", + "PX4_SIM_SPEED_FACTOR": "1" + } + }, + "command": "gzserver ${workspaceRoot}/Tools/sitl_gazebo/worlds/standard_vtol.world & gzclient", "isBackground": true, "presentation": { "reveal": "always", diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index c552ec5f68..5af9eee16f 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -166,6 +166,59 @@ add_custom_target(weak_symbols # debugger helpers configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/gdbinit.in ${PX4_BINARY_DIR}/.gdbinit) +# vscode launch.json +# FIXME: hack to skip if px4_io-v2 because it's a build within a build +if(NOT PX4_BUILD MATCHES "px4_io-v2") + if(CONFIG_ARCH_CHIP_MK66FN2M0VMD18) + set(DEBUG_DEVICE "MK66FN2M0xxx18") + set(DEBUG_SVD_FILE "MK66F18.svd") + elseif(CONFIG_ARCH_CHIP_STM32F100C8) + set(DEBUG_DEVICE "STM32F100C8") + set(DEBUG_SVD_FILE "STM32F100xx.svd") + elseif(CONFIG_ARCH_CHIP_STM32F103RB) + set(DEBUG_DEVICE "STM32F103C4") + set(DEBUG_SVD_FILE "STM32F103xx.svd") + elseif(CONFIG_ARCH_CHIP_STM32F302K8) + set(DEBUG_DEVICE "STM32F302K8") + set(DEBUG_SVD_FILE "STM32F302.svd") + elseif(CONFIG_ARCH_CHIP_STM32F303CC) + set(DEBUG_DEVICE "STM32F303CC") + set(DEBUG_SVD_FILE "STM32F303.svd") + elseif(CONFIG_ARCH_CHIP_STM32F405RG) + set(DEBUG_DEVICE "STM32F405RG") + set(DEBUG_SVD_FILE "STM32F405.svd") + elseif(CONFIG_ARCH_CHIP_STM32F427V) + set(DEBUG_DEVICE "STM32F427VI") + set(DEBUG_SVD_FILE "STM32F427.svd") + elseif(CONFIG_ARCH_CHIP_STM32F429V) + set(DEBUG_DEVICE "STM32F429VI") + set(DEBUG_SVD_FILE "STM32F429.svd") + elseif(CONFIG_ARCH_CHIP_STM32F446R) + set(DEBUG_DEVICE "STM32F446RC") + set(DEBUG_SVD_FILE "STM32F446.svd") + elseif(CONFIG_ARCH_CHIP_STM32F469I) + set(DEBUG_DEVICE "STM32F469IE") + set(DEBUG_SVD_FILE "STM32F469.svd") + elseif(CONFIG_ARCH_CHIP_STM32F745VG) + set(DEBUG_DEVICE "STM32F745VG") + set(DEBUG_SVD_FILE "STM32F7x5.svd") + elseif(CONFIG_ARCH_CHIP_STM32F765II) + set(DEBUG_DEVICE "STM32F765II") + set(DEBUG_SVD_FILE "STM32F7x5.svd") + elseif(CONFIG_ARCH_CHIP_STM32F777NI) + set(DEBUG_DEVICE "STM32F777NI") + set(DEBUG_SVD_FILE "STM32F7x7.svd") + endif() + + file(GLOB_RECURSE DEBUG_SVD_FILE_PATH ${CMAKE_SOURCE_DIR}/../cmsis-svd/*/${DEBUG_SVD_FILE}) + if(DEBUG_SVD_FILE-NOTFOUND) + set(DEBUG_SVD_FILE "") + else() + message(STATUS "Found SVD: ${DEBUG_SVD_FILE_PATH}") + endif() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json @ONLY) +endif() + add_custom_target(debug COMMAND ${GDB} -iex 'set auto-load safe-path ${PX4_BINARY_DIR}' $ DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit diff --git a/platforms/nuttx/Debug/launch.json.in b/platforms/nuttx/Debug/launch.json.in new file mode 100644 index 0000000000..d0239ba5b4 --- /dev/null +++ b/platforms/nuttx/Debug/launch.json.in @@ -0,0 +1,44 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "jlink (@PX4_BOARD@)", + "device": "@DEBUG_DEVICE@", + "svdFile": "@DEBUG_SVD_FILE_PATH@", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "interface": "swd", + "cwd": "${workspaceRoot}", + "internalConsoleOptions": "openOnSessionStart", + "preLaunchCommands": [ + "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", + "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", + "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", + "set mem inaccessible-by-default off", + "set print pretty", + ] + }, + { + "name": "blackmagic (@PX4_BOARD@)", + "device": "@DEBUG_DEVICE@", + "svdFile": "@DEBUG_SVD_FILE_PATH@", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "bmp", + "BMPGDBSerialPort": "/dev/ttyACM0", + "interface": "swd", + "cwd": "${workspaceRoot}", + "internalConsoleOptions": "openOnSessionStart", + "preLaunchCommands": [ + "source ${workspaceRoot}/platforms/nuttx/Debug/PX4", + "source ${workspaceRoot}/platforms/nuttx/Debug/NuttX", + "source ${workspaceRoot}/platforms/nuttx/Debug/ARMv7M", + "set mem inaccessible-by-default off", + "set print pretty", + ] + } + ] +} diff --git a/platforms/posix/Debug/launch.json.in b/platforms/posix/Debug/launch.json.in new file mode 100644 index 0000000000..70a2b7ccc4 --- /dev/null +++ b/platforms/posix/Debug/launch.json.in @@ -0,0 +1,246 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "SITL (gazebo iris)", + "type": "cppdbg", + "request": "launch", + "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, + "preLaunchTask": "gazebo iris", + "postDebugTask": "gazebo kill", + "linux": { + "MIMode": "gdb", + "externalConsole": false, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "externalConsole": true, + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "SITL (gazebo plane)", + "type": "cppdbg", + "request": "launch", + "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": "plane" + } + ], + "externalConsole": false, + "preLaunchTask": "gazebo plane", + "postDebugTask": "gazebo kill", + "linux": { + "MIMode": "gdb", + "externalConsole": false, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "externalConsole": true, + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "SITL (gazebo standard_vtol)", + "type": "cppdbg", + "request": "launch", + "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": "standard_vtol" + } + ], + "externalConsole": false, + "preLaunchTask": "gazebo standard_vtol", + "postDebugTask": "gazebo kill", + "linux": { + "MIMode": "gdb", + "externalConsole": false, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "externalConsole": true, + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "SITL (jmavsim iris)", + "type": "cppdbg", + "request": "launch", + "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" + } + ], + "preLaunchTask": "jmavsim", + "postDebugTask": "jmavsim kill", + "linux": { + "MIMode": "gdb", + "externalConsole": false, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "externalConsole": true, + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + { + "name": "SITL (shell)", + "type": "cppdbg", + "request": "launch", + "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": "shell" + } + ], + "linux": { + "MIMode": "gdb", + "externalConsole": false, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "externalConsole": true, + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + ] +} diff --git a/platforms/posix/cmake/sitl_target.cmake b/platforms/posix/cmake/sitl_target.cmake index 74a2608d0d..a9e71a8364 100644 --- a/platforms/posix/cmake/sitl_target.cmake +++ b/platforms/posix/cmake/sitl_target.cmake @@ -104,3 +104,6 @@ add_custom_target(list_vmd_make_targets COMMENT "List of acceptable '${PX4_BOARD}' targets:" VERBATIM ) + +# vscode launch.json +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY)