<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 2/25/2013 11:25 AM, Matthew J
      Fletcher wrote:<br>
    </div>
    <blockquote
cite="mid:CAPy9Ti=qa1ahmA6tWZvnd4=uSXmE_N-gBjeOznNGQ4ANmY0SLw@mail.gmail.com"
      type="cite">Sebastain,<br>
      <br>
      I changed the code so now with the cpsr set as expected before
      main() the context switch occurs fine and we end up in Init().<br>
      <br>
    </blockquote>
    Is this a generic issue that needs addressing in the RTEMS<br>
    git repo? Or something you broke accidentally when making<br>
    other changes?<br>
    <blockquote
cite="mid:CAPy9Ti=qa1ahmA6tWZvnd4=uSXmE_N-gBjeOznNGQ4ANmY0SLw@mail.gmail.com"
      type="cite">Thanks for all your help.<br>
      <br>
    </blockquote>
    A little early for a beer here but it is definitely after 5 for<br>
    Sebastian. Good job Sebastian!<br>
    <br>
    --joel<br>
    <blockquote
cite="mid:CAPy9Ti=qa1ahmA6tWZvnd4=uSXmE_N-gBjeOznNGQ4ANmY0SLw@mail.gmail.com"
      type="cite"><br>
      <div class="gmail_quote">On 25 February 2013 17:10, Matthew J
        Fletcher <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:amimjf@gmail.com" target="_blank">amimjf@gmail.com</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
          <br>
          The cpsr thats saved out to r2 is 0x800000df, but is restored
          back to 0x13. Thanks for pointing out that no cpsr change must
          happen, i will check how the rtl22xx_t bsp sets up the cpsr.
          <div class="HOEnZb">
            <div class="h5"><br>
              <br>
              <br>
              <div class="gmail_quote">
                On 25 February 2013 16:52, Sebastian Huber <span
                  dir="ltr"><<a moz-do-not-send="true"
                    href="mailto:sebastian.huber@embedded-brains.de"
                    target="_blank">sebastian.huber@embedded-brains.de</a>></span>
                wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  On 02/25/2013 05:47 PM, Matthew J Fletcher wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    Hi,<br>
                    <br>
                    r2 is 0x13 before the msr, so I guess new_level must
                    have been 0.<br>
                    <br>
                    On 25 Feb 2013 15:02, "Sebastian Huber" <<a
                      moz-do-not-send="true"
                      href="mailto:sebastian.huber@embedded-brains.de"
                      target="_blank">sebastian.huber@embedded-brains.de</a><br>
                    <mailto:<a moz-do-not-send="true"
                      href="mailto:sebastian.huber@embedded-brains.de"
                      target="_blank">sebastian.huber@embedded-brains.de</a>>>
                    wrote:<br>
                    <br>
                        On 02/25/2013 03:15 PM, Matthew J Fletcher
                    wrote:<br>
                    <br>
                            Sebastian,<br>
                    <br>
                            The _Thread_Heir->Registers are ok into
                    the _Context_Switch() call, sp<br>
                            and lr<br>
                            both sensible.<br>
                    <br>
                            At the 'mrs r2, cpsr' line sp is 0x40001b2c
                    (rubbish) and pc sensible.<br>
                    <br>
                            In _restore, after the 'ldmia r1, ...'
                    instruction the sp and lr are loaded<br>
                            with the correct values from
                    _Thread_Heir->Registers.<br>
                    <br>
                            Its the 'msr cpsr, r2' messes up the sp and
                    lr<br>
                    <br>
                    <br>
                        Ok, if you load undefined values into the CPSR,
                    then a lot of things may<br>
                        happen.  What is the value of r2 before the msr?
                     It should be 0x13.<br>
                  </blockquote>
                  <br>
                  Ok, then maybe the mode in the BSP execution context
                  is wrong.  During _Context_Switch() no mode change
                  must happen.  What is the CPSR before the msr?<span><font
                      color="#888888"><br>
                      <br>
                      -- <br>
                      Sebastian Huber, embedded brains GmbH<br>
                      <br>
                      Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
                      Phone   : <a moz-do-not-send="true"
                        href="tel:%2B49%2089%20189%2047%2041-16"
                        value="+4989189474116" target="_blank">+49 89
                        189 47 41-16</a><br>
                      Fax     : <a moz-do-not-send="true"
                        href="tel:%2B49%2089%20189%2047%2041-09"
                        value="+4989189474109" target="_blank">+49 89
                        189 47 41-09</a><br>
                      E-Mail  : <a moz-do-not-send="true"
                        href="mailto:sebastian.huber@embedded-brains.de"
                        target="_blank">sebastian.huber@embedded-brains.de</a><br>
                      PGP     : Public key available on request.<br>
                      <br>
                      Diese Nachricht ist keine geschäftliche Mitteilung
                      im Sinne des EHUG.<br>
                    </font></span></blockquote>
              </div>
              <br>
              <br clear="all">
              <br>
            </div>
          </div>
          <span class="HOEnZb"><font color="#888888">-- <br>
              <div><br>
                regards</div>
              <div>---</div>
              <div>Matthew J Fletcher</div>
              <br>
            </font></span></blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      <div><br>
        regards</div>
      <div>---</div>
      <div>Matthew J Fletcher</div>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Joel Sherrill, Ph.D.             Director of Research & Development 
<a class="moz-txt-link-abbreviated" href="mailto:joel.sherrill@OARcorp.com">joel.sherrill@OARcorp.com</a>        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805 
Support Available                (256) 722-9985 </pre>
  </body>
</html>