Lab D: C Optimization
Lab D: C Optimization
Objective
The objective of this lab is to practice and verify the mechanics of optimizing C programs. Using
Code Composer Studio profile capabilities, different routines in a project will be benchmarked.
This will allow you to analyze the performance of different functions. This lab will highlight the
profiler and the clock tools in CCS.
Procedure
Create Project File
1. Create a new project in
C:\C28x\Labs\Appendix\LabD
called
LabD.pjt
and
add
LabD.c
,
LabD.cmd
, and
sop-c.c
to it. (Note that
sop-asm.asm
will be used
in the next part of the lab, and should not be added now). Also, add the compiler run-
time support library to the project
(
C:\ti\c2000\cgtools\lib\rts2800_ml.lib)
.
2. Setup the Build Options. Select the Linker tab and in the middle of the screen select
“Run-time Autoinitialization”
under
“Autoinit Model:”
. Create a
map file by typing
.\Debug\LabD.map
in the
Map Filename [-m]
field.
Do
not
enter anything in the
“Code Entry Point (-e):”
field (
leave it blank
). Set
the stack size to 0x400. Next, select the Compiler tab. Note that
“Full Symbolic
Debug (-g)”
under
“Generate Debug Info:”
in the Basic Category is
selected. On the Feedback Category pull down the interlisting options and select
“C
and ASM (-ss)”
. On the Assembly Category check the
Keep generated .asm
Files (-k), Keep Labels as Symbols(-as)
and
Generate Assembly
Listing Files (-al)
. The –as will allow you to see symbols in the memory
window and the –al will generate an assembly listing file (.lst file). The listing file has
limited uses, but is sometime helpful to view opcode values and instruction sizes. (The
.lst file can be viewed with the editor). Both of these options will help with debugging.
Then select
OK to save the Build Options.
Build and Load
3.
Click the
“Rebuild All”
button and watch the tools run in the build window. Be
sure the
“Load program after build”
option is selected in Code Composer
Studio. The output file should automatically load. The Program Counter should be
pointing to _c_int00 in the Disassembly Window.
Set Up the Profile Session
4. Restart the DSP
(debug restart)
and then
“Go Main”
.
This will run
through the C initialization routine in
Boot.asm
and stop at the main routine in
LabD.c
.
5. Set a breakpoint on the NOP in the while(1) loop at the end of main() in
LabD.c
.
D- 14
C28x – C Programming
Summary of Contents for C28 Series
Page 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Page 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Page 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Page 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Page 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Page 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Page 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Page 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Page 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Page 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...