EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

printf function with JTAG interface in Emulator mode

Started by diptipanchal April 17, 2008
We have used MSP-FET430UIF debug interface.

When the code is executed in emulator debugger mode, the data is put on
terminal I/O window with printf.
It was observed that target get stopped before printing all the data. for
example, code is written to print 200 array data but it prints only 20 or 30
data & no. of data gets printed is not fixed.

Could you suggest what should be the project setting to print all 200 array
data.
Is there any limitation of printing data through JTAG? Initially, when the
code was executed, it was giving error as "The stack pointer for stack
'Stack' is outside the stack range ". Then i have increased the stack memory
size.Then the stack eror has gone but still the problem persists !!!

thanks
Dipti

--

Beginning Microcontrollers with the MSP430

Dipti,

I have an open case with TI in this area. I assume that you are using
CCE. There appears to be a problem with the rts430.lib routines. What
I have determined is that printf or fprintf or sprintf do not work
properly without an alphabetic character as the first character of the
format string. If it is a number or other alphanumeric character you
may get part of the result or nothing. This may be what is happening to
you.

It is either an rts430 problem or I have something setup wrong. I do
know that I have enough stack space and heap space. I bought an
msp430f2619 just to be sure. I gave it 1024 stack and 2048 heap. Same
issues as with an F169.

When a solution emerges I will keep you posted.

Hope this helps,

Frank

diptipanchal wrote:
> We have used MSP-FET430UIF debug interface.
>
> When the code is executed in emulator debugger mode, the data is put on
> terminal I/O window with printf.
> It was observed that target get stopped before printing all the data. for
> example, code is written to print 200 array data but it prints only 20
> or 30
> data & no. of data gets printed is not fixed.
>
> Could you suggest what should be the project setting to print all 200
> array
> data.
> Is there any limitation of printing data through JTAG? Initially, when the
> code was executed, it was giving error as "The stack pointer for stack
> 'Stack' is outside the stack range ". Then i have increased the stack
> memory
> size.Then the stack eror has gone but still the problem persists !!!
>
> thanks
> Dipti
>
> --
>
>
>

On Thu, Apr 17, 2008 at 12:09 AM, diptipanchal wrote:
> [...]
> When the code is executed in emulator debugger mode, the data is put on
> terminal I/O window with printf.
> It was observed that target get stopped before printing all the data. for
> [...]
> Is there any limitation of printing data through JTAG? Initially, when the
> code was executed, it was giving error as "The stack pointer for stack
> 'Stack' is outside the stack range ". Then i have increased the stack
> memory
> size.Then the stack eror has gone but still the problem persists !!!

You don't mention what toolchain you're using.

However, if you are using IAR, I have a hunch that their low-level I/O
functions are not very robust in the face of an environment with
complex/active interrupt usage.

Yesterday, I had very similar behaviours: stack runaway, "target stopped"
and odd hangs (always during I/O) - I did two things: switched to buffered
I/O and disabled interrupts before my debug I/O, then re-enabled them after
(since doing printf() has already trashed my real-time behaviour) - not a single
crash since.

My environment has me fielding timer ticks at 2uS intervals, and enabling
interrupts in another ISR to permit the timer to keep ticking, but all
my printf()
calls were in a foreground loop, and they still managed to crash the
system.

It _could_ be that all I've done is change the timing to mask a bug, but
my gut says not, and for me IAR's terminal I/O functions are now going to
have to prove themselves bug-free while interrupts are very active.
--
Andy

I am using IAR tool for MSP430F2350.

I have tried below code to simulate the problem of printf function
through JTAG without I/O configured & interrupt. When this code is
executed in FET debugger mode, it print the array data upto 13 (this
printing value is not fixed, sometimes it prints 9 also) then again it
prints again the value from 0 to 13 then suddenly the target stops.

Actually printing of data is inconsistent since target stops executing
suddenly.

I have query in this,

* Why this program does not print all 20 data of the array?
* Why target stops suddenly?

Is there any other method to print the data on Terminal I/O window?

My application requires the data from MSP430 to print on terminal I/O
for analysis purpose. Kindly suggest what could be the method to achieve
this?

*****************CODE**************************************************

void main()

{

int sum[20];

int a=0x12,b=0x34,c=0x05;

int i=0;

for (i=0;i<20;i++) {

sum[i]=a+b+c;

c++;

}

for (i=0;i<20;i++)

printf ("%d\n",sum[i]);

}

*****************END**************************************************

Thanks & Regards,

Dipti

________________________________

From: m... [mailto:m...] On Behalf
Of Andy Warner
Sent: Thursday, April 17, 2008 8:46 PM
To: m...
Subject: Re: [msp430] printf function with JTAG interface in Emulator
mode

