NuttX cmake small debug helper improvements

This commit is contained in:
Daniel Agar
2019-11-18 10:29:00 -05:00
parent 30fcb14156
commit a7fbaefd83
10 changed files with 87 additions and 44 deletions
+2
View File
@@ -14,6 +14,8 @@ set print pretty
set pagination off
set history save on
set history filename ~/.gdb_history
set history size unlimited
set history expansion on
set logging on
+14
View File
@@ -0,0 +1,14 @@
#! /bin/sh
set -o xtrace
@JLinkGDBServerExe_PATH@ -device @DEBUG_DEVICE@ -select usb -endian little -if SWD -speed auto -ir -LocalhostOnly 1 -strict -vd -singlerun &
cd @PX4_BINARY_DIR@ && @CMAKE_GDB@ -silent -nh \
-iex "set auto-load safe-path @PX4_BINARY_DIR@" \
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "monitor reset 0" \
-ex "continue" \
@PX4_CONFIG@.elf
+5
View File
@@ -0,0 +1,5 @@
#! /bin/sh
set -o xtrace
@Ozone_PATH@ -device @DEBUG_DEVICE@ -if SWD -speed auto -select usb -programfile @PX4_BINARY_DIR@/@PX4_CONFIG@.elf
-7
View File
@@ -1,7 +0,0 @@
#! /bin/sh
killall JLinkGDBServerCLExe
# TODO: set device from nuttx config
# eg CONFIG_ARCH_CHIP_STM32F427V or CONFIG_STM32_STM32F427
JLinkGDBServerCLExe -device STM32F427II -select usb -silent -endian little -if SWD -speed auto -ir -LocalhostOnly 1 -strict -vd -singlerun &
+7
View File
@@ -0,0 +1,7 @@
#! /bin/sh
set -o xtrace
killall JLinkGDBServerCLExe
JLinkGDBServerCLExe -silent -device @DEBUG_DEVICE@ -select usb -if SWD -speed auto -LocalhostOnly 1 -strict -vd -singlerun &
+1
View File
@@ -10,6 +10,7 @@
"type": "cortex-debug",
"servertype": "jlink",
"interface": "swd",
//"ipAddress": "server:19020",
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"preLaunchCommands": [
@@ -1,12 +1,14 @@
#! /bin/sh
gdb-multiarch -nx -batch \
set -o xtrace
gdb-multiarch -silent -nx -batch \
-ex "target remote localhost:2331" \
-ex "monitor reset 0" \
-ex "load" \
-ex "compare-sections" \
-ex "monitor reset 0" \
-ex "monitor sleep 1000" \
-ex "monitor go" \
-ex "kill" \
-ex "monitor sleep 3000" \
-ex "disconnect" \
-ex "quit" \
${1}
+41 -22
View File
@@ -31,28 +31,47 @@
#
############################################################################
add_custom_target(jlink_upload
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_start.sh
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_upload.sh $<TARGET_FILE:px4>
DEPENDS px4
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
# jlink_upload (flash binary)
find_program(JLinkGDBServerCLExe_PATH JLinkGDBServerCLExe)
if(JLinkGDBServerCLExe_PATH)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_start.sh.in ${PX4_BINARY_DIR}/jlink_gdb_start.sh @ONLY)
add_custom_target(jlink_upload
COMMAND ${PX4_BINARY_DIR}/jlink_gdb_start.sh
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/upload_jlink_gdb.sh $<TARGET_FILE:px4>
DEPENDS
px4
${PX4_BINARY_DIR}/jlink_gdb_start.sh
${CMAKE_CURRENT_SOURCE_DIR}/Debug/upload_jlink_gdb.sh
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
)
endif()
add_custom_target(jlink_debug
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_gdb_start.sh
COMMAND ${CMAKE_GDB} -nh
-iex 'set auto-load safe-path ${PX4_BINARY_DIR}'
-ex 'target remote localhost:2331'
-ex 'monitor reset 0'
-ex 'load'
-ex 'compare-sections'
-ex 'monitor reset 0'
-ex 'monitor sleep 1000'
-ex 'monitor go'
-ex 'continue'
$<TARGET_FILE:px4>
DEPENDS px4 ${PX4_BINARY_DIR}/.gdbinit
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
# jlink_debug_gdb (flash binary and run with gdb attached)
find_program(JLinkGDBServerExe_PATH JLinkGDBServerExe)
if(JLinkGDBServerExe_PATH AND CMAKE_GDB)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_debug_gdb.sh.in ${PX4_BINARY_DIR}/jlink_debug_gdb.sh @ONLY)
add_custom_target(jlink_debug_gdb
COMMAND ${PX4_BINARY_DIR}/jlink_debug_gdb.sh
DEPENDS
px4
${PX4_BINARY_DIR}/.gdbinit
${PX4_BINARY_DIR}/jlink_debug_gdb.sh
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
)
endif()
# jlink_debug_ozone (run Segger Ozone debugger with current target configuration)
find_program(Ozone_PATH Ozone)
if(Ozone_PATH)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/jlink_debug_ozone.sh.in ${PX4_BINARY_DIR}/jlink_debug_ozone.sh @ONLY)
add_custom_target(jlink_debug_ozone
COMMAND ${PX4_BINARY_DIR}/jlink_debug_ozone.sh
DEPENDS
px4
${PX4_BINARY_DIR}/jlink_debug_ozone.sh
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
)
endif()