Explorar el Código

🔨 Help for GDB remote debugging

Scott Lahteine hace 2 años
padre
commit
efe2e79ac8

+ 1
- 5
.gitignore Ver fichero

27
 # OS
27
 # OS
28
 #
28
 #
29
 applet/
29
 applet/
30
-*.DS_Store
30
+.DS_Store
31
 
31
 
32
 #
32
 #
33
 # Misc
33
 # Misc
167
 
167
 
168
 # IOLogger logs
168
 # IOLogger logs
169
 *_log.csv
169
 *_log.csv
170
-
171
-# Simulation / Native
172
-eeprom.dat
173
-imgui.ini

+ 2
- 2
Marlin/src/pins/pins.h Ver fichero

620
 #elif MB(BTT_E3_RRF)
620
 #elif MB(BTT_E3_RRF)
621
   #include "stm32f4/pins_BTT_E3_RRF.h"          // STM32F4                                env:BIGTREE_E3_RRF
621
   #include "stm32f4/pins_BTT_E3_RRF.h"          // STM32F4                                env:BIGTREE_E3_RRF
622
 #elif MB(BTT_SKR_V2_0_REV_A)
622
 #elif MB(BTT_SKR_V2_0_REV_A)
623
-  #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h"  // STM32F4                                env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB
623
+  #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
624
 #elif MB(BTT_SKR_V2_0_REV_B)
624
 #elif MB(BTT_SKR_V2_0_REV_B)
625
-  #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h"  // STM32F4                                env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB
625
+  #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
626
 #elif MB(BTT_OCTOPUS_V1_0)
626
 #elif MB(BTT_OCTOPUS_V1_0)
627
   #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h"    // STM32F4                                env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB
627
   #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h"    // STM32F4                                env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB
628
 #elif MB(BTT_OCTOPUS_V1_1)
628
 #elif MB(BTT_OCTOPUS_V1_1)

+ 48
- 0
buildroot/share/PlatformIO/debugging/launch.json Ver fichero

1
+/**
2
+ * Remote debugging on STM32 using the "Cortex Debug" extension.
3
+ *
4
+ * Copy one or more of the configurations items below into .vscode/launch.json
5
+ * to add those debug options to the PlatformIO IDE "Run & Debug" panel.
6
+ *
7
+ * Examples for BigTreeTech SKR 2 (USB) and Native Simulator. Modify for your own build.
8
+ *
9
+ * NOTE: The PlatformIO extension will remove items when regenerating launch.json.
10
+ */
11
+{
12
+    "version": "0.2.0",
13
+    "configurations": [
14
+        {
15
+            "name": "Debug STM32 (launch)",
16
+            "request": "launch",
17
+            "type": "cortex-debug",
18
+            "servertype": "openocd",
19
+            "cwd": "${workspaceRoot}",
20
+            "showDevDebugOutput": false,
21
+            "configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ],
22
+            "device": "STM32F407",
23
+            "executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf",
24
+        },
25
+        {
26
+            "name": "Debug STM32 (attach)",
27
+            "request": "attach",
28
+            "type": "cortex-debug",
29
+            "servertype": "openocd",
30
+            "cwd": "${workspaceRoot}",
31
+            "showDevDebugOutput": false,
32
+            "configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ],
33
+            "device": "STM32F407",
34
+            "executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf",
35
+        },
36
+        {
37
+            "name": "Debug Sim",
38
+            "request": "launch",
39
+            "type": "cppdbg",
40
+            "cwd": "${workspaceRoot}",
41
+            //"program": ".pio/build/simulator_linux_debug/MarlinSimulator",
42
+            //"program": ".pio/build/simulator_windows/MarlinSimulator",
43
+            "program": ".pio/build/simulator_macos_debug/MarlinSimulator",
44
+            "miDebuggerPath": "/opt/local/bin/ggdb",
45
+            "MIMode": "gdb"
46
+        }
47
+    ]
48
+}

+ 1
- 17
ini/native.ini Ver fichero

29
 #
29
 #
30
 # 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]
30
 # 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]
31
 #
31
 #