On Thu, Apr 17, 2008 at 12:09 AM, diptipanchal > wrote:
> [...]
> When the code is executed in emulator debugger mode, the data is put
on
> terminal I/O window with printf.
> It was observed that target get stopped before printing all the data.
for
> [...]
> Is there any limitation of printing data through JTAG? Initially, when
the
> code was executed, it was giving error as "The stack pointer for stack
> 'Stack' is outside the stack range ". Then i have increased the stack
> memory
> size.Then the stack eror has gone but still the problem persists !!!

You don't mention what toolchain you're using.

However, if you are using IAR, I have a hunch that their low-level I/O
functions are not very robust in the face of an environment with
complex/active interrupt usage.

Yesterday, I had very similar behaviours: stack runaway, "target
stopped"
and odd hangs (always during I/O) - I did two things: switched to
buffered
I/O and disabled interrupts before my debug I/O, then re-enabled them
after
(since doing printf() has already trashed my real-time behaviour) - not
a single
crash since.

My environment has me fielding timer ticks at 2uS intervals, and
enabling
interrupts in another ISR to permit the timer to keep ticking, but all
my printf()
calls were in a foreground loop, and they still managed to crash the
system.

It _could_ be that all I've done is change the timing to mask a bug, but
my gut says not, and for me IAR's terminal I/O functions are now going
to
have to prove themselves bug-free while interrupts are very active.
--
Andy


This seems to work.
//==================================#include "stdio.h"
void main( void )
{
char i;
WDTCTL = WDTPW + WDTHOLD;
while (1)
{
char *msg = "Hello World!\n";
while (*msg!=0) putchar(*msg++);
for (i='0'; i<='9'; i++) putchar(i);
putchar(0x0A);
for (i='A'; i<='Z'; i++) putchar(i);
putchar(0x0A);
for (i='a'; i<='z'; i++) putchar(i);
putchar(0x0A);
}
}
//=====================================--- In m..., wrote:
>
> I am using IAR tool for MSP430F2350.
>
>
>
> I have tried below code to simulate the problem of printf function
> through JTAG without I/O configured & interrupt. When this code is
> executed in FET debugger mode, it print the array data upto 13 (this
> printing value is not fixed, sometimes it prints 9 also) then again it
> prints again the value from 0 to 13 then suddenly the target stops.
>
> Actually printing of data is inconsistent since target stops executing
> suddenly.
>
>
>
> I have query in this,
>
>
>
> * Why this program does not print all 20 data of the array?
> * Why target stops suddenly?
>
>
>
> Is there any other method to print the data on Terminal I/O window?
>
>
>
> My application requires the data from MSP430 to print on terminal I/O
> for analysis purpose. Kindly suggest what could be the method to achieve
> this?
>
> *****************CODE**************************************************
>
> void main()
>
> {
>
> int sum[20];
>
> int a=0x12,b=0x34,c=0x05;
>
> int i=0;
>
>
>
> for (i=0;i<20;i++) {
>
> sum[i]=a+b+c;
>
> c++;
>
> }
>
>
>
> for (i=0;i<20;i++)
>
> printf ("%d\n",sum[i]);
>
>
>
>
>
> }
>
> *****************END**************************************************
>
>
>
> Thanks & Regards,
>
> Dipti
>
>
> ________________________________
>
> From: m... [mailto:m...] On Behalf
> Of Andy Warner
> Sent: Thursday, April 17, 2008 8:46 PM
> To: m...
> Subject: Re: [msp430] printf function with JTAG interface in Emulator
> mode
>
>
>
> On Thu, Apr 17, 2008 at 12:09 AM, diptipanchal > > wrote:
> > [...]
> > When the code is executed in emulator debugger mode, the data is put
> on
> > terminal I/O window with printf.
> > It was observed that target get stopped before printing all the data.
> for
> > [...]
> > Is there any limitation of printing data through JTAG? Initially, when
> the
> > code was executed, it was giving error as "The stack pointer for stack
> > 'Stack' is outside the stack range ". Then i have increased the stack
> > memory
> > size.Then the stack eror has gone but still the problem persists !!!
>
> You don't mention what toolchain you're using.
>
> However, if you are using IAR, I have a hunch that their low-level I/O
> functions are not very robust in the face of an environment with
> complex/active interrupt usage.
>
> Yesterday, I had very similar behaviours: stack runaway, "target
> stopped"
> and odd hangs (always during I/O) - I did two things: switched to
> buffered
> I/O and disabled interrupts before my debug I/O, then re-enabled them
> after
> (since doing printf() has already trashed my real-time behaviour) - not
> a single
> crash since.
>
> My environment has me fielding timer ticks at 2uS intervals, and
> enabling
> interrupts in another ISR to permit the timer to keep ticking, but all
> my printf()
> calls were in a foreground loop, and they still managed to crash the
> system.
>
> It _could_ be that all I've done is change the timing to mask a bug, but
> my gut says not, and for me IAR's terminal I/O functions are now going
> to
> have to prove themselves bug-free while interrupts are very active.
> --
> Andy
>
>
>
>
>

