Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Real-Time Software Components (RTSC) » Logging via UART
Logging via UART [message #1022581] Fri, 22 March 2013 03:00 Go to next message
Naoki Kawada is currently offline Naoki Kawada
Messages: 10
Registered: January 2012
Location: Tokyo
Junior Member
Hello,

I want to use Log interface to display real time logs via UART.
I have created an UART-PRUSS driver for OMAPL platform in order to realize background log streaming via UART.

And I configured cfg file to hook "flush" function :

var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Main = xdc.useModule('xdc.runtime.Main');

/* Create LoggerBuf instance and bind it to Default */
LoggerBuf.TimestampProxy = xdc.useModule('xdc.runtime.Timestamp');
LoggerBuf.enableFlush = true;
var LoggerBufParams = new LoggerBuf.Params;
var logger0 = LoggerBuf.create(LoggerBufParams);
Defaults.common$.logger = logger0;

/* Enable USER1 diags in Main module */
Main.common$.diags_USER1 = Diags.ALWAYS_ON;

/* Hook for Flush logs */
System.SupportProxy = SysMin;
SysMin.outputFxn = "&PRUSS_UARTDVR_put"; /* This is my UART-PRUSS driver code */


And then, Log_print in Application :

Log_print0(Diags_USER1, "Hellow\n");


With this code, the control did not come to PRUSS_UARTDVR_put()...

Could you please suggest me what is wrong in my code ?

Best Regards,
Kawada
Re: Logging via UART [message #1022902 is a reply to message #1022581] Fri, 22 March 2013 15:02 Go to previous messageGo to next message
Sasha Slijepcevic is currently offline Sasha Slijepcevic
Messages: 86
Registered: July 2009
Member
Kawada,
have you tried using LoggerSys instead of LoggerBuf? LoggerSys routes events directly to System_printf, while LoggerBuf does it only when you flush the buffer. Here are the docs for both:
http://rtsc.eclipse.org/cdoc-tip/xdc/runtime/LoggerBuf.html
http://rtsc.eclipse.org/cdoc-tip/xdc/runtime/LoggerSys.html
Re: Logging via UART [message #1023016 is a reply to message #1022902] Fri, 22 March 2013 22:12 Go to previous messageGo to next message
Naoki Kawada is currently offline Naoki Kawada
Messages: 10
Registered: January 2012
Location: Tokyo
Junior Member
Hello Sasha,

Thank you for your reply. I'll try LoggerSys.
I'll be back here next week.

Best regards,
Kawada
Re: Logging via UART [message #1024250 is a reply to message #1022581] Mon, 25 March 2013 22:31 Go to previous messageGo to next message
Naoki Kawada is currently offline Naoki Kawada
Messages: 10
Registered: January 2012
Location: Tokyo
Junior Member
Hello,

I tried LoggerSys instead of LoggerBuf and my code starts working now.
Sasha, Thank you for your suggestion.

But I needed an additional code to get working - that is calling System_flush() intentionally after Log_prints.

Adding this call for every Log_print in application code is so redundant. So, I'm wondering if calling System_flush() in Idle thread might be better.
What do you think of this ?
If you have any better solutions, please let me know.

Best Regards,
Kawada
Re: Logging via UART [message #1028057 is a reply to message #1024250] Wed, 27 March 2013 15:39 Go to previous messageGo to next message
Sasha Slijepcevic is currently offline Sasha Slijepcevic
Messages: 86
Registered: July 2009
Member
Kawada,
the System provider you are using is SysMin, and it maintains a buffer whose default size is 1024 bytes. If you print more than 1024 characters before calling System_flush(), the oldest characters that weren't printed yet will be overwritten. You can configure the buffer size to be large enough so that the buffer doesn't get filled up between executions of the Idle thread. Depending how much you care about memory consumption and the completeness of the output, you can decrease or increase the buffer size.
If you have to have both, low memory usage and the complete output, you'll have to call System_flush after each Log_print.

[Updated on: Wed, 27 March 2013 15:41]

Report message to a moderator

Re: Logging via UART [message #1028283 is a reply to message #1028057] Wed, 27 March 2013 23:48 Go to previous message
Naoki Kawada is currently offline Naoki Kawada
Messages: 10
Registered: January 2012
Location: Tokyo
Junior Member
Sasha,

Thank you for your suggestion.
Right. I'll care about buffer size for complete output.
As for now, the logs look like being transferred to TeraTerm completely with Idle thread flushing. Very comfortable Smile

Best Regards,
Kawada
Previous Topic:Using xdc with VS2008 - problems
Next Topic:Source location
Goto Forum:
  


Current Time: Wed Aug 27 05:19:03 EDT 2014

Powered by FUDForum. Page generated in 0.03595 seconds