wfi.mac should be copied into the directory with the IAR project. Then set it to "Options -> Debugger -> Setup macro file(s)". This will allow debugging via JTAG when calling the WFI instruction.
This commit is contained in:
parent
e6728bac29
commit
80a9357b6f
24
configs/stm3220g-eval/ide/nsh/iar/wfi.mac
Normal file
24
configs/stm3220g-eval/ide/nsh/iar/wfi.mac
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Debug support for low-power modes
|
||||
* To enter low-power mode, the instruction WFI or WFE must be executed.
|
||||
* The MCU implements several low-power modes which can either deactivate the CPU clock
|
||||
* or reduce the power of the CPU.
|
||||
* The core does not allow FCLK or HCLK to be turned off during a debug session. As these
|
||||
* are required for the debugger connection, during a debug, they must remain active. The
|
||||
* MCU integrates special means to allow the user to debug software in low-power modes.
|
||||
* For this, the debugger host must first set some debug configuration registers to change the
|
||||
* low-power mode behavior:
|
||||
* In Sleep mode, DBG_SLEEP bit of DBGMCU_CR register must be previously set by
|
||||
* the debugger. This will feed HCLK with the same clock that is provided to FCLK
|
||||
* (system clock previously configured by the software).
|
||||
* In Stop mode, the bit DBG_STOP must be previously set by the debugger. This will
|
||||
* enable the internal RC oscillator clock to feed FCLK and HCLK in STOP mode.
|
||||
*/
|
||||
|
||||
execUserExecutionStarted()
|
||||
{
|
||||
if (!__driverType("sim"))
|
||||
{
|
||||
__writeMemory32(__readMemory32(0xE0042004, "Memory") | 0x3, 0xE0042004, "Memory"); // Set DBG_SLEEP and DBG_STOP in DBGMCU_CR
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user