Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training module provides an overview of optimization techniques used in.

Similar presentations


Presentation on theme: "© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training module provides an overview of optimization techniques used in."— Presentation transcript:

1 © 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training module provides an overview of optimization techniques used in the HEW environment to improve program execution and memory size. Objectives  Learn the different approaches used by programmers.  Understand how to configure the HEW Toolchain to achieve basic optimization. Content  19 pages  3 questions Learning Time  25 minutes Introduction

2 © 2008, Renesas Technology America, Inc., All Rights Reserved 2 General approaches  Choice of compiler  Compiler settings  Programming algorithms and techniques  Rewriting program in assembly HEW provides tools for easier, more effective optimization Optimization approaches in HEW H8 Toolchain environment  H8 Compiler options  Inter-module Optimizer  Code and algorithm modification Optimization Approaches

3 © 2008, Renesas Technology America, Inc., All Rights Reserved 3 Program Speed vs. Size Faster execution, but bigger code size Smaller code size, but slower execution Smaller code size, but slower execution Example: Programs use different coding methods to perform similar task

4 © 2008, Renesas Technology America, Inc., All Rights Reserved 4 Getting Started Steps to begin optimization  Click on Build  Select H8S,H8/300 Standard Toolchain Optimization can be performed in three areas  C/C++ Files  Link Library  Standard Library

5 © 2008, Renesas Technology America, Inc., All Rights Reserved 5 C/C++ Optimization Optimize the following types of files:  C files (*.c)  C++ files (*.cpp) Configure the Toolchain for C/C++ optimization  Click on C/C++ tab  Select entire project or individual files from “Tutorial”  Select optimization category and type Inter-module optimization is not selected at this time

6 © 2008, Renesas Technology America, Inc., All Rights Reserved 6 Optimize the following types of files: Library (*.lib, *.obj) Configure items in the Link/Library Click on Link/Library tab Select the whole project (“Tutorial” in this example) Select optimization category and type Link/Library Optimization

7 © 2008, Renesas Technology America, Inc., All Rights Reserved 7 Optimize items in the Standard Library  Click on Standard Library tab  Select project from Tutorial  Select optimization category and type Standard Library Optimization

8

9 © 2008, Renesas Technology America, Inc., All Rights Reserved 9 Inter-module Optimizer Compiler generates inter-module supplementary information Inter-module Optimizer uses supplementary information to optimize each module before linking Linkage Editor Compiler Inter-module Optimizer Source Program Object Program Sub Command Object program Outputs inter- module optimizing information Sub Command Load Module Linker executes automatically after optimization is complete

10 © 2008, Renesas Technology America, Inc., All Rights Reserved 10 Size and Speed Improvements  Unifies constants and literal strings  Deletes unreferenced symbols  Does short absolute addressing  Does indirect addressing  Does register save and restore  Unifies same codes  Optimizes branch instructions Improvements Size Speed Improvements Size Speed Inter-module Optimizer

11 © 2008, Renesas Technology America, Inc., All Rights Reserved 11 Overall Improvement Conventional Optimization only With Inter-module Optimizaton ABCD.abs A.c B.c C.c D.c A.c B.c C.c D.c Optimization on compiling Optimization on compiling Optimization on compiling Optimization on compiling Optimization on linking When optimization is enabled, code in Debugging window won’t match original source code. Better ROM Efficiency and Faster Execution Code Size

12 © 2008, Renesas Technology America, Inc., All Rights Reserved 12 Quantifying the Improvements Determine memory size improvements -View Map file Measure execution speed improvements -Use emulator’s built-in time measurement -Use simulator’s calculated execution cycles -Make physical ∆t measurement via port pin 0400 1C25 Sort( ) Sort time StartEnd

13

14 © 2008, Renesas Technology America, Inc., All Rights Reserved 14 Using Mapview to Measure Size Configure compiler to generate map file (.map)  Select C/C++, Assembly, or Link/Library from Debug configuration directory  Check “Generate file” and click on “Enable all” Launch Mapview to view map file Launch Mapview

15 © 2008, Renesas Technology America, Inc., All Rights Reserved 15 Mapview shows  Code size  Global variables  Variable address allocation  Section address Selected area (P section) shows  Sizes of functions in selected section  Size of program’s Main function Viewing Size Improvement

16 © 2008, Renesas Technology America, Inc., All Rights Reserved 16 Oscilloscope: - Manual time measurement Simulator Status window: - Number of instructions and cycles Emulator Status window: - Run time Emulator/Simulator Trace windows Methods of Determining Speed Simulator Status window shows number of instructions and cycles executed Emulator Status window shows the run time in ns (depending on the resolution setting)

17 © 2008, Renesas Technology America, Inc., All Rights Reserved 17 Data in Trace Windows Emulator Trace window shows cumulative instruction timestamp at a preset resolution of 125ns Simulator Trace window indicates cumulative cycles

18

19 © 2008, Renesas Technology America, Inc., All Rights Reserved 19 Course Summary  Optimizing programs for size or speed  Optimization tools in the HEW Toolchain  Inter-module optimization  Techniques for measuring size and speed Download a free evaluation copy of HEW at: www.renesas.com/hew


Download ppt "© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training module provides an overview of optimization techniques used in."

Similar presentations


Ads by Google