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++