Okpara Elvis
Okpara Elvis
DIIDevHeads IoT Integration Server
Created by Okpara Elvis on 12/31/2024 in #🪲-firmware-and-baremetal
Why isn’t my printf output showing on the SWV ITM console for STM32F401CDU6?
///////////////////////////////////////////////////////////////////////////////////////////////////////// // Implementation of printf like feature using ARM Cortex M3/M4/ ITM functionality // This function will not work for ARM Cortex M0/M0+ // If you are using Cortex M0, then you can use semihosting feature of openOCD ///////////////////////////////////////////////////////////////////////////////////////////////////////// //Debug Exception and Monitor Control Register base address #define DEMCR ((volatile uint32_t) 0xE000EDFCU ) /* ITM register addresses */ #define ITM_STIMULUS_PORT0 ((volatile uint32_t) 0xE0000000 ) #define ITM_TRACE_EN ((volatile uint32_t) 0xE0000E00 ) void ITM_SendChar(uint8_t ch) { //Enable TRCENA DEMCR |= ( 1 << 24); //enable stimulus port 0 ITM_TRACE_EN |= ( 1 << 0); // read FIFO status in bit [0]: while(!(ITM_STIMULUS_PORT0 & 1)); //Write to ITM stimulus port0 ITM_STIMULUS_PORT0 = ch; }
31 replies