Ok David,

Thank you and sorry,
I will studie the specific documentation.
I have made the modification in my sources and it is ok.

Thank You


Bernard

________________________________________________________________________________________________________


David Brown a écrit:

Hi Bernard,

This is a mistake many people make when they are new to embedded
development, or new to using an optomising C compiler for embedded
development.  The code snippet "int x = 1; while (x) ; " tells the compiler
to enter an infinite loop.  You've already told the compiler what value "x"
has - why should it bother re-reading it all the time?  That's what
optomisation is for - being smart and saving the processor some effort.
What you need to do is declare your variable to be "volatile" - that tells
the compiler the you really do want it to read the memory each loop.

This is all explained in the documentation for the compiler - see
http://mspgcc.sourceforge.net/doc_appendixE.html .  You really should read
through the documentation there before posting such questions, and even then
it's polite to phrase your posts in the manner of "What I am I doing wrong"
rather than "Perhaps there's a bug in the compiler" unless you are pretty
confident that this is the case.

And don't post in html - use plain text.

mvh.

David





----- Original Message -----
From: Bernard MONDAN
To: mspgcc-users@lists.sourceforge.net
Sent: Thursday, December 12, 2002 3:31 PM
Subject: [Mspgcc-users] Perhaps a MSP GCC bug ??


Hi dmitry

I think I have found a problem with the compiler.

This is a shortcut to the problem :

I have an interger that is set by a function, decremented by another (under
interrupt) and tested by a third.

I have tested this code :

int    xxxx;

xxxx = 4;

while( xxxx )
   ;

the generated code is :

   xxxx = 4;
   d8fa:    2f 42                 mov    #4,    r15    ;subst r2 with
As==10
   d8fc:    a2 42 7c 02           mov    #4,    &0x027c    ;subst r2 with
As==10
   while(xxxx)
   d900:    0f 93                 cmp    #0,    r15    ;subst r3 with
As==00
   d902:    fe 23                 jnz    $-2          ;abs dst addr 0xd900
       ;

I think that at the address d902 the right code is jnz $-4 and not jnz $-2
beacause the others routines modifie the 0x027c address and not the r15
register.


Please keep me informed about that.

Thank you


Bernard MONDAN

HOMERIDER SYSTEMS

bernard.mon...@homeridersystems.com



------------------------------------------------------- This sf.net email is
sponsored by: With Great Power, Comes Great Responsibility Learn to use your
power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/ _______________________________________________
Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users




-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users





Reply via email to