32
-# Debugging with gdb in vscode is as easy as adding the launch task as usual, but platformio
33
-# will randomly remove your task when it recreates its tasks from a template. Add your gdb
34
-# launch task to '~/.platformio/penv/lib/python{PYTHON_VERSION}/site-packages/platformio/ide/tpls/vscode/.vscode'
35
-# to avoid this until platformio updates.
32
+# For VSCode debugging see buildroot/share/PlatformIO/debugging/launch.json
36
 #
33
 #
37
 [simulator_common]
34
 [simulator_common]
38
 platform          = native
35
 platform          = native
43
 debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
40
 debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
44
 lib_compat_mode   = off
41
 lib_compat_mode   = off
45
 src_filter        = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
42
 src_filter        = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
46
-
47
 lib_deps          = ${common.lib_deps}
43
 lib_deps          = ${common.lib_deps}
48
   MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.zip
44
   MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.zip
49
   Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
45
   Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
51
 extra_scripts = ${common.extra_scripts}
47
 extra_scripts = ${common.extra_scripts}
52
   pre:buildroot/share/PlatformIO/scripts/simulator.py
48
   pre:buildroot/share/PlatformIO/scripts/simulator.py
53
 
49
 
54
-
55
 [simulator_linux]
50
 [simulator_linux]
56
 extends     = simulator_common
51
 extends     = simulator_common
57
 build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL
52
 build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL
84
 # Use 'sudo port install mesa' to get a <GL/gl.h> if no Xcode is installed.
79
 # Use 'sudo port install mesa' to get a <GL/gl.h> if no Xcode is installed.
85
 # If Xcode is installed be sure to run `xcode-select --install` first.
80
 # If Xcode is installed be sure to run `xcode-select --install` first.
86
 #
81
 #
87
-# For VSCode debugging paste the block below near the top of launch.json.
88
-# NOTE: The PlatformIO VSCode extension will remove it when regenerating launch.json.
89
-#
90
-# { "name": "Debug Sim",
91
-#   "type": "cppdbg",
92
-#   "request": "launch",
93
-#   "program": "${workspaceFolder}/.pio/build/simulator_macos/MarlinSimulator",
94
-#   "miDebuggerPath": "/opt/local/bin/ggdb",
95
-#   "MIMode": "gdb",
96
-#   "cwd": "${workspaceFolder}/.pio/build/simulator_macos" },
97
-#
98
 [simulator_macos]
82
 [simulator_macos]
99
 build_unflags     = -lGL
83
 build_unflags     = -lGL
100
 custom_verbose    = 0
84
 custom_verbose    = 0

+ 1
- 1
ini/stm32f1-maple.ini Ver fichero

410
 board                = genericSTM32F103VE
410
 board                = genericSTM32F103VE
411
 build_flags          = ${common_stm32f1.build_flags}
411
 build_flags          = ${common_stm32f1.build_flags}
412
   -ffunction-sections -fdata-sections -nostdlib -MMD
412
   -ffunction-sections -fdata-sections -nostdlib -MMD
413
-  -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -O0
413
+  -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1
414
   -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
414
   -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
415
   -DSS_TIMER=4
415
   -DSS_TIMER=4
416
 board_build.variant  = MARLIN_F103Vx
416
 board_build.variant  = MARLIN_F103Vx

+ 7
- 0
ini/stm32f4.ini Ver fichero

220
                               -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
220
                               -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
221
                               -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED
221
                               -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED
222
                               -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8
222
                               -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8
223
+upload_protocol             = stlink
223
 
224
 
224
 #
225
 #
225
 # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support
226
 # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support
230
 build_flags       = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC
231
 build_flags       = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC
231
 build_unflags     = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC
232
 build_unflags     = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC
232
 
233
 
234
+[env:BIGTREE_SKR_2_USB_debug]
235
+platform          = ${common_stm32.platform}
236
+extends           = env:BIGTREE_SKR_2_USB
237
+build_flags       = ${env:BIGTREE_SKR_2_USB.build_flags} -O0
238
+build_unflags     = ${env:BIGTREE_SKR_2_USB.build_unflags} -Os -NDEBUG
239
+
233
 #
240
 #
234
 # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4)
241
 # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4)
235
 #
242
 #

Loading…
Cancelar
Guardar