Skip to main content
Visitor II
May 15, 2008
Question

(ST9PlusV6.2.0) GNU compiler problem?

  • May 15, 2008
  • 1 reply
  • 596 views
Posted on May 15, 2008 at 08:30

(ST9PlusV6.2.0) GNU compiler problem?

    This topic has been closed for replies.

    1 reply

    gersbachAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:32

    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.