Skip to content

Instantly share code, notes, and snippets.

@samuelsadok
Created April 8, 2019 08:57
Show Gist options
  • Save samuelsadok/a780c9099e65aa2d8ce889ce2b805dc4 to your computer and use it in GitHub Desktop.
Save samuelsadok/a780c9099e65aa2d8ce889ce2b805dc4 to your computer and use it in GitHub Desktop.
source Support/gdbtrace.init
target remote | openocd -f "interface/stlink-v2.cfg" -f "target/stm32f4x_stlink.cfg" -c "gdb_port pipe; log_output openocd.log"
#cortex_m vector_catch all
#monitor swdp_scan
monitor reset halt
monitor cortex_m vector_catch all
#file /Data/Projects/ODrive/Firmware/build/ODriveFirmware.elf
#attach 1 # <---- Connect to the target
set mem inaccessible-by-default off
set print pretty
#load
#start
enableSTM32SWD # <*--- turn on SWO output pin on CPU
## ---------- IF USING AN STLINK --------------------------
monitor tpiu config internal swo.log uart off 168000000
## ---------- IF USING A BLUEPILL -------------------------
#monitor traceswo 2250000
#prepareSWD SystemCoreClock 2250000 1 0 # <*--- Setup SWO timing (Bluepill case)
## ---------- IF USING A BLACK MAGIC PROBE -----------------------
#monitor traceswo # <*--- Enable BMP traceswo output
#prepareSWD ConfigCoreClock 200000 0 1 # <*--- Setup SWO timing (BMP case)
## ----------END OF ALTERNATIVE-----------------------------------
dwtSamplePC 1
dwtSyncTap 3
dwtPostTap 1
dwtPostInit 1
dwtPostReset 15
dwtCycEna 1
ITMId 1
ITMGTSFreq 3
ITMTSPrescale 3
ITMTXEna 1
ITMSYNCEna 1
ITMEna 1
ITMTER 0 0xFFFFFFFF
ITMTPR 0xFFFFFFFF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment