diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index 2bff63515ad..dcdab4c1efc 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -100,6 +100,10 @@ CMN_CSRCS += up_copyarmstate.c endif endif +ifeq ($(CONFIG_ARMV7M_ITMSYSLOG),y) +CMN_CSRCS += up_itm_syslog.c +endif + CHIP_ASRCS = CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c diff --git a/arch/arm/src/stm32/stm32f40xxx_rcc.c b/arch/arm/src/stm32/stm32f40xxx_rcc.c index e740ff2b443..1f39b483508 100644 --- a/arch/arm/src/stm32/stm32f40xxx_rcc.c +++ b/arch/arm/src/stm32/stm32f40xxx_rcc.c @@ -38,7 +38,10 @@ * Included Files ****************************************************************************/ +#include +#include "chip.h" #include "stm32_pwr.h" +#include "itm_syslog.h" /**************************************************************************** * Pre-processor Definitions @@ -789,6 +792,30 @@ static void stm32_stdclockconfig(void) } #endif +/**************************************************************************** + * Name: efm32_itm_syslog + * + * Description: + * Enable Serial wire output pin, configure debug clocking, and enable + * ITM syslog support. + * + ****************************************************************************/ + +#if defined(CONFIG_SYSLOG) || defined(CONFIG_ARMV7M_ITMSYSLOG) +static inline void rcc_itm_syslog(void) +{ + + /* Enable SWO output */ + + modifyreg32(STM32_DBGMCU_CR, DBGMCU_CR_TRACEMODE_MASK, DBGMCU_CR_ASYNCH|\ + DBGMCU_CR_TRACEIOEN); + + itm_syslog_initialize(); +} +#else +# define rcc_itm_syslog() +#endif + /**************************************************************************** * Name: rcc_enableperiphals ****************************************************************************/ @@ -800,6 +827,7 @@ static inline void rcc_enableperipherals(void) rcc_enableahb3(); rcc_enableapb1(); rcc_enableapb2(); + rcc_itm_syslog(); } /****************************************************************************