Skip to content

Instantly share code, notes, and snippets.

@retif
Created June 2, 2024 08:02
Show Gist options
  • Save retif/f2b9829fa21b7250b6e3309fe736eb55 to your computer and use it in GitHub Desktop.
Save retif/f2b9829fa21b7250b6e3309fe736eb55 to your computer and use it in GitHub Desktop.
source [find interface/cmsis-dap.cfg]
cmsis_dap_vid_pid 0x1209 0x3443
transport select swd
source [find target/stm32h7x_dual_bank.cfg]
if { [info exists _TARGETNAME] == 0 } {
set _TARGETNAME stm32h7x.cpu0
}
adapter speed 1000
$_TARGETNAME configure -event gdb-detach { shutdown }
$_TARGETNAME configure -event reset-init {
# Configure PLL to boost clock to HSI x 4 (64 MHz)
mww 0x40023804 0x08012008 ;# RCC_PLLCFGR 16 Mhz /8 (M) * 128 (N) /4(P)
mww 0x40023C00 0x00000102 ;# FLASH_ACR = PRFTBE | 2(Latency)
mmw 0x40023800 0x01000000 0 ;# RCC_CR |= PLLON
sleep 10 ;# Wait for PLL to lock
mmw 0x40023808 0x00001000 0 ;# RCC_CFGR |= RCC_CFGR_PPRE1_DIV2
mmw 0x40023808 0x00000002 0 ;# RCC_CFGR |= RCC_CFGR_SW_PLL
# Boost JTAG frequency
adapter speed 1000
}
# Correctly set up SWD newdap command
#swd newdap $_TARGETNAME cpu -dp-id 0x2ba01477 -ignore-busy
# Start a reset and halt the target
init
reset init
halt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment