From ba9bc57a4976c0541954d18d8c225ec32acc192d Mon Sep 17 00:00:00 2001 From: Steins7 Date: Sun, 4 Aug 2024 15:52:24 +0200 Subject: [PATCH] Add openocd configuration The target's debug would sometime get stuck while in low-power, making it difficult to resume communications, even after hardware resets. Some peripherals were also kept running when halted. This config should fix these issues --- openocd.cfg | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 openocd.cfg diff --git a/openocd.cfg b/openocd.cfg new file mode 100644 index 0000000..5598416 --- /dev/null +++ b/openocd.cfg @@ -0,0 +1,22 @@ + +# 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 +} + +# 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 +