Hi Folks,

I've been meaning to blog about a new feature in Update 8 since July 1st when the Update was released.  This new feature is the STDIO Service, colloquially known as STDIO redirect.  This service allows for redirecting the Standard I/O anywhere you want with an implementation for UART.  For more information, please refer to the Device Drivers and System Services Manual (Help - Manuals - Software Tools Manuals).

This service was implemented in order to move simple tasks like printf() to be a lower priority task allowing for higher priority ISRs to operate without interruption.  This allows for a better real-time environment.

It also has a great side effect.  Normally, a printf() causes the processor to halt while the data is transferred from the DSP to the Host in order to be displayed in the console window.  By using the UART, the processor no longer needs to halt.  This has a very positive impact on performance.

I've put together and attached a little example to demonstrate the speed improvement of the printf().  In order to make this work, you will either need a UART connector on your development machine or purchase a UART/USB connector.  My laptop didn't have a UART port (RS-232), so I bought a dongle at a local electronics store for $29.  I'm sure you can get one cheaper, but I didn't shop around, I just wanted to get going on this.

My example does a simple loop printing out the square roots of values 0 - 99.  There are some macros to allow for switching between different modes.  I ran the example on the cycle accurate simulator (ADSP-BF5xx Single Processor Simulator), the Blackfin Family Compiled Simulator, ADSP-BF527 EZ-KIT Lite rev 2.2 w/o STDIO redirect to UART and ADSP-BF527 EZ-KIT w/ STDIO redirect to UART.  I also ran the test using sprintf() and printf().  This allows you to get a feel for how fast the platform is as well as how fast the I/O is. Here are the results:

printf()

Cycle Accurate Simulator

(ADSP-BF5xx Single Processor Simulator)

Compiled Simulator

(Blackfin Family Compiled Simulator)

BF527 EZ-KIT w/o STDIO

(ADSP-BF527 EZ-KIT Lite rev 2.2)

BF527 EZ-KIT w/ STDIO

(ADSP-BF527 EZ-KIT Lite rev 2.2)

printf() 4:34 0:02 6:58 0:06
sprintf() 3:20 0:01

0:00

(instantaneous)

0:00

(instantaneous)


As you can see, 100 printf()s went from nearly 7 minutes to only 6 seconds.  I'm very happy that we can offer this improvement to you.

Thanks,

-Merril Weiner

Product Manager - VisualDSP++

Attachments:
Anonymous
    •  Analog Employees 

    Hi Merril,

    I tried the BF527 code provided along with VDSP installation. The code successfully builds but the final output does not move to hyperterminal/tera-term. It remains in the terminal window of VDSP. Could you please help here.  Attached is the snapshot of the output. I expect this printf("\n\nType any charecter and it will be shown on the terminal\n\n"); to appear in teraterm window. But it fails.

    Regards,

    Agnes

    •  Analog Employees 
    in reply to MikeSmithCanada

    The debug print code contained within the 21469 POST uses very generic routines that can easily be reused on other boards with a UART.  For example the 21479 and 21489 EZ-Boards reuse all of the 21469 code with only one minor tweak to Init_UART() in uart_test.c to keep a standard baud rate due to core clock rate differences between the boards.  Other processors may require setting up the UART a little differently, but should be relatively minor.

    Also note that the new STDIO service discussed above is currently only provided for Blackfin, not SHARC.

  • Nice job -- wish I had understood the availability back in June  but thats life

    Question -- the debug print options through the UART seen with the power-up-test code for 21469, is that a general VDSP option for all processors (with UART on board) or do I have to do a customization for all boards.

    It would seem that with the general redirection then the debug option via UART would the way to go

    Also, does the redirection also work with a file -- although I presume that would have the same problem as the standard printf -- meaning using the JTAG for communication