DSPRelated.com
Forums

printf

Started by GeForce October 22, 2000
 
----- Original Message -----
From: GeForce
To: c6x
Subject: printf

Hello list,
I have a problem with Code Composer.
when I do something like
 
int i;
for(i=0;i<10;i++)
    printf("Hello so many times\n");
 
it does show up in the stdout window.
but this
 
int i;
for(i=0;i<10;i++)
    printf("%d\n",i);
 
doesn't show up, why?
thanks.
 



Did you include the correct header files.
Otherwise printf sometimes seem to work, but other times causes problems --

/'^`\
( o o )
-=-=-=-=-=-=-=-=-=-=-=oOOO-=(_)=-OOOo=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Patrick


Hi,GeForce:
You may try the Code Composer Studio Tutorial lesson1 in CCS help.
Try to revise the program to yours and see if the printf works.



Hi, deng,
That's exactly what I did, the first program in the tutorial is
printf("Hello World");
I wanted to play a little bit with printf so I tried printf("%d\n",i);
of course including <stdio.h> it gave nothing on the output.
I have programmed C on the PC for years, so this quite baffled me.
not only that, the first time I ran the tutorial as it was written with
puts("Hello World");
it didn't show anything, printf("Hello World"); worked though.
I was wondering if this isn't a bug in CCS, what's the newest version by the
way?
Ge
Note, this exact program when run on the simulator on the command line gives
the correct output.
int i;
printf("%d\n",i);

[1]build
[2]load6x.exe hello.out
a lot of garbage here ;Copyleft and stuff
10 ----- Original Message -----
From: deng wei <>
To: <>
Sent: Tuesday, October 24, 2000 9:49 AM
Subject: Re: [c6x] printf > Hi,GeForce:
> You may try the Code Composer Studio Tutorial lesson1 in CCS help.
> Try to revise the program to yours and see if the printf works. > To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.egroups.com/group/c6x
>
> Other Groups: http://www.dsprelated.com >




Hi
You know, TI's compilers are extra intelligent.
You might have given "Maximum Optimsation" option while compliling. The compiler thinks that you are not doing any calculation with i and hence removes the statement.
So, you try compiling without any optimisation.
regards
arun
-----Original Message-----
From: GeForce [mailto:g...@hotmail.com]
Sent: Sunday, October 22, 2000 5:49 PM
To: c6x
Subject: [c6x] printf

 
----- Original Message -----
From: GeForce
To: c6x
Subject: printf

Hello list,
I have a problem with Code Composer.
when I do something like
 
int i;
for(i=0;i<10;i++)
    printf("Hello so many times\n");
 
it does show up in the stdout window.
but this
 
int i;
for(i=0;i<10;i++)
    printf("%d\n",i);
 
doesn't show up, why?
thanks.
 

To Join:  Send an email to c...@egroups.com

To Post:  Send an email to c...@egroups.com

To Leave: Send an email to c...@egroups.com

Archives: http://www.egroups.com/group/c6x

Other Groups: http://www.dsprelated.com




Hi! hmmm... I'm not sure why, but you could try this:

int i;
char mesg[10];
for (i=0;i<10;i++) {
sprintf(mesg,"%d\n",i);
printf(mesg);
}

On Sun, 22 Oct 2000, GeForce wrote:

>
> ----- Original Message -----
> From: GeForce
> To: c6x
> Subject: printf > Hello list,
> I have a problem with Code Composer.
> when I do something like
>
> int i;
> for(i=0;i<10;i++)
> printf("Hello so many times\n");
>
> it does show up in the stdout window.
> but this
>
> int i;
> for(i=0;i<10;i++)
> printf("%d\n",i);
>
> doesn't show up, why?
> thanks.




--- In , "GeForce" <geforce_256_ddr@h...> wrote:
>
> ----- Original Message -----
> From: GeForce
> To: c6x
> Subject: printf > Hello list,
> I have a problem with Code Composer.
> when I do something like
>
> int i;
> for(i=0;i<10;i++)
> printf("Hello so many times\n");
>
> it does show up in the stdout window.
> but this
>
> int i;
> for(i=0;i<10;i++)
> printf("%d\n",i);
>
> doesn't show up, why?
> thanks.

Have you got plenty of heap allocated? Theres a definite issue
(documented somewhere in the online help) with lack of heap causing
printf not to work.

- Eliot


