Embedded Insight Archives |
|||||||||
|
/*------------------------------------------------------------------*\
\*------------------------------------------------------------------*/
Welcome to the first issue of Embedded Insight. This monthly newsletter is intended for product development managers and embedded systems engineers. Each issue contains news and information on current projects and products, embedded systems hardware and software, and design. If you have any suggestions, please contact us at mailto:info@base2software.com. We hope that you will find this information useful.
SIMPLEDEVICES SHIPS WIRELESS STREAMING MP3 PLAYER SimpleDevices is shipping the SimpleFi, a wireless streaming digital audio player. Using your existing PC, the SimpleFi can play MP3 files and streams from the Internet to your stereo. Base2 designed and developed the firmware for this exciting new audio device. From inception to prototype to Comdex to manufacturing, Base2 was instrumental to the success of the SimpleFi. The streaming digital audio player is being sold as the Motorola SimpleFi. It has won the "Best New Technology" award at Australia's 2001 IT/Expo Comdex+Interop and an "Innovative Product" award at CES 2002. For more information about the SimpleFi, go to the SimpleDevices website at http://www.simpledevices.com. For more information about Base2's contribution to the SimpleFi development effort, please contact us at 510/745-7773 or mailto:info@base2software.com.
THE CIRRUS LOGIC EP7312 32-BIT MICROCONTROLLER The Cirrus Logic EP7312 is the latest ARM7-based system-on-a-chip (SOC) microcontroller from Cirrus Logic. It is essentially the same as the EP7212 except that it has a built-in SDRAM controller instead of a built-in EDO DRAM controller. It is a fast low-power microcontroller suitable for all kinds of applications, especially portable electronics. At the heart of the EP7312 is the ARM720T core. This is the same as the ARM7TDMI core with the addition of an 8KB instruction/data cache and an MMU. The processor has a maximum clock rate of 74 MHz, and it has an architecture that works well with multithreaded real-time operating systems. Here are some of the features:
Tools, development boards, and operating systems for the EP7312 are available from many different vendors. The EP7312 can be had for about $15US (Qty 1K). For more information on the EP7312, see the Cirrus Logic website at http://www.maverickinside.com/sub.cfm?CategoryID=3&CirrusProductNumber=EP7312.
PROGRAMMERS' CORNER - LOOP OPTIMIZATION A significant amount of time is spent in repetitive data manipulations when code is executed. Usually these repetitive tasks are performed within 'while' loops and 'for' loops. While these loops are generally easy to write, compilers can generate some pretty inefficient code depending upon manufacturer, microcontoller, and optimization settings. How can you tell if a loop is inefficient? The only real way is to understand the assembly language of your target processor and examining the disassembled C code. You can then decide if you need only rewrite your C routine or if you need to (gasp!) rewrite it in assembly. In most cases, a rewritten C function is all you need for substantial performance gains. As a case study, let's look at the implementation for memcpy(), an ANSI function. This function copies one buffer to another for a specified number of bytes. Let's assume that the target processor is an ARM7 core. A quick and easy implementation of memcpy() is as follows: void * memcpy( void * dest, const void * src, size_t numBytes ) { char * pDest; const char * pSrc; size_t i; pDest = dest; pSrc = src; for ( i = 0; i < numBytes; i++ ) pDest[i] = pSrc[i]; return dest; } At first glance, this is a reasonable-looking function. And don't get me wrong, for many cases, this is probably OK. But as all of us embedded engineers know, processor speed is almost always at a premium, and squeezing the most out of our code is high on our list. Let's look at the assembly for the loop through an ARM disassembler: 0x0000805C mov r12,#0 ; for ( i = 0; 0x00008060 cmp r12,r2 ; i < numBytes 0x00008064 blt 0x8074 ; Take the 'for' loop 0x00008068 b 0x8080 ; Exit 'for' loop 0x0000806C add r12,r12,#1 ; i++ 0x00008070 b 0x8060 0x00008074 ldrb r0,[r14,r12] ; pDest[i] = pSrc[i] 0x00008078 strb r0,[r4,r12] ; " 0x0000807C b 0x806C ; Continue 'for' loop Overall, the code generated isn't too bad, but if we change the loop structure, this routine could be a lot faster. Note where there are three branching instructions per iteration within this loop. Also note that the loop takes 7 instructions per iteration to execute. Surely we could do better than that! Let's try a slightly different approach. All the code is essentially the same except that instead of a 'for' loop, we're using a 'while' loop: void * memcpy( void * dest, const void * src, size_t numBytes ) { char * pDest; const char * pSrc; pDest = dest; pSrc = src; while ( numBytes-- ) *pDest++ = *pSrc++; return dest; } Here's the assembly for this loop: 0x000080A0 subs r2,r2,#1 ; numBytes-- This loop executes in only 5 instructions per iteration, a 29% improvement. While this was only a simple example, it presents one way a programmer could restructure the C routine and save on processing power without resorting to writing it in assembly.
BACKGROUND ON BASE2 Base2 was founded in 1998 to provide product development companies the best in embedded systems engineering. Our services include requirements gathering, formal design documentation, rapid prototype development, and hardware/software co-design. Our staff excels in understanding the needs of the client and end user, creating fast reliable designs that succeed in the marketplace. Check out our website at http://www.base2software.com to see more information about our skills and capabilities.
Base2 Software Design,
Inc. Phone: 510/745-7773 mailto:info@base2software.com ====================================================================== If you know anyone who would like to receive this informative newsletter, please forward this to them. They can sign up by sending an e-mail to mailto:info@base2software.com?Subject=Subscribe. ====================================================================== If this newsletter was sent to you in error or if you'd like to unsubscribe to our newsletter, simply reply to mailto:info@base2software.com?Subject=Unsubscribe. ====================================================================== Copyright 2002, Base2 Software Design, Inc. You may use the contents of Embedded Insight in whole or in part if you include this complete copyright notice and the following links: http://www.base2software.com. mailto:info@base2software.com. |
||||||||
© 2002-2009, base2 software design, inc. |
|||||||||