(ST9PlusV6.2.0) GNU compiler problem?
Company  
ST Home | Microcontrollers

Index  »  ST9  »  (ST9PlusV6.2.0) GNU compiler problem?
     
   (ST9PlusV6.2.0) GNU compiler problem?
 Moderated by :   »  Loiccho  -  chaps

Author
beginning argument    ( No reply )
gersbach   Posted 15-05-2008 at 12:00   



Registered on :
05-15-2009

Messages : 1

 OFF-Line

While debugging my project I have discovered the following behavior which does not make sense to me. I am hoping that maybe someone out there may see the reason for the problem and could give me a hint or a solution.
The following code sniped reads like this in C…

m_nValue += m_nValue;

and like this in the .lst file (listing).

ldw rro,#@m_nValue
addw @m_nValue+2,2(rr0)
adcw @m_nValue,(rr0)

m_nValue is a static long variable and it is also #pragma REGISTER_FILE m_nValue

For example, if I initialize m_nValue with 0 the output after the += function is not 0 as suggested. The output can be anywhere in the 32bit range. The output value is always the same for a compilation. If I change code and recompile the output variable is different than before.

My compile options look like this:
-m$(MODEL) -mfp-on -I$(INCDIR) -O1 -Wall -c -Wa,-alhd=$*.lis
I am using the MODEL: medium.

Any suggestions are highly appreciated.




 Profile   Quote  
On Top

Search in the forums
 
Jump To