From 38fbb452dabfb9b15146e0c91f7717250b3fce01 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 9 Nov 2020 17:49:50 -0500 Subject: [PATCH] vscode add navio2 variant and native debug launch --- .vscode/cmake-variants.yaml | 5 ++++ platforms/posix/CMakeLists.txt | 10 +++++++ platforms/posix/Debug/launch_rpi.json.in | 33 ++++++++++++++++++++++++ platforms/posix/cmake/sitl_target.cmake | 7 ----- 4 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 platforms/posix/Debug/launch_rpi.json.in diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml index 02164705d8..40e066a3bf 100644 --- a/.vscode/cmake-variants.yaml +++ b/.vscode/cmake-variants.yaml @@ -86,6 +86,11 @@ CONFIG: buildType: MinSizeRel settings: CONFIG: cubepilot_cubeyellow_default + emlid_navio2_default: + short: emlid_navio2 + buildType: MinSizeRel + settings: + CONFIG: emlid_navio2_default holybro_durandal-v1_default: short: holybro_durandal-v1 buildType: MinSizeRel diff --git a/platforms/posix/CMakeLists.txt b/platforms/posix/CMakeLists.txt index 5d5eaf1116..2da44e57df 100644 --- a/platforms/posix/CMakeLists.txt +++ b/platforms/posix/CMakeLists.txt @@ -115,8 +115,18 @@ if("${PX4_BOARD}" MATCHES "beaglebone_blue") elseif("${PX4_BOARD}" MATCHES "emlid_navio2") target_link_libraries(px4 PRIVATE atomic) + # vscode launch.json + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_rpi.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) + elseif("${PX4_BOARD}" MATCHES "sitl") + # vscode launch.json + if(${PX4_BOARD_LABEL} MATCHES "replay") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_replay.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) + else() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_sim.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) + endif() + include(sitl_target) if(BUILD_TESTING) include(sitl_tests) diff --git a/platforms/posix/Debug/launch_rpi.json.in b/platforms/posix/Debug/launch_rpi.json.in new file mode 100644 index 0000000000..763b5cb835 --- /dev/null +++ b/platforms/posix/Debug/launch_rpi.json.in @@ -0,0 +1,33 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "PX4 posix-configs/rpi/px4.config", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "args": [ + "-s", "../../posix-configs/rpi/px4.config" + ], + "stopAtEntry": false, + "cwd": "${command:cmake.buildDirectory}", + "externalConsole": false, + "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 + } + ] + } + }, + ] +} diff --git a/platforms/posix/cmake/sitl_target.cmake b/platforms/posix/cmake/sitl_target.cmake index 483da33b88..0c1a7bf89d 100644 --- a/platforms/posix/cmake/sitl_target.cmake +++ b/platforms/posix/cmake/sitl_target.cmake @@ -288,10 +288,3 @@ add_custom_target(list_vmd_make_targets COMMENT "List of acceptable '${PX4_BOARD}' targets:" VERBATIM ) - -# vscode launch.json -if(${PX4_BOARD_LABEL} MATCHES "replay") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_replay.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) -else() - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_sim.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) -endif()