How to redirect stdio?

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

How to redirect stdio?

Post by Heater »

Firstly I have read somewhere that when I use printf and such in my programs the processor goes into a debug mode. All threads are halted and the IO is performed, which I eventually get to see in my Eclipse console. When done debug mode is exited and all threads started again. So:

1) Is this description correct?

2) How can I intercept this and redirect stdio to my own uarts or other IO devices?

3) How can do the same for the file system, fopen, fread, fwrite, fclose etc etc. When I implement my own block drivers and file system?

4) How can I remove that debug mode code from my builds?


gcore
Member
Posts: 11
Joined: Thu Oct 06, 2016 4:58 am

Post by gcore »

I would like to ask the same question. I would like to leverage the infrastructure that allows any core to print to the debug console at the expense of one channel per tile, and rather than send all the messages out via xScope/xConnect to the xTimeComposer console, send them to a task of my choosing (on the XMOS) to be handled in a way specific to my application. This could be used for say gathering the debug messages and saving them to flash or sending them over Ethernet when it's not possible to run with the xTag attached.

I'm guessing this is not possible as no one has responded to this thread, but one doesn't find out unless one asks...
Post Reply