Page 1 of 1

STM32F4 openocd configuration with WFI sleep

Posted: Mon Apr 10, 2017 2:36 pm
by andresv
I enabled sleep with CORTEX_ENABLE_WFI_IDLE define, however after that it is very tricky to connect to the device.
Now I am aware that it also makes attaching debugger impossible without touching special registers that would still provide clock for debugger. But actually I am interested in measuring power consumption and therefore debugger is not needed, so typically I will just reflash controller with this command which worked nicely before adding WFI support:

[font=Courier New]openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "program build/$(PROJECT).elf verify reset exit"[/font]

Is there any flag in openocd that still allows doing reset and uploading new binary but not making "debug" connection.

Re: STM32F4 openocd configuration with WFI sleep

Posted: Mon Apr 10, 2017 2:43 pm
by RoccoMarco
Hi,
I have worked a little bit with OpenOCD. Anyway I am unable to answer this question. BTW, I have a suggestion: do this question on the OpenOCD IRC channel (#openocd). They have a very active and kind community.

Re: STM32F4 openocd configuration with WFI sleep

Posted: Tue Apr 11, 2017 7:48 am
by andresv
I got answer from #openocd.

First of all physical reset pin must be connected to debugger and there should be following line in .cfg file:
[font=Courier New]reset_config srst_only connect_assert_srst[/font]

Oneliner to just upload new image:
[font=Courier New]openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "reset_config srst_only connect_assert_srst" -c "program build/$(PROJECT).elf verify reset exit"[/font]

Re: STM32F4 openocd configuration with WFI sleep

Posted: Tue Apr 11, 2017 8:01 am
by RoccoMarco
On discovery this should be already done. Check out ths schematic on user manual.

About ARM JTAG 20 pin connector, I wrote an article on my blog about how interfacing STLink with a microe clicker 2 which is based on STM32F407.