utils.cfg
1 # Custom utilities for openOCD 2 3 # NOTE: This file must be included prior to any other file that 4 # might reference it 5 6 puts "Loading custom utils!" 7 8 # Detach debugger so processor can go about it's business 9 # Otherwise if we have any halt_if_debugging() dependent code 10 # it will keep hitting it until a power-on reset clears the 11 # "debugging" flag. This is set whenever a debugger is attached 12 # for debugging and/or flashing purposes 13 proc detach_swd {} { 14 # Clear C_DEBUGEN in DHCSR register 15 # Also need to write magic 0xA05F "DBGKEY" 16 # See link for more information: 17 # https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/Debug-register-support-in-the-SCS/Debug-Halting-Control-and-Status-Register--DHCSR 18 mmw 0xE000EDF0 0xA05F0000 0xFFFF0001 19 } 20 21 # Make sure system keeps running when we detatch gdb 22 $_TARGETNAME configure -event gdb-detach { 23 resume 24 detach_swd 25 shutdown 26 }