DSPRelated.com
Forums

problem with using clock() and printf()

Started by unic...@yahoo.com February 14, 2011
Hi,all,
when use the following .cmd and .c files, and load the generated .out file, I encountered an error:
"Error: Error 0x0000000C/-2044 Error during: Register, Break Point, No breakpoint at 0x00006F60
Trouble Removing Breakpoint with the Action "Terminate Program Execution" at 0x6f60: Error 0x00000008/-1076 Error during: Break Point, Cannot set/verify breakpoint at 0x00006F60"

If the program runs, it can't go to the end. This problem has confused me for days. Any hints are welcome. Thank you in advance.

Evironment:
DM642, CCS3.3

CODE:
main.cmd
MEMORY
{
IRAM: org = 0h, len = 10000h
}
SECTIONS
{
.data :> IRAM
.text :> IRAM
.switch :> IRAM
.stack :> IRAM
.bss :> IRAM
.cinit :> IRAM
.far :> IRAM
.cio :> IRAM
.const :> IRAM
.sysmem :> IRAM
.tables :> IRAM
}

main.c

#include
#include
void main()
{
int j, a = 0;
clock_t start, finish;
double duration;
start = clock();
for (j = 0; j < 3; j++) {
a += 1;
}
finish = clock();
duration = (double)(finish -start) / CLOCKS_PER_SEC;
printf("%f\n", duration);
}

_____________________________________
unicogse,

On 2/13/2011 8:41 PM, u...@yahoo.com wrote:
>
> Hi,all,
> when use the following .cmd and .c files, and load the generated .out
> file, I encountered an error:
> "Error: Error 0x0000000C/-2044 Error during: Register, Break Point, No
> breakpoint at 0x00006F60
> Trouble Removing Breakpoint with the Action "Terminate Program
> Execution" at 0x6f60: Error 0x00000008/-1076 Error during: Break
> Point, Cannot set/verify breakpoint at 0x00006F60"
>

A few possibilities...
Your target is broken, CCS is not configured correctly, or your project
is not set up correctly. The following questions should help sort it out.
Q1. Have you compiled, loaded, and run a program correctly using this
target and emulator??
Q2. Does your project include rts6400.lib??
Check CCS 'Option->Customize->Program/Project/CIO' tab.
Q3. Is 'Do not Set CIO Breakpoint at Load' checked?? [it should NOT be]
Q4. Is 'Do Not Set End of Program Breakpoint at Load' checked?? [it
should NOT be]
Q5. Is 'Disable All Breakpoints When Loading New Programs' checked?? [it
should NOT be]
Open a memory window in CCS at location 0x00006F60 while connected to
the target.
Change the contents to 0xAAAAAAAA and refresh the window.
Q6. Does the window show 0xAAAAAAAA??
Change the contents to 0x55555555 and refresh the window.
Q7. Does the window show 0x55555555??

FYI-
The timing info will be misleading on an embedded system.
stdio on TI's embedded devices works something like this for each stdio
function [printf, time, etc]:
1. A hidden BP is set using special label when the program is loaded.
2. When the program is run, it halts at the BP.
3. CCS polls the target for run or halt. If the program is halted, CCS
checks the label in the symbol table.
4. If it is a stdio BP, CCS will read memory - I think it is the first
add after the BP. The add contains an opcode that indicates the course
of action.
5 Once CCS 'does its duty' according to the opcode, a run command is
issued to the target.
All of this makes stdio very s-l-o-w.

mikedunn
>
> If the program runs, it can't go to the end. This problem has confused
> me for days. Any hints are welcome. Thank you in advance.
>
> Evironment:
> DM642, CCS3.3
>
> CODE:
> main.cmd
> MEMORY
> {
> IRAM: org = 0h, len = 10000h
> }
>
> SECTIONS
> {
> .data :> IRAM
> .text :> IRAM
> .switch :> IRAM
> .stack :> IRAM
> .bss :> IRAM
> .cinit :> IRAM
> .far :> IRAM
> .cio :> IRAM
> .const :> IRAM
> .sysmem :> IRAM
> .tables :> IRAM
> }
>
> main.c
>
> #include
> #include void main()
> {
> int j, a = 0;
> clock_t start, finish;
> double duration;
> start = clock();
> for (j = 0; j < 3; j++) {
> a += 1;
> }
> finish = clock();
> duration = (double)(finish -start) / CLOCKS_PER_SEC;
> printf("%f\n", duration);
> }
unicogse,

