MCU: STM32F030, Cortex-M0 IDE: uVison 5 ST-Link Debugger
I would like to use "debug(printf) viewer" to see my ADC value when debuging. I just have seen "Trace HW not present"
May you please help me about debug(printf) and send some example?
here is my code for using "Trace";
#include"stdio.h" #include "stm32f0xx.h" #define ITM_Port8(n) (*((volatile unsigned char *)(0xE0000000+4*n))) #define ITM_Port16(n) (*((volatile unsigned short*)(0xE0000000+4*n))) #define ITM_Port32(n) (*((volatile unsigned long *)(0xE0000000+4*n))) #define DEMCR (*((volatile unsigned long *)(0xE000EDFC))) #define TRCENA 0x01000000 struct __FILE { int handle; /* Add whatever you need here */ }; FILE __stdout; FILE __stdin; int fputc(int ch, FILE *f) { if (DEMCR & TRCENA) { while (ITM_Port32(0) == 0); ITM_Port8(0) = ch; } return(ch); }
Best regards, Mehmet