Other Parts Discussed in Thread: C2000WARE,
Tool/software: Code Composer Studio
Hi TI experts,
I am using CCS 8.2 and TI F28335 experimental kit for my project.
First of all, I play with the example code from C2000ware to see how many cycles it takes to do atan() with fastRTS.
The directory of the example is C:\ti\c2000\C2000Ware_1_00_05_00\libraries\math\FPUfastRTS\c28\examples.
I found that the atan() in line 140 takes 58 cycles. I did the count, by setting a break point before atan(), and see the difference of CPUTIMER/TIMER0TIM before and after pressing F5. (I am not sure if I can measure the cycles in this way.) The result is close to what it claims in SPRCA75 (51 cycles for atan).
However, when I try to do the same thing in my own project, I find that the atan takes 150 cycles, measured by repeating the above method.
I followed the instructions of enabling fastRTS, and set the linker order properly. I am pretty sure that it is using fastRTS instead of normal RTS. This is because, if I change the linker order to let normal RTS to be first, then it will step into atanf(float y, float x), when I press F5 over the line of atan(), and it takes even longer time. If I make the linker order right (fastRTS first), then it will not step into atanf(float y, float x), when I press F5. That means it is using fastRTS.
My map file is as follows. The atan() is in pll1.c. I have copied all functions in pll1.c to ram. So I can only see pll1.obj in ramFuncs part, not .text part.
ramFuncs 0 00305987 000011c3 RUN ADDR = 00009000
.....................
....................
003065a0 00000104 pll1.obj (ramFuncs)
.................
.text 0 0030000a 0000566d
...................
003046e1 0000012b rts2800_fpu32.lib : e_logf.c.obj (.text)
.......................
00304a47 00000110 rts2800_fpu32.lib : e_expf.c.obj (.text)
00304b57 00000107 : ll_div28.asm.obj (.text)
.........................
00304fa8 00000083 rts2800_fpu32.lib : fd_mpy28.asm.obj (.text)
......................
00305206 00000056 rts2800_fpu32.lib : boot28.asm.obj (.text)
0030525c 0000004f rts2800_fpu32_fast_supplement.lib : atan2_f32.obj (.text)
.......................
00305438 00000034 rts2800_fpu32_fast_supplement.lib : cos_f32.obj (.text)
0030546c 00000034 : sin_f32.obj (.text)
003054a0 0000002d ePwm.obj (.text:retain)
003054cd 0000002a rts2800_fpu32.lib : l_div28.asm.obj (.text)
003054f7 00000029 : exit.c.obj (.text)
00305520 00000024 : cpy_tbl.c.obj (.text)
00305544 00000021 rts2800_fpu32_fast_supplement.lib : sqrt_f32.obj (.text)
00305565 00000020 rts2800_fpu32.lib : ll_tofsfpu32.asm.obj (.text)
00305585 0000001f : fd_tol28.asm.obj (.text)
003055a4 0000001e : ll_cmp28.asm.obj (.text)
003055c2 0000001d : memcpy.c.obj (.text)
003055df 0000001c : fs_tofdfpu32.asm.obj (.text)
003055fb 00000019 : args_main.c.obj (.text)
00305614 00000019 rts2800_fpu32_fast_supplement.lib : div_f32.obj (.text)
0030562d 00000018 rts2800_fpu32.lib : strncmp.c.obj (.text)
00305645 00000013 canRW.obj (.text)
00305658 0000000b rts2800_fpu32.lib : u_div28.asm.obj (.text)
00305663 00000009 : _lock.c.obj (.text)
0030566c 00000008 CodeStartBranch.obj (.text)
00305674 00000002 rts2800_fpu32.lib : pre_init.c.obj (.text)
00305676 00000001 : startup.c.obj (.text)
Module code initialized data uninitialized data
------ ---- ---------------- ------------------
.\src\
.................................
pll1.obj 520 0 0
My questions are:
(1) Is it the right way to measure the cycles by looking at the difference of CPU timers?
(2) My own project is based on an old project which only uses fixed point IQmath, not floating point. I believe I have already turned on the floating point unit, as when I press F5 over the line of atan(), it will step into atanf(float y, float x).
I am just wondering what registers or setting I have missed that results in 150 cycles for atan. How should I do to check? I am willing to spend a few days to look into the reason and read some stuff.
Thank you in advance.