Sign in

username:

password:



Not a member?

Search c55x



Search tips

Subscribe to c55x



c55x by Keywords

AIC23 | C5509 | CCS | CSL | EMIF | EVM | GEL | GPIO | HPI | Interfacing | JTAG | McBSP | OMAP | Omap15 | OMAP59 | RTDX | SDRAM | TMS320VC5509 | USB | XDS5

Ads

Discussion Groups

Discussion Groups | TMS320C55x | LOG_printf problem

Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).

  

Post a new Thread

LOG_printf problem - muon...@aselsan.com.tr - Feb 13 10:17:23 2008



1. This works:

   char *myArr = "Hello";
   LOG_printf(&trc, "%s", myArr);

 but this does not:

   char myArr[128] = "Hello";
   LOG_printf(&trc, "%s", myArr);

 Does anybody know the logic behind this???

2. char *myArr;
   myArr = (char *) MEM_alloc(SEG0, 128*sizeof(char), 0);
   ...
   (after some calculations)
   ...
   printf("%s", myArr);  //This works
   LOG_printf(&trc, "%s", myArr); //This is giving an error message 
                                  //in LOG window: "*** ERROR: ..."

  why might printf work but LOG_printf does not, when inputs are same???

Thanks in advance..

Murat.

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

Re: LOG_printf problem - smee642003 - Feb 14 10:44:38 2008

The LOG subsystem does not actually store your string, only a pointer 
to the format string and the arguments.  The resultant formatted 
string isn't created until you ask CCS to display it.  The reason why 
it doesn't work is because you are passing a pointer to a stack 
location which is not valid outside of the context of the routine 
making the call.  In other words, any subsequent function calls (or 
possibly interrupts, depending on which stack you're using) are 
overwriting your string contents.

The printf function is different, in that it is immediately creating 
the resultant string (tyically with some of it's own local storage) 
and sending that result to the console.

--- In c...@yahoogroups.com, muonder@... wrote:
>
> 1. This works:
> 
>    char *myArr = "Hello";
>    LOG_printf(&trc, "%s", myArr);
> 
>  but this does not:
> 
>    char myArr[128] = "Hello";
>    LOG_printf(&trc, "%s", myArr);
> 
>  Does anybody know the logic behind this???
> 
> 2. char *myArr;
>    myArr = (char *) MEM_alloc(SEG0, 128*sizeof(char), 0);
>    ...
>    (after some calculations)
>    ...
>    printf("%s", myArr);  //This works
>    LOG_printf(&trc, "%s", myArr); //This is giving an error message 
>                                   //in LOG window: "*** ERROR: ..."
> 
>   why might printf work but LOG_printf does not, when inputs are 
same???
> 
> Thanks in advance..
> 
> Murat.
>

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )