// File: STM32F101_102_103_105_107_DBGMCU.ini // Version: 1.0.0 // Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008) // STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets /* variable to hold register values */ define unsigned long DbgMCU_CR; // <<< Use Configuration Wizard in Context Menu >>> // Debug MCU configuration register (DBGMCU_CR) // Reserved bits must be kept at reset value // DBG_TIM11_STOP TIM11 counter stopped when core is halted // DBG_TIM10_STOP TIM10 counter stopped when core is halted // DBG_TIM9_STOP TIM9 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_TIM12_STOP TIM12 counter stopped when core is halted // DBG_CAN2_STOP Debug CAN2 stopped when core is halted // DBG_TIM7_STOP TIM7 counter stopped when core is halted // DBG_TIM6_STOP TIM6 counter stopped when core is halted // DBG_TIM5_STOP TIM5 counter stopped when core is halted // DBG_TIM8_STOP TIM8 counter stopped when core is halted // DBG_I2C2_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted // DBG_I2C1_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted // DBG_CAN1_STOP Debug CAN1 stopped when Core is halted // DBG_TIM4_STOP TIM4 counter stopped when core is halted // DBG_TIM3_STOP TIM3 counter stopped when core is halted // DBG_TIM2_STOP TIM2 counter stopped when core is halted // DBG_TIM1_STOP TIM1 counter stopped when core is halted // DBG_WWDG_STOP Debug window watchdog stopped when core is halted // DBG_IWDG_STOP Debug independent watchdog stopped when core is halted // TRACE_MODE Trace mode // <0=> Asynchronous // <1=> Synchronous: TRACEDATA Size 1 // <2=> Synchronous: TRACEDATA Size 2 // <3=> Synchronous: TRACEDATA Size 4 // TRACE_IOEN Trace I/O enable // DBG_STANDBY Debug standby mode // DBG_STOP Debug stop mode // DBG_SLEEP Debug sleep mode // DbgMCU_CR = 0x7E3FFF07; // TPIU Pin Routing // TRACECLK: Pin PE2 // TRACED[0]: Pin PE3 // TRACED[1]: Pin PE4 // TRACED[2]: Pin PE5 // TRACED[3]: Pin PE6 // // <<< end of configuration section >>> /*---------------------------------------------------------------------------- Setup_TracePins() configure the used trace pins *----------------------------------------------------------------------------*/ FUNC void Setup_TracePins (unsigned char trace_mode) { /* trace pins are configuration not necessary */ } /*---------------------------------------------------------------------------- Setup_DBGMCU() configure DBGMCU registers *----------------------------------------------------------------------------*/ FUNC void Setup_DBGMCU (void) { if (DbgMCU_CR & (1 << 5)){ Setup_TracePins (((DbgMCU_CR >> 6) & 3)); } _WDWORD(0xE0042004, DbgMCU_CR); // Set DBGMCU_CR } /*---------------------------------------------------------------------------- OnResetExec() Executed after reset via uVision's 'Reset'-button *----------------------------------------------------------------------------*/ FUNC void OnResetExec (void) { Setup_DBGMCU(); } Setup_DBGMCU(); // Debugger Setup