Преглед изворни кода

🔨 Help for GDB remote debugging

Scott Lahteine пре 2 година
родитељ
комит
efe2e79ac8
6 измењених фајлова са 60 додато и 25 уклоњено
  1. 1
    5
      .gitignore
  2. 2
    2
      Marlin/src/pins/pins.h
  3. 48
    0
      buildroot/share/PlatformIO/debugging/launch.json
  4. 1
    17
      ini/native.ini
  5. 1
    1
      ini/stm32f1-maple.ini
  6. 7
    0
      ini/stm32f4.ini

+ 1
- 5
.gitignore Прегледај датотеку

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

+ 2
- 2
Marlin/src/pins/pins.h Прегледај датотеку

@@ -620,9 +620,9 @@
620 620
 #elif MB(BTT_E3_RRF)
621 621
   #include "stm32f4/pins_BTT_E3_RRF.h"          // STM32F4                                env:BIGTREE_E3_RRF
622 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 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 626
 #elif MB(BTT_OCTOPUS_V1_0)
627 627
   #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h"    // STM32F4                                env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB
628 628
 #elif MB(BTT_OCTOPUS_V1_1)

+ 48
- 0
buildroot/share/PlatformIO/debugging/launch.json Прегледај датотеку

@@ -0,0 +1,48 @@
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 Прегледај датотеку

@@ -29,10 +29,7 @@ src_filter      = ${common.default_src_filter} +<src/HAL/LINUX>
29 29
 #
30 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 34
 [simulator_common]
38 35
 platform          = native
@@ -43,7 +40,6 @@ release_flags     = -g0 -O3 -flto
43 40
 debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
44 41
 lib_compat_mode   = off
45 42
 src_filter        = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
46
-
47 43
 lib_deps          = ${common.lib_deps}
48 44
   MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.zip
49 45
   Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip
@@ -51,7 +47,6 @@ lib_deps          = ${common.lib_deps}
51 47
 extra_scripts = ${common.extra_scripts}
52 48
   pre:buildroot/share/PlatformIO/scripts/simulator.py
53 49
 
54
-
55 50
 [simulator_linux]
56 51
 extends     = simulator_common
57 52
 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}
84 79
 # Use 'sudo port install mesa' to get a <GL/gl.h> if no Xcode is installed.
85 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 82
 [simulator_macos]
99 83
 build_unflags     = -lGL
100 84
 custom_verbose    = 0

+ 1
- 1
ini/stm32f1-maple.ini Прегледај датотеку

@@ -410,7 +410,7 @@ extends              = common_stm32f1
410 410
 board                = genericSTM32F103VE
411 411
 build_flags          = ${common_stm32f1.build_flags}
412 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 414
   -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
415 415
   -DSS_TIMER=4
416 416
 board_build.variant  = MARLIN_F103Vx

+ 7
- 0
ini/stm32f4.ini Прегледај датотеку

@@ -220,6 +220,7 @@ build_flags                 = ${stm_flash_drive.build_flags}
220 220
                               -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
221 221
                               -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED
222 222
                               -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8
223
+upload_protocol             = stlink
223 224
 
224 225
 #
225 226
 # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support
@@ -230,6 +231,12 @@ extends           = env:BIGTREE_SKR_2
230 231
 build_flags       = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC
231 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 241
 # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4)
235 242
 #

Loading…
Откажи
Сачувај