PY32F005xx_DBGMCU.ini 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // File: PY32F005xx_DBGMCU.ini
  2. // Version: 1.0.0
  3. /* variable to hold register values */
  4. define unsigned long DbgMCU_CR;
  5. define unsigned long DbgMCU_APB_Fz1;
  6. define unsigned long DbgMCU_APB_Fz2;
  7. // <<< Use Configuration Wizard in Context Menu >>>
  8. // <h> Debug MCU configuration register (DBGMCU_CR)
  9. // <o.1> DBG_STOP <i> Debug stop mode
  10. // <o.0> DBG_SLEEP <i> Debug sleep mode
  11. // </h>
  12. DbgMCU_CR = 0x00000003;
  13. // <h> Debug MCU APB freeze1 register (DBG_APB_FZ1)
  14. // <i> Reserved bits must be kept at reset value
  15. // <o.31> DBG_LPTIM1_STOP <i> LPTIM1 stopped when core is halted
  16. // <o.12> DBG_IWDG_STOP <i> Independent watchdog stopped when core is halted
  17. // </h>
  18. DbgMCU_APB_Fz1 = 0x00000000;
  19. // <h> Debug MCU APB freeze2 register (DBG_APB_FZ2)
  20. // <i> Reserved bits must be kept at reset value
  21. // <o.19> DBG_PWM1_STOP <i> PWM1 counter stopped when core is halted
  22. // <o.15> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
  23. // <o.14> DBG_TIM13_STOP <i> TIM13 counter stopped when core is halted
  24. // <o.11> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
  25. // </h>
  26. DbgMCU_APB_Fz2 = 0x00000000;
  27. // <<< end of configuration section >>>
  28. /*----------------------------------------------------------------------------
  29. Setup_DBGMCU() configure DBGMCU registers
  30. *----------------------------------------------------------------------------*/
  31. FUNC void Setup_DBGMCU (void) {
  32. _WDWORD(0x40021018, _RDWORD(0x40021018) | 0x00400000); // Set RCC_APBENR1.DBGMCUEN
  33. _WDWORD(0x40015804, DBGMCU_CR); // Set DBGMCU_CR
  34. _WDWORD(0x40015808, DbgMCU_APB_Fz1); // Set DBG_APB_FZ1
  35. _WDWORD(0x4001580C, DbgMCU_APB_Fz2); // Set DBG_APB_FZ2
  36. }
  37. /*----------------------------------------------------------------------------
  38. OnResetExec() Executed after reset via uVision's 'Reset'-button
  39. *----------------------------------------------------------------------------*/
  40. FUNC void OnResetExec (void) {
  41. Setup_DBGMCU();
  42. }
  43. Setup_DBGMCU(); // Debugger Setup