diff --git a/.gitignore b/.gitignore index bc603ba38b..a83bfa4265 100755 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ bdf2u8g # OS # applet/ -*.DS_Store +.DS_Store # # Misc @@ -167,7 +167,3 @@ __pycache__ # IOLogger logs *_log.csv - -# Simulation / Native -eeprom.dat -imgui.ini diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 49d06590e9..40bbe6b41b 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -620,9 +620,9 @@ #elif MB(BTT_E3_RRF) #include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF #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) - #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) #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB #elif MB(BTT_OCTOPUS_V1_1) diff --git a/buildroot/share/PlatformIO/debugging/launch.json b/buildroot/share/PlatformIO/debugging/launch.json new file mode 100644 index 0000000000..335c4c663e --- /dev/null +++ b/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" + } + ] +} diff --git a/ini/native.ini b/ini/native.ini index 981e93f996..fe5fe3a5d0 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -29,10 +29,7 @@ src_filter = ${common.default_src_filter} + # # 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 -# 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. +# For VSCode debugging see buildroot/share/PlatformIO/debugging/launch.json # [simulator_common] platform = native @@ -43,7 +40,6 @@ release_flags = -g0 -O3 -flto debug_build_flags = -fstack-protector-strong -g -g3 -ggdb lib_compat_mode = off src_filter = ${common.default_src_filter} + - lib_deps = ${common.lib_deps} MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.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} pre:buildroot/share/PlatformIO/scripts/simulator.py - [simulator_linux] extends = simulator_common 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 if no Xcode is installed. # 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] build_unflags = -lGL custom_verbose = 0 diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index f86bf98ebd..e0b4ad711a 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -410,7 +410,7 @@ extends = common_stm32f1 board = genericSTM32F103VE build_flags = ${common_stm32f1.build_flags} -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 -DSS_TIMER=4 board_build.variant = MARLIN_F103Vx diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 3d7f4d2d02..850807585f 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -220,6 +220,7 @@ build_flags = ${stm_flash_drive.build_flags} -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED -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 @@ -230,6 +231,12 @@ extends = env:BIGTREE_SKR_2 build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC 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) #