Embedded Systems Design - July 2008 - (Page 21) +++ N O R O Y A LT I E S +++ embeddedsoftware ments that In CleanC, only loops that of using the patinstead of usnot defined follow this fixed pattern tern for example, a ing, or, in general, are recognized as being while loop. If the not well understood. The manifest by the tools. Use iterator is updated CleanC rules a pattern instead of using, in several places,be this can usually specify a limfor example, a while loop. replaced by a fixed ited set of update and not constructs executing the loop that should be body in some iterations. avoided. More rules of this type can A loop with a data-dependent be found elsewhere, such as in the upper bound (the typical while Misra C guidelines available at loop) can be replaced by a manifest www.misra.org.uk. loop over the maximum number of iterations with a condition nested PUTTING CLEANC TO WORK inside it. However, this is only useful Rather than exhaustively delineate these if the iterator is then used in some and other categories of rules for writing index expression. C-code for multiprocessor designs, folHere is an example where the lowing are examples of some of these guideline is followed: rules at work. solutions embOS ® Ev a av l ver ail si ab on le s (RTOS) +++ 8/16/32 bits +++ Preemptive multitasking Zero interrupt latency Easy to use start project included Profiling support included Object/source code available • emWin ® (GUI) Example #1—Guideline: use the manifest loop pattern. Many optimizations rely on analyzing exactly which data element is accessed at which point in time. That requires interpreting how index expressions evolve over the execution of the loops. Therefore, it must be possible to interpret the index expressions, the loop bounds, and how the loop iterator is incremented. To make this interpretation easier, CleanC uses a fixed pattern for manifest loops. A manifest loop is executed in exactly the same way, independent of the input received by the code. More formally, a manifest loop is a loop with an iterator that is initialized with a manifest value. The iterator is incremented or decremented with a constant value in each iteration, and the loop finishes when the iterator reaches a certain manifest value. A manifest value is a value that is either constant or computed from the iterators of outer loops. Nonmanifest loops, on the other hand, have no restriction on how they should be written. In CleanC, only loops that follow this fixed pattern are recognized as being manifest by the tools. Therefore, it mostly is just a matter for (i=0; i < 100; i = i + 4) for (j=i; j < 150; j++) if (j%5 != 0) +++ 8/16/32 bits +++ and a counterexample (in other words, where the guideline is not followed): i=0; while (i<100) { for (j=i; j<150; j++) { if (j%5 == 0) j++; } i = i + 4; } ANSI "C" source code, no C++ required Supports b/w, grayscale and color 2D graphic library included Variety of fonts included PC simulation included Window Manager/Widgets (opt) emFile (File system) +++ 8/16/32 bits +++ ANSI "C" source code MS-DOS/MS-Windows compatible FAT12, FAT16 and FAT32 support Multiple media support Non FAT file system available Figure 1 shows a screenshot of an example of the guideline “manifest loop pattern” violation as it would appear in the CleanC tool. • Example #2—Restriction: distinguish source files from header files. The C language does not formally distinguish between the interface and the implementation of a module. It only provides the #include preprocessor directives, which can be used to separate interface from implementation but which can also For ARM Chips: JTAG debug solution with flash programming phone: 978-874-0299 www.segger.com www.embedded.com | embedded systems design | JULY 2008 21 http://www.misra.org.uk http://www.segger.com http://www.embedded.com
Table of Contents Feed for the Digital Edition of Embedded Systems Design - July 2008 Embedded Systems Design - July 2008 Contents #Include Parity Bit Programming Pointers Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design Building a Power Supply for Discontinuous Transmission Wireless Networks An Exception Primer Advertising Index Break Points Marketplace Embedded Systems Design - July 2008 Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page Cover1) Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page Cover2) Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page 1) Embedded Systems Design - July 2008 - Embedded Systems Design - July 2008 (Page 2) Embedded Systems Design - July 2008 - Contents (Page 3) Embedded Systems Design - July 2008 - Contents (Page 4) Embedded Systems Design - July 2008 - Contents (Page 5) Embedded Systems Design - July 2008 - Contents (Page 6) Embedded Systems Design - July 2008 - #Include (Page 7) Embedded Systems Design - July 2008 - #Include (Page 8) Embedded Systems Design - July 2008 - Parity Bit (Page 9) Embedded Systems Design - July 2008 - Programming Pointers (Page 10) Embedded Systems Design - July 2008 - Programming Pointers (Page 11) Embedded Systems Design - July 2008 - Programming Pointers (Page 12) Embedded Systems Design - July 2008 - Programming Pointers (Page 13) Embedded Systems Design - July 2008 - Programming Pointers (Page 14) Embedded Systems Design - July 2008 - Programming Pointers (Page 15) Embedded Systems Design - July 2008 - Programming Pointers (Page 16) Embedded Systems Design - July 2008 - Programming Pointers (Page 17) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 18) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 19) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 20) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 21) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 22) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 23) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 24) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 25) Embedded Systems Design - July 2008 - Interactive C-code Cleaning Tool Supports Multiprocessor SoC Design (Page 26) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 27) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 28) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 29) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 30) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 31) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 32) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 33) Embedded Systems Design - July 2008 - Building a Power Supply for Discontinuous Transmission Wireless Networks (Page 34) Embedded Systems Design - July 2008 - An Exception Primer (Page 35) Embedded Systems Design - July 2008 - An Exception Primer (Page 36) Embedded Systems Design - July 2008 - An Exception Primer (Page 37) Embedded Systems Design - July 2008 - An Exception Primer (Page 38) Embedded Systems Design - July 2008 - An Exception Primer (Page 39) Embedded Systems Design - July 2008 - An Exception Primer (Page 40) Embedded Systems Design - July 2008 - An Exception Primer (Page 41) Embedded Systems Design - July 2008 - An Exception Primer (Page 42) Embedded Systems Design - July 2008 - An Exception Primer (Page 43) Embedded Systems Design - July 2008 - Advertising Index (Page 44) Embedded Systems Design - July 2008 - Break Points (Page 45) Embedded Systems Design - July 2008 - Break Points (Page 46) Embedded Systems Design - July 2008 - Marketplace (Page 47) Embedded Systems Design - July 2008 - Marketplace (Page 48) Embedded Systems Design - July 2008 - Marketplace (Page Cover3) Embedded Systems Design - July 2008 - Marketplace (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.