Hi,GeForce:
Did you select the correct simulator?Which Endianness do you use,big or
little?
Try 6201 and see if it works.
Maybe you should change the endianness.
If all above doesn't work,I think you should re-install CCS.
Do not change the configuration,just select a simulator.
Finally,go to www.ti.com for help.

Regards

David.D.W

----- Original Message -----
From: GeForce <>
To: <>
Sent: Tuesday, October 24, 2000 9:03 PM
Subject: Re: [c6x] printf > Hi, deng,
> That's exactly what I did, the first program in the tutorial is
> printf("Hello World");
> I wanted to play a little bit with printf so I tried printf("%d\n",i);
> of course including <stdio.h> it gave nothing on the output.
> I have programmed C on the PC for years, so this quite baffled me.
> not only that, the first time I ran the tutorial as it was written with
> puts("Hello World");
> it didn't show anything, printf("Hello World"); worked though.
> I was wondering if this isn't a bug in CCS, what's the newest version by
the
> way?
> Ge
> Note, this exact program when run on the simulator on the command line
gives
> the correct output.
> int i;
> printf("%d\n",i);
>
> [1]build
> [2]load6x.exe hello.out
> a lot of garbage here ;Copyleft and stuff
> 10 > ----- Original Message -----
> From: deng wei <>
> To: <>
> Sent: Tuesday, October 24, 2000 9:49 AM
> Subject: Re: [c6x] printf > > Hi,GeForce:
> > You may try the Code Composer Studio Tutorial lesson1 in CCS help.
> > Try to revise the program to yours and see if the printf works.
> >
> >
> >
> >
> >
> > To Join: Send an email to
> >
> > To Post: Send an email to
> >
> > To Leave: Send an email to
> >
> > Archives: http://www.egroups.com/group/c6x
> >
> > Other Groups: http://www.dsprelated.com
> >
> >
> > To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.egroups.com/group/c6x
>
> Other Groups: http://www.dsprelated.com >



I tried this out on both the C62x and C64x simulator CCS release 1.2,
which is the latest and it works just fine. I used the tutorial example
under CCS and re-built the target. In addition puts also works fine.

I typed

int i;

for ( i = 0; i < 10; i++)
{
printf("i:%d, Hello World \n", i);
}

It did produce the outputs correctly. You may want to check the version of
CCS you are having.

Regards

Jagadeesh Sankaran

On Tue, 24 Oct 2000, deng wei wrote:

> Hi,GeForce:
> You may try the Code Composer Studio Tutorial lesson1 in CCS help.
> Try to revise the program to yours and see if the printf works. > To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.egroups.com/group/c6x
>
> Other Groups: http://www.dsprelated.com >


Hello GeForce,

I'm using the prinft statement in all my test code and this works fine.
This code is run in the simulator, but also with the emulator.
I use the JTAG XDS510 to access the C6202 CPU. Also for some
applications I've used the EVM6201 with the JTAG. I don's see any
problems using prinft's

Maybe you don't allocate enough memory as some one else suggested for
the printf functions.

Good luck,
Patrick

GeForce wrote:
>
> Hi, deng,
> That's exactly what I did, the first program in the tutorial is
> printf("Hello World");
> I wanted to play a little bit with printf so I tried printf("%d\n",i);
> of course including <stdio.h> it gave nothing on the output.
> I have programmed C on the PC for years, so this quite baffled me.
> not only that, the first time I ran the tutorial as it was written with
> puts("Hello World");
> it didn't show anything, printf("Hello World"); worked though.
> I was wondering if this isn't a bug in CCS, what's the newest version by the
> way?
> Ge
> Note, this exact program when run on the simulator on the command line gives
> the correct output.
> int i;
> printf("%d\n",i);
>
> [1]build
> [2]load6x.exe hello.out
> a lot of garbage here ;Copyleft and stuff
> 10
>
> ----- Original Message -----
> From: deng wei <>
> To: <>
> Sent: Tuesday, October 24, 2000 9:49 AM
> Subject: Re: [c6x] printf
>
> > Hi,GeForce:
> > You may try the Code Composer Studio Tutorial lesson1 in CCS help.
> > Try to revise the program to yours and see if the printf works.
> >
> >
> >
> >
> >
> > To Join: Send an email to
> >
> > To Post: Send an email to
> >
> > To Leave: Send an email to
> >
> > Archives: http://www.egroups.com/group/c6x
> >
> > Other Groups: http://www.dsprelated.com
> >
> >
> >
>
> To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.egroups.com/group/c6x
>
> Other Groups: http://www.dsprelated.com