I have executed this below code & this also gets stopped after some
time.

Result is as below:


--------

Hello World!

0123456789

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

Hello World!

0123456789

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

Hello World!

0123456789

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

Hello World!

0123456789

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqr

---

Dipti

________________________________

From: m... [mailto:m...] On Behalf
Of old_cow_yellow
Sent: Friday, April 18, 2008 11:32 AM
To: m...
Subject: [msp430] Re: printf function with JTAG interface in Emulator
mode

This seems to work.
//==================================#include "stdio.h"
void main( void )
{
char i;
WDTCTL = WDTPW + WDTHOLD;
while (1)
{
char *msg = "Hello World!\n";
while (*msg!=0) putchar(*msg++);
for (i='0'; i<='9'; i++) putchar(i);
putchar(0x0A);
for (i='A'; i<='Z'; i++) putchar(i);
putchar(0x0A);
for (i='a'; i<='z'; i++) putchar(i);
putchar(0x0A);
}
}
//=====================================--- In m... ,
wrote:
>
> I am using IAR tool for MSP430F2350.
>
> I have tried below code to simulate the problem of printf function
> through JTAG without I/O configured & interrupt. When this code is
> executed in FET debugger mode, it print the array data upto 13 (this
> printing value is not fixed, sometimes it prints 9 also) then again it
> prints again the value from 0 to 13 then suddenly the target stops.
>
> Actually printing of data is inconsistent since target stops executing
> suddenly.
>
> I have query in this,
>
> * Why this program does not print all 20 data of the array?
> * Why target stops suddenly?
>
> Is there any other method to print the data on Terminal I/O window?
>
> My application requires the data from MSP430 to print on terminal I/O
> for analysis purpose. Kindly suggest what could be the method to
achieve
> this?
*****************CODE**************************************************
>
> void main()
>
> {
>
> int sum[20];
>
> int a=0x12,b=0x34,c=0x05;
>
> int i=0;
>
> for (i=0;i<20;i++) {
>
> sum[i]=a+b+c;
>
> c++;
>
> }
>
> for (i=0;i<20;i++)
>
> printf ("%d\n",sum[i]);
>
> }
>
> *****************END**************************************************
>
> Thanks & Regards,
>
> Dipti
> ________________________________
>
> From: m...
[mailto:m... ] On
Behalf
> Of Andy Warner
> Sent: Thursday, April 17, 2008 8:46 PM
> To: m...
> Subject: Re: [msp430] printf function with JTAG interface in Emulator
> mode
>
> On Thu, Apr 17, 2008 at 12:09 AM, diptipanchal > > wrote:
> > [...]
> > When the code is executed in emulator debugger mode, the data is put
> on
> > terminal I/O window with printf.
> > It was observed that target get stopped before printing all the
data.
> for
> > [...]
> > Is there any limitation of printing data through JTAG? Initially,
when
> the
> > code was executed, it was giving error as "The stack pointer for
stack
> > 'Stack' is outside the stack range ". Then i have increased the
stack
> > memory
> > size.Then the stack eror has gone but still the problem persists !!!
>
> You don't mention what toolchain you're using.
>
> However, if you are using IAR, I have a hunch that their low-level I/O
> functions are not very robust in the face of an environment with
> complex/active interrupt usage.
>
> Yesterday, I had very similar behaviours: stack runaway, "target
> stopped"
> and odd hangs (always during I/O) - I did two things: switched to
> buffered
> I/O and disabled interrupts before my debug I/O, then re-enabled them
> after
> (since doing printf() has already trashed my real-time behaviour) -
not
> a single
> crash since.
>
> My environment has me fielding timer ticks at 2uS intervals, and
> enabling
> interrupts in another ISR to permit the timer to keep ticking, but all
> my printf()
> calls were in a foreground loop, and they still managed to crash the
> system.
>
> It _could_ be that all I've done is change the timing to mask a bug,
but
> my gut says not, and for me IAR's terminal I/O functions are now going
> to
> have to prove themselves bug-free while interrupts are very active.
> --
> Andy
>
>
>



The 2024 Embedded Online Conference