Browse Source

🔨 Help for GDB remote debugging

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
committed by Scott Lahteine
parent
commit
5cbb820e29
  1. 6
      .gitignore
  2. 4
      Marlin/src/pins/pins.h
  3. 48
      buildroot/share/PlatformIO/debugging/launch.json
  4. 18
      ini/native.ini
  5. 2
      ini/stm32f1-maple.ini
  6. 7
      ini/stm32f4.ini

6
.gitignore

@ -27,7 +27,7 @@ bdf2u8g
# OS # OS
# #
applet/ applet/
*.DS_Store .DS_Store
# #
# Misc # Misc
@ -167,7 +167,3 @@ __pycache__
# IOLogger logs # IOLogger logs
*_log.csv *_log.csv
# Simulation / Native
eeprom.dat
imgui.ini

4
Marlin/src/pins/pins.h

@ -620,9 +620,9 @@
#elif MB(BTT_E3_RRF) #elif MB(BTT_E3_RRF)
#include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF #include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF
#elif MB(BTT_SKR_V2_0_REV_A) #elif MB(BTT_SKR_V2_0_REV_A)
#include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug
#elif MB(BTT_SKR_V2_0_REV_B) #elif MB(BTT_SKR_V2_0_REV_B)
#include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug
#elif MB(BTT_OCTOPUS_V1_0) #elif MB(BTT_OCTOPUS_V1_0)
#include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB
#elif MB(BTT_OCTOPUS_V1_1) #elif MB(BTT_OCTOPUS_V1_1)

48
buildroot/share/PlatformIO/debugging/launch.json

@ -0,0 +1,48 @@
/**
* Remote debugging on STM32 using the "Cortex Debug" extension.
*
* Copy one or more of the configurations items below into .vscode/launch.json
* to add those debug options to the PlatformIO IDE "Run & Debug" panel.
*
* Examples for BigTreeTech SKR 2 (USB) and Native Simulator. Modify for your own build.
*
* NOTE: The PlatformIO extension will remove items when regenerating launch.json.
*/
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug STM32 (launch)",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"showDevDebugOutput": false,
"configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ],
"device": "STM32F407",
"executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf",
},
{
"name": "Debug STM32 (attach)",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"showDevDebugOutput": false,
"configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ],
"device": "STM32F407",
"executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf",
},
{
"name": "Debug Sim",
"request": "launch",
"type": "cppdbg",
"cwd": "${workspaceRoot}",
//"program": ".pio/build/simulator_linux_debug/MarlinSimulator",
//"program": ".pio/build/simulator_windows/MarlinSimulator",
"program": ".pio/build/simulator_macos_debug/MarlinSimulator",
"miDebuggerPath": "/opt/local/bin/ggdb",
"MIMode": "gdb"
}
]
}

18
ini/native.ini

@ -29,10 +29,7 @@ src_filter = ${common.default_src_filter} +<src/HAL/LINUX>
# #
# Tested with Linux (Mint 20) : gcc [9.3.0, 10.2.0]: libsdl2-dev[2.0.10], libsdl2-net-dev[2.0.1], libglm-dev[0.9.9.7, 0.9.9.8] # Tested with Linux (Mint 20) : gcc [9.3.0, 10.2.0]: libsdl2-dev[2.0.10], libsdl2-net-dev[2.0.1], libglm-dev[0.9.9.7, 0.9.9.8]
# #
# Debugging with gdb in vscode is as easy as adding the launch task as usual, but platformio # For VSCode debugging see buildroot/share/PlatformIO/debugging/launch.json
# will randomly remove your task when it recreates its tasks from a template. Add your gdb
# launch task to '~/.platformio/penv/lib/python{PYTHON_VERSION}/site-packages/platformio/ide/tpls/vscode/.vscode'
# to avoid this until platformio updates.
# #
[simulator_common] [simulator_common]
platform = native platform = native
@ -43,7 +40,6 @@ release_flags = -g0 -O3 -flto
debug_build_flags = -fstack-protector-strong -g -g3 -ggdb debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
lib_compat_mode = off lib_compat_mode = off
src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM> src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.zip MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.zip
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
@ -51,7 +47,6 @@ lib_deps = ${common.lib_deps}
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/simulator.py pre:buildroot/share/PlatformIO/scripts/simulator.py
[simulator_linux] [simulator_linux]
extends = simulator_common extends = simulator_common
build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL
@ -84,17 +79,6 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
# Use 'sudo port install mesa' to get a <GL/gl.h> if no Xcode is installed. # Use 'sudo port install mesa' to get a <GL/gl.h> if no Xcode is installed.
# If Xcode is installed be sure to run `xcode-select --install` first. # If Xcode is installed be sure to run `xcode-select --install` first.
# #
# For VSCode debugging paste the block below near the top of launch.json.
# NOTE: The PlatformIO VSCode extension will remove it when regenerating launch.json.
#
# { "name": "Debug Sim",
# "type": "cppdbg",
# "request": "launch",
# "program": "${workspaceFolder}/.pio/build/simulator_macos/MarlinSimulator",
# "miDebuggerPath": "/opt/local/bin/ggdb",
# "MIMode": "gdb",
# "cwd": "${workspaceFolder}/.pio/build/simulator_macos" },
#
[simulator_macos] [simulator_macos]
build_unflags = -lGL build_unflags = -lGL
custom_verbose = 0 custom_verbose = 0

2
ini/stm32f1-maple.ini

@ -410,7 +410,7 @@ extends = common_stm32f1
board = genericSTM32F103VE board = genericSTM32F103VE
build_flags = ${common_stm32f1.build_flags} build_flags = ${common_stm32f1.build_flags}
-ffunction-sections -fdata-sections -nostdlib -MMD -ffunction-sections -fdata-sections -nostdlib -MMD
-DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -O0 -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1
-DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
-DSS_TIMER=4 -DSS_TIMER=4
board_build.variant = MARLIN_F103Vx board_build.variant = MARLIN_F103Vx

7
ini/stm32f4.ini

@ -220,6 +220,7 @@ build_flags = ${stm_flash_drive.build_flags}
-DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
-DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED
-DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8
upload_protocol = stlink
# #
# BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support
@ -230,6 +231,12 @@ extends = env:BIGTREE_SKR_2
build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC
build_unflags = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC build_unflags = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC
[env:BIGTREE_SKR_2_USB_debug]
platform = ${common_stm32.platform}
extends = env:BIGTREE_SKR_2_USB
build_flags = ${env:BIGTREE_SKR_2_USB.build_flags} -O0
build_unflags = ${env:BIGTREE_SKR_2_USB.build_unflags} -Os -NDEBUG
# #
# BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4)
# #

Loading…
Cancel
Save