printf over the SWO
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2010-11-08 6:05 AM
Posted on November 08, 2010 at 15:05
printf over the SWO
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2011-05-17 5:14 AM
Posted on May 17, 2011 at 14:14
I’m looking for a small example on how to printf over the SWO to the Keil IDE, I can do it by RS323 to a terminal, but how do I point it to the SWO instead of the UART, can someone please provide me with a small example or a link to where I can read about it. Thanks
Replace the semi-hosting routines, specifically the fputc() and _ttywrch() with routines that access the M3's debug channel. Something along the following lines, using the core_cm3 CMSIS Core Support package. #include <rt_misc.h> #pragma import(__use_no_semihosting_swi) struct __FILE { int handle; /* Add whatever you need here */ }; FILE __stdout; FILE __stdin; int fputc(int ch, FILE *f) { return (ITM_SendChar((uint32_t)ch)); } int fgetc(FILE *f) { return ((int)ITM_ReceiveChar()); } int ferror(FILE *f) { /* Your implementation of ferror */ return EOF; } void _ttywrch(int ch) { ITM_SendChar((uint32_t)ch); } void _sys_exit(int return_code) { label: goto label; /* endless loop */ }
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