A first place to look would be the address map of the chip.

in looking at SPRS200N.pdf ( the architecture document for the TMS320DM642 )
1) the IRAM is only 256k in size, not 10000h.
2) the address range where the errors are occurring (6F60h) is in a 'reserved'
area of the address map. I.E. there is no memory there.

What does your .map file say about the addresses of your executable code?

You might want to read

which discusses some considerations for the DM642.

I think, given my experience with DSPs, you will have to initialize the clock
before you can use it for timing.

BTW:
where did that 'clock()' come from?

Have you tried resetting the DSP
perhaps click 'run to main'
then single stepping the code to determine where things are going wrong?

BTW:
were there any errors/warning during the compile/link process?

R. Williams

---------- Original Message -----------
From: u...@yahoo.com
To: c...
Sent: Sun, 13 Feb 2011 21:41:49 -0500
Subject: [c6x] problem with using clock() and printf()

> Hi,all,
> when use the following .cmd and .c files, and load the generated .out
> file, I encountered an error: "Error: Error 0x0000000C/-2044 Error
> during: Register, Break Point, No breakpoint at 0x00006F60 Trouble
> Removing Breakpoint with the Action "Terminate Program Execution" at
> 0x6f60: Error 0x00000008/-1076 Error during: Break Point, Cannot
> set/verify breakpoint at 0x00006F60"
>
> If the program runs, it can't go to the end. This problem has confused
> me for days. Any hints are welcome. Thank you in advance.
>
> Evironment:
> DM642, CCS3.3
>
> CODE:
> main.cmd
> MEMORY
> {
> IRAM: org = 0h, len = 10000h
> }
>
> SECTIONS
> {
> .data :> IRAM
> .text :> IRAM
> .switch :> IRAM
> .stack :> IRAM
> .bss :> IRAM
> .cinit :> IRAM
> .far :> IRAM
> .cio :> IRAM
> .const :> IRAM
> .sysmem :> IRAM
> .tables :> IRAM
> }
>
> main.c
>
> #include
> #include void main()
> {
> int j, a = 0;
> clock_t start, finish;
> double duration;
> start = clock();
> for (j = 0; j < 3; j++) {
> a += 1;
> }
> finish = clock();
> duration = (double)(finish -start) / CLOCKS_PER_SEC;
> printf("%f\n", duration);
> }
------- End of Original Message -------

_____________________________________
Hi, Mikedunn

Here are the answers to the questions.

A few possibilities...
Your target is broken, CCS is not configured correctly, or your project
is not set up correctly. The following questions should help sort it out.
>no, this is not the problem.

Q1. Have you compiled, loaded, and run a program correctly using this
target and emulator??
>yes

Q2. Does your project include rts6400.lib??
Check CCS 'Option->Customize->Program/Project/CIO' tab.
>yes, I did.

Q3. Is 'Do not Set CIO Breakpoint at Load' checked?? [it should NOT be]
>No.

Q4. Is 'Do Not Set End of Program Breakpoint at Load' checked?? [it
should NOT be]
>No.

Q5. Is 'Disable All Breakpoints When Loading New Programs' checked?? [it
should NOT be]
>No.

Open a memory window in CCS at location 0x00006F60 while connected to
the target.
Change the contents to 0xAAAAAAAA and refresh the window.
Q6. Does the window show 0xAAAAAAAA??
>yes

Change the contents to 0x55555555 and refresh the window.
Q7. Does the window show 0x55555555??
>yes

_____________________________________
Hi, R. Williams

Thanks for your message.

I'm afraid the .cmd file has no problem.
10000h/400h = 64(KB) < 256KB

A first place to look would be the address map of the chip.

where did that 'clock()' come from?
>it's declared in time.h

BTW:
were there any errors/warning during the compile/link process?
>no, no more errors or warnings.

_____________________________________
Unicogse,

Sorry, I must have been asleep when I wrote that email.

R. Williams

---------- Original Message -----------
From: u...@yahoo.com
To: c...
Sent: Mon, 14 Feb 2011 23:48:02 -0500
Subject: [c6x] Re: problem with using clock() and printf()

