Using the system's reset avoids the debug getting stuck when the chip enters low power. Hopefully this works all the time
26 lines
698 B
INI
26 lines
698 B
INI
|
|
# using a STM32f103CB wich has 128kB of flash instead of the more common 64KB
|
|
set CHIPNAME stm32f103CB
|
|
set FLASH_SIZE 0x20000
|
|
|
|
# load default configurations
|
|
source [find interface/stlink.cfg]
|
|
source [find target/stm32f1x.cfg]
|
|
|
|
# override examine-end event
|
|
$CHIPNAME.cpu configure -event examine-end {
|
|
# write DBGMCU_CR, disable all peripherals (timers, dmas, watchdogs while
|
|
# halted by debug. Trace is not affected
|
|
mmw 0xE0042004 0x7E3FFF07 0
|
|
}
|
|
|
|
|
|
reset_config srst_only srst_nogate connect_assert_srst
|
|
|
|
# inits debugging, from that point, commands can be used
|
|
init
|
|
# resets the target and halt it immediately afterward. Stops debug from being
|
|
# inacessible due to low-power states
|
|
reset halt
|
|
|