We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How can i use printf in keil for my stm32f429i disc1 discovery board. I followed the steps on this link www.keil.com/.../ulink2_trace_itm_viewer.htm. i am still not able to print. Do i have to add any code. If yes where? My retarget_io.c file which gets created when i select the stdio and stdin itm is locked. Its unmodifiable. Is there a need to modify that? Blocked at this since 2 days. So need help soon. Do i have to add this to my main file?
#include <stdio.h> #include <rt_misc.h>
#pragma import(__use_no_semihosting_swi)
// Para utilização do saida de debug através do ULINK2 #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;
// Escreve caractere na porta de Debug int sendchar (int ch) { if (DEMCR & TRCENA) { while (ITM_Port32(0) == 0); ITM_Port8(0) = ch; } return(ch); }
int fputc(int ch, FILE *f) { return (ITM_SendChar((uint32_t)ch)); }
int ferror(FILE *f) { /* Your implementation of ferror */ return EOF; }
void _ttywrch(int ch) { sendchar(ch); }
void _sys_exit(int return_code) { label: goto label; /* endless loop */ }
Illustration of how output should look community.st.com/.../107897 community.st.com/.../114079