PY32F071xx_DBGMCU.ini 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // File: PY32F071xx_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_LPTIM_STOP <i> LPTIM stopped when core is halted
  16. // <o.22> DBG_I2C2_SMBUS_TIMEOUT <i> I2C2_SMBUS TIMEOUT frozened when core is halted
  17. // <o.21> DBG_I2C1_SMBUS_TIMEOUT <i> I2C1_SMBUS TIMEOUT frozened when core is halted
  18. // <o.12> DBG_IWDG_STOP <i> Independent watchdog stopped when core is halted
  19. // <o.11> DBG_WWDG_STOP <i> Window watchdog stopped when core is halted
  20. // <o.10> DBG_RTC_STOP <i> RTC stopped when core is halted
  21. // <o.5> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
  22. // <o.4> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
  23. // <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
  24. // <o.0> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
  25. // </h>
  26. DbgMCU_APB_Fz1 = 0x00000000;
  27. // <h> Debug MCU APB freeze2 register (DBG_APB_FZ2)
  28. // <i> Reserved bits must be kept at reset value
  29. // <o.18> DBG_TIM17_STOP <i> TIM17 counter stopped when core is halted
  30. // <o.17> DBG_TIM16_STOP <i> TIM16 counter stopped when core is halted
  31. // <o.16> DBG_TIM15_STOP <i> TIM15 counter stopped when core is halted
  32. // <o.15> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
  33. // <o.11> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
  34. // </h>
  35. DbgMCU_APB_Fz2 = 0x00000000;
  36. // <<< end of configuration section >>>
  37. /*----------------------------------------------------------------------------
  38. Setup_DBGMCU() configure DBGMCU registers
  39. *----------------------------------------------------------------------------*/
  40. FUNC void Setup_DBGMCU (void) {
  41. _WDWORD(0x40021040, _RDWORD(0x40021040) | 0x00000400); // Set RCC_APBENR2.DBGMCUEN
  42. _WDWORD(0x40015804, DBGMCU_CR); // Set DBGMCU_CR
  43. _WDWORD(0x40015808, DbgMCU_APB_Fz1); // Set DBG_APB_FZ1
  44. _WDWORD(0x4001580C, DbgMCU_APB_Fz2); // Set DBG_APB_FZ2
  45. }
  46. /*----------------------------------------------------------------------------
  47. OnResetExec() Executed after reset via uVision's 'Reset'-button
  48. *----------------------------------------------------------------------------*/
  49. FUNC void OnResetExec (void) {
  50. Setup_DBGMCU();
  51. }
  52. Setup_DBGMCU(); // Debugger Setup