EasyManua.ls Logo

Texas Instruments C28 Series

Texas Instruments C28 Series
342 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Lab D: C Optimization
6. Set up the profile session by selecting Profiler Start New Session.
Enter a session name of your choice (i.e. LabD).
7. In the profiler window, hover the mouse over the icons on the left region of the window
and select the icon for Profile All Functions. Click on the “+” to expand the
functions. Record the “Code Size” of the function sop C code in the table at the end of
this lab. Note: If you do not see a “+” beside the .out file, press “Profile All Functions”
on the horizontal tool bar. (You can close the build window to make the profiler window
easier to view by right clicking on the build window and selecting “hide”).
8. Select F5 or the run icon. Observe the values present in the profiling window. What do
the numbers mean? Click on each tab to determine what each displays.
Benchmarking Code
9. Let’s benchmark (i.e.count the cycles need by) only a portion of the code. This requires
you to set a breakpoint pair on the starting and ending points of the benchmark. Open the
file sop-c.c and set a breakpoint on the “for” statement and the “return”
statement.
10. In CCS, select profiler enable clock (must be checked). Then select
profiler view clock.
11. Now Restart” the program and then “Run” the program. The program should be
stopped at the first breakpoint in sop. Double click on the clock window to set the clock
to zero. Now you are ready to benchmark the code. “Run” to the second breakpoint.
The number of cycles are displayed in the clock window. Record this value in the table
at the end of the lab under “C Code - Cycles”.
C Optimization
12. To optimize C code to the highest level, we must set up new Build Options for our
Project. Select the Compiler tab. In the Basic Category Panel, under “Opt Level”
select File (-o3). Then select OK to save the Build Options.
13. Now “Rebuild” the program and then “Run” the program. The program should be
stopped at the first breakpoint in sop. Double click on the clock window to set the clock
to zero. Now you are ready to benchmark the code. “Run” to the second breakpoint.
The number of cycles are displayed in the clock window. Record this value in the table
at the end of the lab under “Optimized C (-o3) - Cycles”.
14. Look in your profile window at the code size of sop. Record this value in the table at the
end of this lab.
Benchmarking Assembly Code
15. Remove sop-c.c from your project and replace it with sop-asm.asm. Rebuild and
set breakpoints at the beginning and end of the assembly code (MOVL & LRETR).
16. Start a new profile session and set it to profile all functions. Run to the first breakpoint
and study the profiler window. Record the code size of the assembly code in the table.
C28x – C Programming D - 15

Table of Contents

Other manuals for Texas Instruments C28 Series

Related product manuals