Posts

Showing posts from April, 2019

How to print your log in Vxworks6.x

For embedded software developer using printf  is the most used debug method on target. But in vxworks6.x, it start to change because the default stdout/stderr is redirected. If you connect to device by shell/telnet, printf in the code will not put to the stdout/stderr in the current shell. Solution: You can put a the following code in the debug version. Once you have connect to target by shell/telnet, call the function to redirect some task /all task io to the current shell. void ioRedirect ( void ) { int shellTid = 0 ; int shellOpFd = 0 ; int globalStdFd = 0 ; shellTid = taskIdSelf (); shellOpFd = ioTaskStdGet (shellTid, 1 ); globalStdFd = ioGlobalStdGet ( 1 ); ( void ) logMsg ( "LM:Initial task output.shellFd %d, GlobalFd %d. \n " , shellOpFd, globalStdFd, 0 , 0 , 0 , 0 ); printf ( "p:Initial task output.shellFd %d, GlobalFd %d. \n " , shellOpFd, globalStdFd); /*you can specify the task who need pr