Sign in

username:

password:



Not a member?

Search c3x



Search tips

Subscribe to c3x



c3x by Keywords

Boot | C31 | TMS320VC33 | VC33

Discussion Groups

Discussion Groups | TMS320C3x | Problem with C31 , Please help me

Technical discussions about the TI C3x DSPs (including the C31, C32 and C33 DSPs).

  

Post a new Thread

Problem with C31 , Please help me - mm_k...@yahoo.com - Oct 4 8:31:14 2006



Hello all,
I design an evaluation board with TMS320C31 and i have a problem,
I write a program in C and compile it with CC4.1, when i use this line :

retval += *ptr & 0x00000fff;

the "retval" is fill by wrong value. But when i change program to following lines,
the answer is correct:

dat= *ptr;
asm("      nop ");
dat &= 0x00000fff;
asm("      nop ");
retval += dat;

(ptr is address of an I/O port)

I don't know why? If anybody can help, please informe me. 

thanks,
kashi.



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

Re: Problem with C31 , Please help me - Keith Larson - Oct 4 12:20:55 2006

Hello Kashi

Your code fragment is a little 'thin' so I must make guesses.  For 
example, are these fragments contained in functions?  Also look at 
'retval.  Is retval declared global or local?  If it is local, is it 
static volatile to tell the compiler it can change between calls.

volatile <- This keyword is different than the static or global 
declaration.  It tells the compiler that an external process can modify 
the previous value.  This keyword tells the compiler it cannot assume 
the last time the program visited this variable that it is still the 
same value.

These issues are quite often related to the optimizer and or HLL source 
debugging (stack is handled differently).  To get to the bottom of this 
one try using the cl30 '-k' option to generate and keep the ASM files.

Best regards
Keith

tip: If you forget the CL30 options, type the following from the command 
line.  With no options, CL30 outputs a list of options.  The '>' symbols 
is the DOS piping command that causes stdout to be copied to a file 
rather than to the screen.

C:\DSK3\DSK3\CL30 >CL30_OPN.TXT

----------------------------------
m...@yahoo.com wrote:

Hello all, I design an evaluation board with TMS320C31 and i have a 
problem, I write a program in C and compile it with CC4.1, when i use 
this line :

retval += *ptr & 0x00000fff;

the "retval" is fill by wrong value. But when i change program to 
following lines, the answer is correct:

dat= *ptr;
asm(" nop ");
dat &= 0x00000fff;
asm(" nop ");
retval += dat;

(ptr is address of an I/O port)

I don't know why? If anybody can help, please informe me.

thanks, kashi.



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

RE: Problem with C31 , Please help me - Bill Finger - Oct 4 12:23:53 2006

Kashi,

What are the C types of dat, ptr, and retval?  When you say ptr is an
I/O port, what do you mean, exactly?  An MMR?  or something on the
Expansion Bus?  Are your wait states set correctly?  How is the answer
incorrect?

Have you looked at the disassembly?

Bill

> -----Original Message-----
> From: c...@yahoogroups.com [mailto:c...@yahoogroups.com] On 
> Behalf Of m...@yahoo.com
> Sent: Wednesday, October 04, 2006 12:48 AM
> To: c...@yahoogroups.com
> Subject: [c3x] Problem with C31 , Please help me
> 
> Hello all,
> I design an evaluation board with TMS320C31 and i have a problem,
> I write a program in C and compile it with CC4.1, when i use 
> this line :
> 
> retval += *ptr & 0x00000fff;
> 
> the "retval" is fill by wrong value. But when i change 
> program to following lines, the answer is correct:
> 
> dat= *ptr;
> asm("      nop ");
> dat &= 0x00000fff;
> asm("      nop ");
> retval += dat;
> 
> (ptr is address of an I/O port)
> 
> I don't know why? If anybody can help, please informe me. 
> 
> thanks,
> kashi.
>



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