diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index 12ac585d36..e3b5138d43 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -186,29 +186,12 @@ configure_file(gdbinit.in .gdbinit) add_custom_target(debug COMMAND ${GDB} $ DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit + USES_TERMINAL + ) + +add_custom_target(profile + COMMAND ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/poor-mans-profiler.sh --elf=$ --nsamples=10000 + DEPENDS ${FW_NAME} ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/poor-mans-profiler.sh + USES_TERMINAL ) -add_custom_target(debug_tui - COMMAND ${GDBTUI} $ - DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit - ) - -add_custom_target(debug_ddd - COMMAND ${DDD} --debugger ${GDB} $ - DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit - ) - -add_custom_target(debug_io - COMMAND ${GDB} ${fw_io_path} - DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit - ) - -add_custom_target(debug_io_tui - COMMAND ${GDBTUI} ${fw_io_path} - DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit - ) - -add_custom_target(debug_io_ddd - COMMAND ${DDD} --debugger ${GDB} ${fw_io_path}} - DEPENDS ${fw_io} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit - ) diff --git a/platforms/nuttx/Debug/dot.gdbinit b/platforms/nuttx/Debug/dot.gdbinit deleted file mode 100644 index 315e0f0601..0000000000 --- a/platforms/nuttx/Debug/dot.gdbinit +++ /dev/null @@ -1,13 +0,0 @@ -# copy the file to .gdbinit in your Firmware tree, and adjust the path -# below to match your system -# For example: -# target extended /dev/serial/by-id/usb-Black_Sphere_Technologies_Black_Magic_Probe_DDE5A1C4-if00 -# target extended /dev/ttyACM4 - - -monitor swdp_scan -attach 1 -monitor vector_catch disable hard -set mem inaccessible-by-default off -set print pretty -source platforms/nuttx/Debug/PX4 diff --git a/platforms/nuttx/Debug/poor-mans-profiler.sh b/platforms/nuttx/Debug/poor-mans-profiler.sh index 10af1c159a..4f4add5532 100755 --- a/platforms/nuttx/Debug/poor-mans-profiler.sh +++ b/platforms/nuttx/Debug/poor-mans-profiler.sh @@ -102,12 +102,19 @@ then do if [[ "$taskname" = "" ]] then - arm-none-eabi-gdb $elf --batch -ex "set print asm-demangle on" -ex bt \ + arm-none-eabi-gdb $elf --batch -ex "set print asm-demangle on" \ + -ex "target extended /dev/ttyACM0" \ + -ex "monitor swdp_scan" \ + -ex "attach 1" \ + -ex bt \ 2> $gdberrfile \ | sed -n 's/\(#.*\)/\1/p' \ >> $stacksfile else arm-none-eabi-gdb $elf --batch -ex "set print asm-demangle on" \ + -ex "target extended /dev/ttyACM0" \ + -ex "monitor swdp_scan" \ + -ex "attach 1" \ -ex "source $root/platforms/nuttx/Debug/Nuttx.py" \ -ex "show mybt $taskname" \ 2> $gdberrfile \ diff --git a/platforms/nuttx/gdbinit.in b/platforms/nuttx/gdbinit.in index 665c601375..5cd252d843 100644 --- a/platforms/nuttx/gdbinit.in +++ b/platforms/nuttx/gdbinit.in @@ -1,7 +1,10 @@ -target extended ${DEBUG_PORT} +source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/PX4 +source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/NuttX +source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/ARMv7M + +target extended-remote ${DEBUG_PORT} monitor swdp_scan attach 1 monitor vector_catch disable hard set mem inaccessible-by-default off set print pretty -source ${PX4_SOURCE_DIR}/platforms/nuttx/Debug/PX4