> Hi, R. Williams
>
> Thanks for your message.
>
> I'm afraid the .cmd file has no problem.
> 10000h/400h = 64(KB) < 256KB
>
> A first place to look would be the address map of the chip.
>
> where did that 'clock()' come from?
> >it's declared in time.h
>
> BTW:
> were there any errors/warning during the compile/link process?
> >no, no more errors or warnings.
------- End of Original Message -------

_____________________________________
Unicog-

I could maybe help out here, but you cut your original text and some of the replies. Don't know why you did that.

If you can recreate the whole thread and post, I can see your original code and make some suggestions.

-Jeff

> Hi, Mikedunn
>
> Here are the answers to the questions.
>
> A few possibilities...
> Your target is broken, CCS is not configured correctly, or your project
> is not set up correctly. The following questions should help sort it out.
>>no, this is not the problem.
>
> Q1. Have you compiled, loaded, and run a program correctly using this
> target and emulator??
>>yes
>
> Q2. Does your project include rts6400.lib??
> Check CCS 'Option->Customize->Program/Project/CIO' tab.
>>yes, I did.
>
> Q3. Is 'Do not Set CIO Breakpoint at Load' checked?? [it should NOT be]
>>No.
>
> Q4. Is 'Do Not Set End of Program Breakpoint at Load' checked?? [it
> should NOT be]
>>No.
>
> Q5. Is 'Disable All Breakpoints When Loading New Programs' checked?? [it
> should NOT be]
>>No.
>
> Open a memory window in CCS at location 0x00006F60 while connected to
> the target.
> Change the contents to 0xAAAAAAAA and refresh the window.
> Q6. Does the window show 0xAAAAAAAA??
>>yes
>
> Change the contents to 0x55555555 and refresh the window.
> Q7. Does the window show 0x55555555??
>>yes
>

_____________________________________
unicogse and OTHERS,

Do NOT snip messages if you want assistance. It is important to maintain
the history. I deal in several problems a day and I cannot remember
details about each one - also, there are others who may have missed the
original message. Some of us are very busy professionals who donate time
to HELP EVERYONE LEARN and we do not have time to go back and research
the history. I took the time to write this so that it can be a learning
experience for you and others.

Please see my comments inline below.

mikedunn

On 2/14/2011 12:44 AM, mikedunn wrote:
> unicogse,
>
> On 2/13/2011 8:41 PM, u...@yahoo.com wrote:
>>
>> Hi,all,
>> when use the following .cmd and .c files, and load the generated .out
>> file, I encountered an error:
>> "Error: Error 0x0000000C/-2044 Error during: Register, Break Point,
>> No breakpoint at 0x00006F60
>> Trouble Removing Breakpoint with the Action "Terminate Program
>> Execution" at 0x6f60: Error 0x00000008/-1076 Error during: Break
>> Point, Cannot set/verify breakpoint at 0x00006F60"
>>
>
> A few possibilities...
> Your target is broken, CCS is not configured correctly, or your
> project is not set up correctly. The following questions should help
> sort it out.
> Q1. Have you compiled, loaded, and run a program correctly using this
> target and emulator??
> >yes
>
> Q2. Does your project include rts6400.lib??
> Check CCS 'Option->Customize->Program/Project/CIO' tab.
> >yes, I did.
>
> Q3. Is 'Do not Set CIO Breakpoint at Load' checked?? [it should NOT be]
> >No.
>
> Q4. Is 'Do Not Set End of Program Breakpoint at Load' checked?? [it
> should NOT be]
> >No.
>
> Q5. Is 'Disable All Breakpoints When Loading New Programs' checked?? [it
> should NOT be]
> >No.
>
> Open a memory window in CCS at location 0x00006F60 while connected to
> the target.
> Change the contents to 0xAAAAAAAA and refresh the window.
> Q6. Does the window show 0xAAAAAAAA??
> >yes
>
> Change the contents to 0x55555555 and refresh the window.
> Q7. Does the window show 0x55555555??
> >yes

