// File: PY32F005xx_DBGMCU.ini
// Version: 1.0.0
/* variable to hold register values */
define unsigned long DbgMCU_CR;
define unsigned long DbgMCU_APB_Fz1;
define unsigned long DbgMCU_APB_Fz2;
// <<< Use Configuration Wizard in Context Menu >>>
// Debug MCU configuration register (DBGMCU_CR)
// DBG_STOP Debug stop mode
// DBG_SLEEP Debug sleep mode
//
DbgMCU_CR = 0x00000003;
// Debug MCU APB freeze1 register (DBG_APB_FZ1)
// Reserved bits must be kept at reset value
// DBG_LPTIM1_STOP LPTIM1 stopped when core is halted
// DBG_IWDG_STOP Independent watchdog stopped when core is halted
//
DbgMCU_APB_Fz1 = 0x00000000;
// Debug MCU APB freeze2 register (DBG_APB_FZ2)
// Reserved bits must be kept at reset value
// DBG_PWM1_STOP PWM1 counter stopped when core is halted
// DBG_TIM14_STOP TIM14 counter stopped when core is halted
// DBG_TIM13_STOP TIM13 counter stopped when core is halted
// DBG_TIM1_STOP TIM1 counter stopped when core is halted
//
DbgMCU_APB_Fz2 = 0x00000000;
// <<< end of configuration section >>>
/*----------------------------------------------------------------------------
Setup_DBGMCU() configure DBGMCU registers
*----------------------------------------------------------------------------*/
FUNC void Setup_DBGMCU (void) {
_WDWORD(0x40021018, _RDWORD(0x40021018) | 0x00400000); // Set RCC_APBENR1.DBGMCUEN
_WDWORD(0x40015804, DBGMCU_CR); // Set DBGMCU_CR
_WDWORD(0x40015808, DbgMCU_APB_Fz1); // Set DBG_APB_FZ1
_WDWORD(0x4001580C, DbgMCU_APB_Fz2); // Set DBG_APB_FZ2
}
/*----------------------------------------------------------------------------
OnResetExec() Executed after reset via uVision's 'Reset'-button
*----------------------------------------------------------------------------*/
FUNC void OnResetExec (void) {
Setup_DBGMCU();
}
Setup_DBGMCU(); // Debugger Setup