PY32F003xx_DBGMCU.ini 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // File: PY32F003xx_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. // </h>
  11. DbgMCU_CR = 0x00000002;
  12. // <h> Debug MCU APB freeze1 register (DBG_APB_FZ1)
  13. // <i> Reserved bits must be kept at reset value
  14. // <o.31> DBG_LPTIM_STOP <i> LPTIM stopped when core is halted
  15. // <o.12> DBG_IWDG_STOP <i> Independent watchdog stopped when core is halted
  16. // <o.11> DBG_WWDG_STOP <i> Window watchdog stopped when core is halted
  17. // <o.10> DBG_RTC_STOP <i> RTC stopped when core is halted
  18. // <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
  19. // </h>
  20. DbgMCU_APB_Fz1 = 0x00000000;
  21. // <h> Debug MCU APB freeze2 register (DBG_APB_FZ2)
  22. // <i> Reserved bits must be kept at reset value
  23. // <o.18> DBG_TIM17_STOP <i> TIM17 counter stopped when core is halted
  24. // <o.17> DBG_TIM16_STOP <i> TIM16 counter stopped when core is halted
  25. // <o.15> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
  26. // <o.11> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
  27. // </h>
  28. DbgMCU_APB_Fz2 = 0x00000000;
  29. // <<< end of configuration section >>>
  30. /*----------------------------------------------------------------------------
  31. Setup_DBGMCU() configure DBGMCU registers
  32. *----------------------------------------------------------------------------*/
  33. FUNC void Setup_DBGMCU (void) {
  34. _WDWORD(0x40021018, _RDWORD(0x40021018) | 0x00400000); // Set RCC_APBENR1.DBGMCUEN
  35. _WDWORD(0x40015804, DBGMCU_CR); // Set DBGMCU_CR
  36. _WDWORD(0x40015808, DbgMCU_APB_Fz1); // Set DBG_APB_FZ1
  37. _WDWORD(0x4001580C, DbgMCU_APB_Fz2); // Set DBG_APB_FZ2
  38. }
  39. /*----------------------------------------------------------------------------
  40. OnResetExec() Executed after reset via uVision's 'Reset'-button
  41. *----------------------------------------------------------------------------*/
  42. FUNC void OnResetExec (void) {
  43. Setup_DBGMCU();
  44. }
  45. Setup_DBGMCU(); // Debugger Setup