This tells me that you hardware and emulator appear to be working. Your
original error message indicates that there was problems setting or
clearing a breakpoint. The simple exercise of reading and writing memory
proved that it can be done [setting a sw breakpoint [BP] involves
reading a memory location, saving the value, and writing a BP opcode
into the memory location. The issue is compounded by CCS "helping you"
when memory is displayed. If a location is known to have a BP, CCS shows
you the original location contents instead of the actual location contents.
My gut feeling is that there is a basic mistake that is being missed
somewhere.
Q1. What is your emulator's manufacturer name and model number??
Do the following with CCS up:
1. reset the DSP
2. load the program. I assume that you will get a failure at 0x00006F60.
3. open the disassembly window if it is not open.
4. goto address 0x00006000 and highlight from there to 0x000070000.
right click the highlighted block, select copy. then paste it into your
reply.
5. open a memory window at 0x00006F60.
6. open a second memory window at 0x00046F60. I'm not sure if this will
work-some c6x devices will 'mirror' the memory contents of internal
memory. If this works, I expect all locations to be the same EXCEPT for
0x00006F60 & 0x00046F60. If this is true, copy the contents of
0x00046F60 and paste in your reply.

mikedunn
>
> FYI-
> The timing info will be misleading on an embedded system.
> stdio on TI's embedded devices works something like this for each
> stdio function [printf, time, etc]:
> 1. A hidden BP is set using special label when the program is loaded.
> 2. When the program is run, it halts at the BP.
> 3. CCS polls the target for run or halt. If the program is halted, CCS
> checks the label in the symbol table.
> 4. If it is a stdio BP, CCS will read memory - I think it is the first
> add after the BP. The add contains an opcode that indicates the course
> of action.
> 5 Once CCS 'does its duty' according to the opcode, a run command is
> issued to the target.
> All of this makes stdio very s-l-o-w.
>
> mikedunn
>>
>> If the program runs, it can't go to the end. This problem has
>> confused me for days. Any hints are welcome. Thank you in advance.
>>
>> Evironment:
>> DM642, CCS3.3
>>
>> CODE:
>> main.cmd
>> MEMORY
>> {
>> IRAM: org = 0h, len = 10000h
>> }
>>
>> SECTIONS
>> {
>> .data :> IRAM
>> .text :> IRAM
>> .switch :> IRAM
>> .stack :> IRAM
>> .bss :> IRAM
>> .cinit :> IRAM
>> .far :> IRAM
>> .cio :> IRAM
>> .const :> IRAM
>> .sysmem :> IRAM
>> .tables :> IRAM
>> }
>>
>> main.c
>>
>> #include
>> #include
>>
>> void main()
>> {
>> int j, a = 0;
>> clock_t start, finish;
>> double duration;
>> start = clock();
>> for (j = 0; j < 3; j++) {
>> a += 1;
>> }
>> finish = clock();
>> duration = (double)(finish -start) / CLOCKS_PER_SEC;
>> printf("%f\n", duration);
>> }
Unicogse,

Q: does the project have any optimization turned on in the compiler/linker?
sequence.
If optimization is turned on...
Then the declaration of 'a' and the line a += 1;
will be eliminated due to 'a' not being used after the loop
Then the loop will be empty
Then the loop may (depending on the optimization level) be eliminated.
Then the code is
call clock twice in a row
take the difference between the two calls (which may be 0 or very close to 0)
Then divide that very small number by a relatively large number CLOCK_PER_SECOND

The result may be unprintable with your current %f format factor.
It seems that any of these factors could result in the program initiating a math
exception (and the resulting interrupt being executed)
Your code has no interrupt event handler for the indicated interrupt.
All the above is just a guess, but is worth giving some thought toward.

In a prior post, I ask if you have single stepped through the program to
determine when/where the instruction pointer steps into the weeds.
have you done that operation?

R. Williams
---------- Original Message -----------
From: mikedunn
To: u...@yahoo.com
Cc: c...
Sent: Tue, 15 Feb 2011 17:35:58 -0600
Subject: Re: [c6x] problem with using clock() and printf()

> unicogse and OTHERS,
>
> Do NOT snip messages if you want assistance. It is important to
> maintain the history. I deal in several problems a day and I cannot
> remember details about each one - also, there are others who may have
> missed the original message. Some of us are very busy professionals
> who donate time to HELP EVERYONE LEARN and we do not have time to go
> back and research the history. I took the time to write this so that
> it can be a learning experience for you and others.
>
> Please see my comments inline below.
>
> mikedunn
>
> On 2/14/2011 12:44 AM, mikedunn wrote:
> > unicogse,
> >
> > On 2/13/2011 8:41 PM, u...@yahoo.com wrote:
> >>
> >> Hi,all,
> >> when use the following .cmd and .c files, and load the generated .out
> >> file, I encountered an error:
> >> "Error: Error 0x0000000C/-2044 Error during: Register, Break Point,
> >> No breakpoint at 0x00006F60
> >> Trouble Removing Breakpoint with the Action "Terminate Program
> >> Execution" at 0x6f60: Error 0x00000008/-1076 Error during: Break
> >> Point, Cannot set/verify breakpoint at 0x00006F60"
> >>
> >
> > A few possibilities...
> > Your target is broken, CCS is not configured correctly, or your
> > project is not set up correctly. The following questions should help
> > sort it out.
> > Q1. Have you compiled, loaded, and run a program correctly using this
> > target and emulator??
> > >yes
> >
> > Q2. Does your project include rts6400.lib??
> > Check CCS 'Option->Customize->Program/Project/CIO' tab.
> > >yes, I did.
> >
> > Q3. Is 'Do not Set CIO Breakpoint at Load' checked?? [it should NOT be]
> > >No.
> >
> > Q4. Is 'Do Not Set End of Program Breakpoint at Load' checked?? [it
> > should NOT be]
> > >No.
> >
> > Q5. Is 'Disable All Breakpoints When Loading New Programs' checked?? [it
> > should NOT be]
> > >No.
> >
> > Open a memory window in CCS at location 0x00006F60 while connected to
> > the target.
> > Change the contents to 0xAAAAAAAA and refresh the window.
> > Q6. Does the window show 0xAAAAAAAA??
> > >yes
> >
> > Change the contents to 0x55555555 and refresh the window.
> > Q7. Does the window show 0x55555555??
> > >yes
>
> This tells me that you hardware and emulator appear to be working.
> Your original error message indicates that there was problems setting
> or clearing a breakpoint. The simple exercise of reading and writing
> memory proved that it can be done [setting a sw breakpoint [BP]
> involves reading a memory location, saving the value, and writing a BP
> opcode into the memory location. The issue is compounded by CCS
> "helping you" when memory is displayed. If a location is known to have
> a BP, CCS shows you the original location contents instead of the
> actual location contents. My gut feeling is that there is a basic
> mistake that is being missed somewhere. Q1. What is your emulator's
> manufacturer name and model number?? Do the following with CCS up:
> 1. reset the DSP
> 2. load the program. I assume that you will get a failure at 0x00006F60.
> 3. open the disassembly window if it is not open.
> 4. goto address 0x00006000 and highlight from there to 0x000070000.
> right click the highlighted block, select copy. then paste it into
> your reply.
> 5. open a memory window at 0x00006F60.
> 6. open a second memory window at 0x00046F60. I'm not sure if this
> will work-some c6x devices will 'mirror' the memory contents of
> internal memory. If this works, I expect all locations to be the same
> EXCEPT for 0x00006F60 & 0x00046F60. If this is true, copy the contents
> of 0x00046F60 and paste in your reply.
>
> mikedunn
> >
> > FYI-
> > The timing info will be misleading on an embedded system.
> > stdio on TI's embedded devices works something like this for each
> > stdio function [printf, time, etc]:
> > 1. A hidden BP is set using special label when the program is loaded.
> > 2. When the program is run, it halts at the BP.
> > 3. CCS polls the target for run or halt. If the program is halted, CCS
> > checks the label in the symbol table.
> > 4. If it is a stdio BP, CCS will read memory - I think it is the first
> > add after the BP. The add contains an opcode that indicates the course
> > of action.
> > 5 Once CCS 'does its duty' according to the opcode, a run command is
> > issued to the target.
> > All of this makes stdio very s-l-o-w.
> >
> > mikedunn
> >
> >
> >>
> >> If the program runs, it can't go to the end. This problem has
> >> confused me for days. Any hints are welcome. Thank you in advance.
> >>
> >> Evironment:
> >> DM642, CCS3.3
> >>
> >> CODE:
> >> main.cmd
> >> MEMORY
> >> {
> >> IRAM: org = 0h, len = 10000h
> >> }
> >>
> >> SECTIONS
> >> {
> >> .data :> IRAM
> >> .text :> IRAM
> >> .switch :> IRAM
> >> .stack :> IRAM
> >> .bss :> IRAM
> >> .cinit :> IRAM
> >> .far :> IRAM
> >> .cio :> IRAM
> >> .const :> IRAM
> >> .sysmem :> IRAM
> >> .tables :> IRAM
> >> }
> >>
> >> main.c
> >>
> >> #include
> >> #include
> >>
> >> void main()
> >> {
> >> int j, a = 0;
> >> clock_t start, finish;
> >> double duration;
> >> start = clock();
> >> for (j = 0; j < 3; j++) {
> >> a += 1;
> >> }
> >> finish = clock();
> >> duration = (double)(finish -start) / CLOCKS_PER_SEC;
> >> printf("%f\n", duration);
> >> }
> >>
> >>
------- End of Original Message -------
uni

_____________________________________
Mikedunn and Jeff,

I'm sorry I snipped the message. Thank you for helping me.
Step 1:
1, I compile the program.
2, reset the CPU by DEBUG-->RESET CPU. 
3, load the program. 
At this time, everything looks good.  4. Run. CCS issue an error: Error: Error
0x0000000C/-2044 Error during: Register, Break Point,  No breakpoint at
0x00006F00. At this moment I can't halt the program.
Step 2:
I repet 2 and 3 of Step 1, at this time, CCS gives the following message.
Error: Error 0x0000000C/-2044 Error during: Register, Break Point,  No
breakpoint at 0x00006F00 

Trouble Removing Breakpoint with the Action "Terminate Program Execution" at
0x6f00: Error 0x00000008/-1076 Error during: Break Point,  Cannot set/verify
breakpoint at 0x00006F00 
There was a suprise, I don't whether this is solution to the problem. I changed
the stack size from 400h to 500 h,  there were no errors, and it halted at a s/w
breakpoint if I run the program. Some information from disassembly window is
shown as bellow.
00006F00          abort, C$$EXIT:
00006F00 00000000            NOP          
00006F04 0001A120            BNOP.S1       0x6F04 (PC+4 = 0x00006f04),5
00006F08 00000000            NOP          
00006F0C 00000000            NOP          
00006F10 00000000            NOP          
00006F14 00000000            NOP          
00006F18 00000000            NOP          
00006F1C 00000000            NOP

Here are the answers to your questions.

Q1. What is your emulator's manufacturer name and model number??
> XDS 510, USB2.0 TI dsp emulator.

Do the following with CCS up:
1. reset the DSP
2. load the program. I assume that you will get a failure at 0x00006F60.
3. open the disassembly window if it is not open.
4. goto address 0x00006000 and highlight from there to 0x000070000. right click
the highlighted block, select copy. then paste it into your reply.
>00006F00          abort, C$$EXIT:
00006F00 00000000            NOP          
00006F04 0001A120            BNOP.S1       0x6F04 (PC+4 = 0x00006f04),5
00006F08 00000000            NOP          
00006F0C 00000000            NOP          
00006F10 00000000            NOP          
00006F14 00000000            NOP          
00006F18 00000000            NOP          
00006F1C 00000000            NOP          
00006F20          clock:
00006F20 0FFDD010            B.S1          HOSTclock (PC-4480 = 0x00005da0)
00006F24 00008000            NOP           5
00006F28 00000000            NOP          
00006F2C 00000000            NOP          
00006F30 00000000            NOP          
00006F34 00000000            NOP          
00006F38 00000000            NOP          
00006F3C 00000000            NOP          
00006F40          remove:
00006F40 0FFF8810            B.S1          unlink (PC-960 = 0x00006b80)
00006F44 00008000            NOP           5
00006F48 00000000            NOP          
00006F4C 00000000            NOP          
00006F50 00000000            NOP          
00006F54 00000000            NOP          
00006F58 00000000            NOP          
00006F5C 00000000            NOP          
00006F60          etext, __etext, _stack:
00006F60 00000001            NOP          
00006F64 00000000 ||         NOP          
00006F68 30303030     [!B0]  MPY2.M1X      A1,B12,A1:A0
00006F6C 30303030     [!B0]  MPY2.M1X      A1,B12,A1:A0
00006F70 00000030            MPY2.M1       A0,A0,A1:A0
00006F74 00000000            NOP          
00006F78 00000000            NOP          
00006F7C 00000000            NOP          
00006F80 222834E6     [ B0]  LDW.D2T2      *B10--[1],B4
00006F84 00004000            NOP           3
00006F88 022808F0            OR.D1         0,A10,A4
00006F8C 00100362            B.S2          B4
00006F90 01858162            ADDKPC.S2     0x6F94 (PC+20 = 0x00006f94),B3,4
00006F94 002C29C0            SUB.D1        A11,0x1,A0
00006F98 C0000110     [ A0]  B.S1          0x6F88 (PC+8 = 0x00006f88)
00006F9C 05AC29C1            SUB.D1        A11,0x1,A11
00006FA0 C22834E6 ||  [ A0]  LDW.D2T2      *B10--[1],B4
00006FA4 D205B26E     [!A0]  LDW.D2T2      *+B14[1458],B4
00006FA8 00004000            NOP           3
00006FAC 022808F0            OR.D1         0,A10,A4
00006FB0 00002000            NOP           2
00006FB4 021042E6            LDW.D2T2      *+B4[2],B4
00006FB8 00006000            NOP           4
00006FBC 00100362            B.S2          B4
00006FC0 02878E6E            LDW.D2T2      *+B14[1934],B5
00006FC4 00002000            NOP           2
00006FC8 020ECC2A            MVK.S2        0x1d98,B4
00006FCC 02388842            ADD.D2        DP,B4,B4
00006FD0 021488C2            SUB.D2        B5,B4,B4
00006FD4 02104DA2            SHR.S2        B4,0x2,B4
00006FD8 00100ADA            CMPLT.L2      0,B4,B0
00006FDC 30000D90     [!B0]  B.S1          0x702C (PC+108 = 0x0000702c)
00006FE0 053C94F6            STW.D2T2      B10,*SP--[4]
00006FE4 053C23C4            STDW.D2T1     A11:A10,*+SP[1]
00006FE8 051006A1            OR.S1         0,A4,A10
00006FEC 0517805B ||         SUB.L2        B5,4,B10
00006FF0 068C06A3 ||         OR.S2         0,B3,B13
00006FF4 06BC22F7 ||         STW.D2T2      B13,*+SP[1]
00006FF8 059018F0 ||         OR.D1X        0,B4,A11
00006FFC 3205B26E     [!B0]  LDW.D2T2      *+B14[1458],B4
00007000 00000000            NOP

5. open a memory window at 0x00006F60.
6. open a second memory window at 0x00046F60. I'm not sure if this will
work-some c6x devices will 'mirror' the memory contents of internal memory. If
this works, I expect all locations to be the same EXCEPT for 0x00006F60 &
0x00046F60. If this is true, copy the contents of 0x00046F60 and paste in your
reply.
>
0x00006F00 abort, C$$EXIT 
0x00006F00 0x00000000 0x0001A120
0x00006F08 0x00000000 0x00000000
0x00006F10 0x00000000 0x00000000
0x00006F18 0x00000000 0x00000000
0x00006F20 clock 
0x00006F20 0x0FFDD010 0x00008000
0x00006F28 0x00000000 0x00000000
0x00046F00 -------- --------
0x00046F08 -------- --------
0x00046F10 -------- --------
0x00046F18 -------- --------
0x00046F20 -------- --------
0x00046F28 -------- --------
0x00046F30 -------- --------

________________________________
From: mikedunn
To: u...@yahoo.com
Cc: c...
Sent: Wed, February 16, 2011 7:35:58 AM
Subject: Re: [c6x] problem with using clock() and printf()

unicogse and OTHERS,

Do NOT snip messages if you want assistance. It is important to maintain the
history. I deal in several problems a day and I cannot remember details about
each one - also, there are others who may have missed the original message. Some
of us are very busy professionals who donate time to HELP EVERYONE LEARN and we
do not have time to go back and research the history. I took the time to write
this so that it can be a learning experience for you and others.

Please see my comments inline below.

mikedunn

On 2/14/2011 12:44 AM, mikedunn wrote:
unicogse,
>
>On 2/13/2011 8:41 PM, u...@yahoo.com wrote:

>>Hi,all,
>>when use the following .cmd and .c files, and load the generated .out file, I
>>encountered an error:
>>"Error: Error 0x0000000C/-2044 Error during: Register, Break Point, No
>>breakpoint at 0x00006F60
>>Trouble Removing Breakpoint with the Action "Terminate Program Execution" at
>>0x6f60: Error 0x00000008/-1076 Error during: Break Point, Cannot set/verify
>>breakpoint at 0x00006F60"
>>
A few possibilities...
Your target is broken, CCS is not configured correctly, or your project is not
set up correctly. The following questions should help sort it out.
Q1. Have you compiled, loaded, and run a program correctly using this
target and emulator??
>yes

Q2. Does your project include rts6400.lib??
Check CCS 'Option->Customize->Program/Project/CIO' tab.
>yes, I did.

Q3. Is 'Do not Set CIO Breakpoint at Load' checked?? [it should NOT be]
>No.

Q4. Is 'Do Not Set End of Program Breakpoint at Load' checked?? [it
should NOT be]
>No.

Q5. Is 'Disable All Breakpoints When Loading New Programs' checked?? [it
should NOT be]
>No.

Open a memory window in CCS at location 0x00006F60 while connected to
the target.
Change the contents to 0xAAAAAAAA and refresh the window.
Q6. Does the window show 0xAAAAAAAA??
>yes

Change the contents to 0x55555555 and refresh the window.
Q7. Does the window show 0x55555555??
>yes

This tells me that you hardware and emulator appear to be working. Your original
error message indicates that there was problems setting or clearing a
breakpoint. The simple exercise of reading and writing memory proved that it can
be done [setting a sw breakpoint [BP] involves reading a memory location, saving
the value, and writing a BP opcode into the memory location. The issue is
compounded by CCS "helping you" when memory is displayed. If a location is known
to have a BP, CCS shows you the original location contents instead of the actual
location contents.
My gut feeling is that there is a basic mistake that is being missed somewhere.
Q1. What is your emulator's manufacturer name and model number??
Do the following with CCS up:
1. reset the DSP
2. load the program. I assume that you will get a failure at 0x00006F60.
3. open the disassembly window if it is not open.
4. goto address 0x00006000 and highlight from there to 0x000070000. right click
the highlighted block, select copy. then paste it into your reply.
5. open a memory window at 0x00006F60.
6. open a second memory window at 0x00046F60. I'm not sure if this will
work-some c6x devices will 'mirror' the memory contents of internal memory. If
this works, I expect all locations to be the same EXCEPT for 0x00006F60 &
0x00046F60. If this is true, copy the contents of 0x00046F60 and paste in your
reply.

mikedunn
>FYI-
>The timing info will be misleading on an embedded system.
>stdio on TI's embedded devices works something like this for each stdio function
>[printf, time, etc]:
>1. A hidden BP is set using special label when the program is loaded.
>2. When the program is run, it halts at the BP.
>3. CCS polls the target for run or halt. If the program is halted, CCS checks
>the label in the symbol table.
>4. If it is a stdio BP, CCS will read memory - I think it is the first add after
>the BP. The add contains an opcode that indicates the course of action.
>5 Once CCS 'does its duty' according to the opcode, a run command is issued to
>the target.
>All of this makes stdio very s-l-o-w.
>
>mikedunn
>>If the program runs, it can't go to the end. This problem has confused me for
>>days. Any hints are welcome. Thank you in advance.
>>
>>Evironment:
>>DM642, CCS3.3
>>
>>CODE:
>>main.cmd
>>MEMORY
>>{
>>IRAM: org = 0h, len = 10000h
>>}
>>
>>SECTIONS
>>{
>>.data :> IRAM
>>.text :> IRAM
>>.switch :> IRAM
>>.stack :> IRAM
>>.bss :> IRAM
>>.cinit :> IRAM
>>.far :> IRAM
>>.cio :> IRAM
>>.const :> IRAM
>>.sysmem :> IRAM
>>.tables :> IRAM
>>}
>>
>>main.c
>>
>>#include
>>#include
>>
>>void main()
>>{
>>int j, a = 0;
>>clock_t start, finish;
>>double duration;
>>start = clock();
>>for (j = 0; j < 3; j++) {
>>a += 1;
>>}
>>finish = clock();
>>duration = (double)(finish -start) / CLOCKS_PER_SEC;
>>printf("%f\n", duration);
>>}