Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course describes Coverage, a utility that is used.

Similar presentations


Presentation on theme: "© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course describes Coverage, a utility that is used."— Presentation transcript:

1 © 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course describes Coverage, a utility that is used with the High-performance Embedded Workshop (HEW) development environment for microcontrollers (MCUs) from Renesas Technology Corp. Objectives  Understand the purpose of Code Coverage analysis.  Know the types of information provided by the Coverage utility.  Learn how to set up and use the Coverage utility during program development. Content  22 pages  3 questions Learning Time  35 minutes

2 © 2008, Renesas Technology America, Inc., All Rights Reserved 2 Purpose of Coverage Analysis  Determines how much programming code is verified or covered by testing  Has a threefold purpose: –Locate areas of program not yet covered by testing –Identify and remove redundant test cases that do not improve coverage –Establish a quantitative measure of coverage that serves as an indirect measure of quality  Is provided by in HEW by the Coverage debugging feature

3 © 2008, Renesas Technology America, Inc., All Rights Reserved 3 Types of Coverage C0 and C1 are the minimum test criteria for unit testing as defined by IEEE. S1 – Call-pair Coverage Determines whether all connections between calling function and called function have been tried S0 – Module Coverage Determines whether all functions have been tested C1 – Branch Coverage Determines whether all logic conditions have been evaluated C0 – Statement Coverage Determines whether all lines of code have been tested

4 © 2008, Renesas Technology America, Inc., All Rights Reserved 4 Condition B Condition A Branch coverage (C1): A piece of code is 100% covered when each branch of an “If” statement has been executed at least once. Basic Coverage Measurements Statement coverage (C0): A line of code is “covered” if the test case has touched any part of it. Condition B Condition A Test Path

5

6 © 2008, Renesas Technology America, Inc., All Rights Reserved 6 Requires hardware emulation tool Additional acquisition information such as reading memory, writing to memory, etc. “Data Coverage” window Requires hardware emulation tool C0, C1“Code Coverage” window E6000H AE5 Emulator debugger C0, C1“Coverage” window Simulator debugger RemarkType of CoverageCoverage component Debugger platform Obtaining Coverage Information

7 © 2008, Renesas Technology America, Inc., All Rights Reserved 7 Simulator Coverage Window Open Coverage window – Invoke HEW – Generate a new workspace or open an existing workspace – Load a debugger session of simulator and download a debug module  Choose - View  Code  Coverage or  Click the Coverage toolbar button to open the Coverage dialog box Start address End address

8 © 2008, Renesas Technology America, Inc., All Rights Reserved 8  Open a New Window 1. Set Coverage Range by specifying Start and End address of coverage information display. (Note: When a prefix is omitted, value is input in hexadecimal.) 2. Set Coverage Range by specifying Source File (type.c or.cpp)  Use information from existing Coverage information file Setting Coverage Range When Coverage window is open, within the specified measurement range, addresses are specified directly and all functions within the selected file are set. When the Coverage window is subsequently closed, specified settings and conditions are cleared from memory. Start address End address

9 © 2008, Renesas Technology America, Inc., All Rights Reserved 9 Coverage Specified By Address Percentage of instructions executed within the range Number of times a particular instruction was executed Execution status of conditional branch instructions T: A branch occurred because the condition was satisfied F: No branch occurred because the condition was not satisfied C0 Coverage Information Address range C1 Coverage Information

10 © 2008, Renesas Technology America, Inc., All Rights Reserved 10 Selecting File to be Analyzed

11 © 2008, Renesas Technology America, Inc., All Rights Reserved 11 Calculating C0 Let n = Size of the address range [number of instructions] Let m = Number of coverage data with “Times” >0 [number of instructions executed at least once] Then Percent of Coverage = (m / n) x 100%

12

13 © 2008, Renesas Technology America, Inc., All Rights Reserved 13 Choose Go to Address... to open the Go To Address dialog box. This dialog box changes the address displayed in the Coverage window. Changing the Display Address Choose View Source from the pop-up menu to open the Editor window and to display the Editor window corresponding to the cursor location in the Coverage window. Viewing the Source Window Select Enable Coverage from the pop- up menu and execute the program to acquire coverage information. Acquiring Coverage Information Coverage Window Operation

14 © 2008, Renesas Technology America, Inc., All Rights Reserved 14 Specifying the Coverage Range with Start and End Addresses Select Start address. When a prefix is omitted, the value is entered in hexadecimal. Select End address. When a prefix is omitted, the value is entered in hexadecimal. Click OK to change the coverage range. Specifying the Coverage Range with a Source File Select File and enter source file (.c or.cpp) in the current project. Functions in the specified file can be set as the coverage range. If the file type is omitted,.c is added. [Nevertheless, the file type must be either.c or.cpp.] A placeholder or Browse button is available. Click OK to change the coverage range. Specify Coverage Range

15 © 2008, Renesas Technology America, Inc., All Rights Reserved 15 Clearing Coverage Information Choose Clear Data from the pop-up menu to clear the acquired coverage information. Saving Coverage Information in a File Choose Save Data... from the pop-up menu to open the Save Data dialog box, which allows the user to save the coverage information in a file. Saving Coverage Data Dialog Box When File then Save Session menu options are selected, the Save Coverage Data dialog box appears, which allows the Coverage window data to be saved in a single file or in separate files. Clear/Save Coverage Information If you used a source file to specify the Coverage range, you won ’ t be able to save all Coverage windows in a single file.

16 © 2008, Renesas Technology America, Inc., All Rights Reserved 16 Loading Data The placeholder or Browse button can be used. Only.cov files can be loaded. If a file name extension other than.cov is specified, an error message is displayed. Updating Information Choose Refresh from the pop-up menu to update the Coverage window to the latest information. Stopping Updates Choose Lock Refresh from the pop-up menu to update Times and Pass only when program execution stops. Memory accesses to update instruction codes in the Coverage window are stopped. Load/Update Coverage Information

17 © 2008, Renesas Technology America, Inc., All Rights Reserved 17 Displaying Coverage Results Covered Not covered

18 © 2008, Renesas Technology America, Inc., All Rights Reserved 18 Specifying Coverage Range with Start and End Addresses Emulator Code Coverage Specifying Coverage Range with a Source File

19 © 2008, Renesas Technology America, Inc., All Rights Reserved 19 Emulator Data Coverage E_OVR Overwriting by the “eepmov.b” instruction E_WR Writing by the “eepmov.b” instruction E_ER Erasing by the “eepmov.b” instruction WR Writing to memory RD Reading memory Area Memory area (ROM, RAM, or EEPROM) Address Address value Data Data value Detail Detailed information per byte Information

20 © 2008, Renesas Technology America, Inc., All Rights Reserved 20 Coverage Analysis Guidelines 1.Set desired test coverage level (%) 2.Create and run test cases 3.Collect coverage information Verify results with test cases Performing debugging Obtain coverage data 4.Repeat process until target coverage level is achieved

21

22 © 2008, Renesas Technology America, Inc., All Rights Reserved 22 Purpose of coverage analysis Basic measurement concepts Setting up and operating HEW Coverage utility Coverage analysis guidelines Course Summary Download a free evaluation copy of HEW at: www.renesas.com/hew


Download ppt "© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course describes Coverage, a utility that is used."

Similar presentations


Ads by Google