RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

MSP430 broken

Open LudwigKnuepfer opened this issue 12 years ago • 26 comments

At least the following projects fail:

  • ~~test_thread_exit~~ (fixed by #446)
  • test_hwtimer_wait
    • fix attempted but failed by #909, compare http://lists.riot-os.org/pipermail/devel/2014-April/000637.html and http://lists.riot-os.org/pipermail/devel/2014-April/000645.html
    • another fix attempt: #1112 and #1113
  • ~~test_shell~~ works in master as of Thu Jun 19 17:17:21 CEST 2014
  • ~~default~~ works in master as of Thu Jun 19 17:17:21 CEST 2014

Additionally:

  • ~~lpm_set does nothing~~ (fixed by https://github.com/RIOT-OS/RIOT/pull/459)

LudwigKnuepfer avatar Dec 15 '13 17:12 LudwigKnuepfer

Are these failures related to https://github.com/RIOT-OS/RIOT/issues/234 and #295?

OlegHahm avatar Dec 15 '13 21:12 OlegHahm

Whith

diff --git a/test_hwtimer/main.c b/test_hwtimer/main.c
index d771118..0362b6e 100644
--- a/test_hwtimer/main.c
+++ b/test_hwtimer/main.c
@@ -17,10 +17,11 @@ int main(void)
     puts("Initializing hwtimer [OK].");

     hwtimer_set(20000LU, callback, (void*) "callback1");
-    hwtimer_set(50000LU, callback, (void*) "callback2");
+    //hwtimer_set(50000LU, callback, (void*) "callback2"); // not enough hardware timers
     hwtimer_set(30000LU, callback, (void*) "callback3");

     hwtimer_wait(HWTIMER_TICKS(1000UL * 1000UL));

     puts("hwtimer set.");
+    while (1) ;
 }

I get

2013-12-16 08:59:32,722 - INFO # RIOT MSP430 hardware initialization complete.
2013-12-16 08:59:32,722 - INFO # 
2013-12-16 08:59:32,730 - INFO # kernel_init(): This is RIOT! (Version: 2013.08-686-gb047-msb-430_fixes)
2013-12-16 08:59:32,732 - INFO # Scheduler...[OK]
2013-12-16 08:59:32,737 - INFO # kernel_init(): jumping into first task...
2013-12-16 08:59:32,739 - INFO # hwtimer test project...
2013-12-16 08:59:32,743 - INFO # Initializing hwtimer...
2013-12-16 08:59:32,744 - INFO # Initializing hwtimer [OK].
2013-12-16 08:59:33,355 - INFO # callback1

on https://github.com/LudwigOrtmann/RIOT/compare/msb-430_fixes (headers + my programmer).

LudwigKnuepfer avatar Dec 16 '13 08:12 LudwigKnuepfer

I just found an interesting article on TI web site: http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/53319.aspx

To summarize, it means that with MSP430s, one should always put a NOP after fiddling with the GIE bit (in R2 alias SR), under penalty of bizarre bugs...

Plus, when trying to analyze the MCU status on JTAG, I find that when the system has "stalled", this GIE bit is often set to 0.

Are we sure that MSP-GCC handles this correctly (i.e. puts a NOP every after action on GIE bit)? If not, this could explain why we are facing these strange problems on MSP430-based hardware...

rousselk avatar Jun 18 '14 12:06 rousselk

Well, after checking the source code of FreeRTOS v8 (i.e. the current version), it seems they don't trust MSP-GCC primitives for handling interrupts. In their port for MSP430F449, you can find these line in the 'portmacro.h' file:

/*-----------------------------------------------------------*/
/* Interrupt control macros. */
#define portDISABLE_INTERRUPTS()    asm volatile ( "DINT" ); asm volatile ( "NOP" )
#define portENABLE_INTERRUPTS()     asm volatile ( "EINT" ); asm volatile ( "NOP" )
/*-----------------------------------------------------------*/

I think I'll try to change our dINT() and eINT() functions in 'cpu/msp430-common/include/cpu.h' and see if helps.

rousselk avatar Jun 18 '14 12:06 rousselk

nice one

LudwigKnuepfer avatar Jun 18 '14 13:06 LudwigKnuepfer

Indeed, MSP-GCC (at least in the version 4.6.3 I use on Debian-stable) seems to put a NOP instruction after clearing the GIE bit (dINT) but not after setting it (eINT)...

Plus, the splhigh_() and splx_() functions in 'cpu/msp430-common/msp430-main.c' are "bare assembly" functions that don't put any "delay slot" instruction at all.

@LudwigOrtmann I've added a msp430-fix-intr branch in my own repository (https://github.com/rousselk/RIOT.git). Could you check if this helps with the bugs you have on your MSB-430 board?

rousselk avatar Jun 19 '14 13:06 rousselk

Will check

LudwigKnuepfer avatar Jun 19 '14 14:06 LudwigKnuepfer

rebased #1112 and #1113 on msp430-fix-intr without success.

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

test_shell appears to work although sluggish

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

default also appears to work and feels less sluggish...

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

(Everything tested on msb-430 only.)

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

Also work with master O.o

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

BTW: printing of floats is still broken...

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

Reboot appears faster with msp430-fix-intr.

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

Yup, reboot is definitely faster with your branch.

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

Hmm... I think we're facing a complex problem: there are probably more than one issue here (the hwtimer_wait() problem is also bugging me for quite a time, but I can't find an efficient fix for now).

Anyway, this branch seems to offer at least some little improvement...

rousselk avatar Jun 19 '14 15:06 rousselk

I assume it also fixes many problems that I never encountered simply because I don't use my msp430 hardware all that much (due to the other bugs)...

LudwigKnuepfer avatar Jun 19 '14 15:06 LudwigKnuepfer

Breaking news!

After some low-level debugging (using JTAG and Cooja to do step-by-step execution), I figured out something that could explain our problems!

I managed to go into step-by-step mode just before a crash on an emulated Zolertia Z1 (in Cooja), and what I saw is that the mote crashed at the end of the thread_yield() function, when restoring the context of the thread that had just been selected by the scheduler. It seems that there are some times when the pointers are messed up, because the restored "context" was totally aberrant: PC was restored to 0 (!), and the SR to 0x33 that is: in deep sleep mode, with disabled interrupts (in other words: unrecoverable coma state).

Moreover: the problems we encouter with the timers (hwtimer_wait() and hwtimer_spin() failing to return) seem to be related to the resetting og the GIE (Global Interrupt Enable) bit of the SR. Could it be that the content of the SR is somehow "damaged" during context switchs?

Anyway, I think we should examine more closely how the scheduler fares on the MSP: maybe is that an issue related to integer sizes or alignment of variables (especially portions of structs, I think I remember we discussed about such an issue about thread creation on 16-bit machines, for example...)

rousselk avatar Jun 26 '14 14:06 rousselk

Here's a transcript of a crash I monitored on an emulated Z1 mote (Cooja), the one I mentioned just above:

> break thread_yield
Breakpoint set at $03ae6
*** Break at $03ae6

> mem 0x3ae6 38 word dis
//// thread_yield
    3ae6:   02 12 PUSH.W R2
    3ae8:   0f 12 PUSH.W R15
    3aea:   0e 12 PUSH.W R14
    3aec:   0d 12 PUSH.W R13
    3aee:   0c 12 PUSH.W R12
    3af0:   0b 12 PUSH.W R11
    3af2:   0a 12 PUSH.W R10
    3af4:   09 12 PUSH.W R9
    3af6:   08 12 PUSH.W R8
    3af8:   07 12 PUSH.W R7
    3afa:   06 12 PUSH.W R6
    3afc:   05 12 PUSH.W R5
    3afe:   04 12 PUSH.W R4
    3b00:   0f 41 MOV.W SP, R15
    3b02:   1e 42 d6 1f MOV.W &sched_active_thread, R14
    3b06:   8e 4f 00 00 MOV.W R15, (R14)
    3b0a:   32 c2 BIC.W #8, SR
    3b0c:   03 43 MOV.W #0, R3
    3b0e:   b0 12 82 39 CALL sched_run
    3b12:   32 d2 BIS.W #8, SR
    3b14:   03 43 MOV.W #0, R3
    3b16:   1f 42 d6 1f MOV.W &sched_active_thread, R15
    3b1a:   21 4f MOV.W @R15, SP
    3b1c:   34 41 MOV.W @SP+, R4
    3b1e:   35 41 MOV.W @SP+, R5
    3b20:   36 41 MOV.W @SP+, R6
    3b22:   37 41 MOV.W @SP+, R7
    3b24:   38 41 MOV.W @SP+, R8
    3b26:   39 41 MOV.W @SP+, R9
    3b28:   3a 41 MOV.W @SP+, R10
    3b2a:   3b 41 MOV.W @SP+, R11
    3b2c:   3c 41 MOV.W @SP+, R12
    3b2e:   3d 41 MOV.W @SP+, R13
    3b30:   3e 41 MOV.W @SP+, R14
    3b32:   3f 41 MOV.W @SP+, R15
    3b34:   00 13 RETI R0
    3b36:   30 41 MOV.W @SP+, PC
//// (end of thread_yield)

> printreg r0
PC=$3ae6
> printreg r1
SP=$14c8
> mem 0x1480 128 byte hex
1480   00 00 0a 00 fb ff ff ff 06 00 00 00 33 00 00 00
1490   00 00 66 11 01 00 ff ff 06 00 56 3e 48 13 09 00
14a0   84 71 91 71 ff ff 06 00 07 00 70 3c 00 00 02 00
14b0   1d 09 00 00 8e 3c 02 00 1d 09 00 00 84 35 07 00
14c0   30 13 46 39 01 00 08 15[ae 47]30 13 14 00 12 34
14d0   00 00 7e 4a 14 4f 1f 00 00 00 00 00 00 00 02 00
14e0   00 00 00 00 00 00 61 88 73 34 12 ff ff 00 00 00
14f0   07 00 08 00 09 00 0a 00 0b 00 0c 00 0d 00 08 00
> printreg r2
SR=$000d
> stacktrace
Stack Trace: number of calls: 247 PC: $03ae6
  thread_yield (/home/roussel/github-rousselk/RIOT/cpu/msp430-common/include/cpu.h) called from PC: $047ae (elapsed: 5)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 205)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 211)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 326520)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 435829)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 737121)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 846442)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 1147729)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 1147735)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 1257055)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 1667666)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 1968959)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 1968965)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 2078279)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 2488893)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 2790195)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 2790201)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 3200796)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 3310117)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 3611414)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 3720731)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 4022025)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 4131343)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 4432630)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 4432636)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 4541956)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 4843238)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 5253855)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 5363181)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 5664471)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 5773386)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 5773795)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 6184408)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 6485707)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 6595019)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 6896310)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 6896316)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 7005634)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 7415836)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 7416245)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 7826859)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 8128163)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 8237472)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 8538773)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 8648084)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 8949378)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 9058696)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 9359993)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 9469310)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 9770587)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 9879921)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 10181221)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 10290535)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 10591827)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 10591833)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 11002440)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 11111760)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 11413051)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 11522372)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 11823666)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 11932986)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 12234277)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 12343600)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 12644895)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 12644901)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 13055495)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 13164825)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 13466119)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 13575436)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 13876719)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 13876725)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 14287354)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 14396663)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 14697962)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 14807275)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 15108570)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 15217887)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 15519184)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 15628502)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 15929792)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 16039112)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 16340405)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 16449726)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 16751011)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 16751017)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 17161630)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 17270543)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 17270952)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 17681564)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 17982854)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 18092178)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 18393466)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 18502789)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 18804077)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 18804083)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 18913404)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 19214681)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 19625298)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 19734629)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 20035926)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 20145240)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 20446525)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 20446531)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 20555855)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 20966621)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 21267960)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 21377290)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 21678586)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 21787903)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 22089185)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 22089191)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 22499803)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 22499809)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 22609129)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 23019740)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 23321037)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 23321043)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 23731637)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 23731643)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 23840967)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 24142254)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 24251580)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 24662192)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 24963487)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 25072804)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 25374102)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 25483417)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 25784715)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 25894029)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 26195323)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 26304644)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 26605936)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 26605942)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 26715256)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 27125869)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 27427167)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 27536481)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 27837673)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 27947095)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 28248389)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 28357706)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 28658997)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 28768318)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 29069606)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 29069612)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 29480220)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 29589545)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 29890832)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 29890838)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 30301445)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 30410769)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 30712065)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 30821382)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 31122679)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 31231997)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 31533287)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 31642609)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 31943900)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 32053222)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 32354512)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 32463835)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 32765115)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 32765121)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 32874448)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 33285061)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 33586358)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 33695262)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 33695671)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 34106285)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 34407575)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 34516897)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 34818203)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 34927512)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 35228794)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 35338124)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 35639432)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 35748737)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 36050040)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 36159349)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 36460637)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 36460643)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 36569962)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 36980575)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 37281882)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 37391187)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 37692489)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 37801801)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 38103093)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 38103099)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 38212413)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 38623026)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 38924319)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 39033228)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 39033637)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 39443841)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 39444250)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 39854865)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 40156156)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 40265478)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 40566782)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 40675681)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 40676090)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 40977394)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 41086703)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 41388014)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 41798712)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 41798718)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 42209326)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 42318646)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 42619944)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 42619950)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 42729259)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 43030546)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 43139871)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 43550483)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 43851777)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 43851783)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 43961096)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 44371709)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 44672999)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 44782322)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 45083621)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 45192936)
  _msg_receive (local in .//msg.c) called from PC: $04a7e (elapsed: 45494206)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 45494212)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 45603547)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 45904834)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 46014161)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 46315447)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 46424774)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 46835387)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 47136690)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 47245998)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 47547297)
  hwtimer_wait (.//hwtimer.c) called from PC: $050f8 (elapsed: 47656646)
  msg_receive (.//msg.c) called from PC: $04f14 (elapsed: 47960704)
  thread_yield (/home/roussel/github-rousselk/RIOT/cpu/msp430-common/include/cpu.h) called from PC: $0345e (elapsed: 48030302)
  thread_create (.//thread.c) called from PC: $04cac (elapsed: 48030776)
  cosens_on (.//cosens.c) called from PC: $03178 (elapsed: 48043646)
  cc2420_reset (.//driver_cc2420.c) called from PC: $0433c (elapsed: 48345999)
  mutex_lock (.//mutex.c) called from PC: $0368e (elapsed: 48347309)
  hwtimer_wait (.//hwtimer.c) called from PC: $04338 (elapsed: 48347718)
  cc2420_init (.//cc2420.c) called from PC: $03160 (elapsed: 48347775)
  main (.//main.c) called from PC: $03f40 (elapsed: 48348052)
  cpu_switch_context_exit (.//cpu.c) called from PC: $032aa (elapsed: 48348263)
  kernel_init (/home/roussel/github-rousselk/RIOT/cpu/msp430-common/include/cpu.h) called from PC: $03226 (elapsed: 48410647)
  startup (local in .//startup.c) called from PC: $0314e (elapsed: 48437126)
> step
CPU stepped to: $03ae8 in 3 cycles (48660879)
> step
CPU stepped to: $03aea in 3 cycles (48660882)
> step
CPU stepped to: $03aec in 3 cycles (48660885)
> step
CPU stepped to: $03aee in 3 cycles (48660888)
> step
CPU stepped to: $03af0 in 3 cycles (48660891)
> step
CPU stepped to: $03af2 in 3 cycles (48660894)
> step
CPU stepped to: $03af4 in 3 cycles (48660897)
> step
CPU stepped to: $03af6 in 3 cycles (48660900)
> step
CPU stepped to: $03af8 in 3 cycles (48660903)
> step
CPU stepped to: $03afa in 3 cycles (48660906)
> step
CPU stepped to: $03afc in 3 cycles (48660909)
> step
CPU stepped to: $03afe in 3 cycles (48660912)
> step
CPU stepped to: $03b00 in 3 cycles (48660915)
> printreg r1
SP=$14ae
> mem 0x1480 128 byte hex
1480   00 00 0a 00 fb ff ff ff 06 00 00 00 33 00 00 00
1490   00 00 66 11 01 00 ff ff 06 00 56 3e 48 13 09 00
14a0   84 71 91 71 ff ff 06 00 07 00 70 3c 00 00[00 00]
14b0   05 00 06 00 07 00 ff ff de 14 01 00 08 15 fb ff
14c0   ff ff 10 15 ff ff 0d 00 ae 47 30 13 14 00 12 34
14d0   00 00 7e 4a 14 4f 1f 00 00 00 00 00 00 00 02 00
14e0   00 00 00 00 00 00 61 88 73 34 12 ff ff 00 00 00
14f0   07 00 08 00 09 00 0a 00 0b 00 0c 00 0d 00 08 00
> step
CPU stepped to: $03b02 in 1 cycles (48660916)
> step
CPU stepped to: $03b06 in 3 cycles (48660919)
> printreg r14
R14=$1508
> step
CPU stepped to: $03b0a in 4 cycles (48660923)
> step
CPU stepped to: $03b0c in 1 cycles (48660924)
> step
CPU stepped to: $03b0e in 1 cycles (48660925)
> printreg r2
SR=$0005

> step
CPU stepped to: $03982 in 5 cycles (48660930)
> mem 0x3982 31 word dis
//// sched_run
    3982:   0b 12 PUSH.W R11
    3984:   82 43 b4 1f MOV.W #0, &sched_context_switch_request
    3988:   1f 42 d6 1f MOV.W &sched_active_thread, R15
    398c:   0f 93 CMP.W #0, R15
    398e:   07 24 JEQ $000e
    3990:   bf 90 06 00 02 00 CMP.W #$0006, $0002(R15)
    3996:   03 20 JNE $0006
    3998:   bf 40 07 00 02 00 MOV.W #$0007, $0002(R15)
    399e:   1f 42 86 13 MOV.W &runqueue_bitcache, R15
    39a2:   b0 12 34 3a CALL bitarithm_lsb
    39a6:   5f 02 RLAM.W #1,R15 
    39a8:   3f 50 b6 1f ADD.W #$1fb6, R15
    39ac:   2e 4f MOV.W @R15, R14
    39ae:   1b 4e 04 00 MOV.W $0004(R14), R11
    39b2:   af 4e 00 00 MOV.W @R14, (R15)
    39b6:   92 4b 04 00 06 11 MOV.W $0004(R11), &sched_active_pid
    39bc:   1f 42 d6 1f MOV.W &sched_active_thread, R15
    39c0:   0b 9f CMP.W R15, R11
    39c2:   0f 24 JEQ $001e
    39c4:   0f 93 CMP.W #0, R15
    39c6:   08 24 JEQ $0010
    39c8:   1e 4f 02 00 MOV.W $0002(R15), R14
    39cc:   3e 90 06 00 CMP.W #$0006, R14
    39d0:   03 20 JNE $0006
    39d2:   bf 40 07 00 02 00 MOV.W #$0007, $0002(R15)
    39d8:   3e 40 06 00 MOV.W #$0006, R14
    39dc:   0f 4b MOV.W R11, R15
    39de:   b0 12 dc 38 CALL sched_set_status
    39e2:   82 4b d6 1f MOV.W R11, &sched_active_thread
    39e6:   3b 41 MOV.W @SP+, R11
    39e8:   30 41 MOV.W @SP+, PC
//// (end of sched_run)

> printreg r1
SP=$14aa
> mem 0x1480 128 byte hex
1480   00 00 0a 00 fb ff ff ff 06 00 00 00 33 00 00 00
1490   00 00 66 11 01 00 ff ff 06 00 56 3e 48 13 09 00
14a0   84 71 91 71 ff ff 06 00 07 00[08 15]12 3b 00 00
14b0   05 00 06 00 07 00 ff ff de 14 01 00 08 15 fb ff
14c0   ff ff 10 15 ff ff 0d 00 ae 47 30 13 14 00 12 34
14d0   00 00 7e 4a 14 4f 1f 00 00 00 00 00 00 00 02 00
14e0   00 00 00 00 00 00 61 88 73 34 12 ff ff 00 00 00
14f0   07 00 08 00 09 00 0a 00 0b 00 0c 00 0d 00 08 00
> step
CPU stepped to: $03988 in 4 cycles (48660937)
> step
CPU stepped to: $0398c in 3 cycles (48660940)
> step
CPU stepped to: $0398e in 1 cycles (48660941)
> step
CPU stepped to: $03990 in 2 cycles (48660943)
> step
CPU stepped to: $03996 in 5 cycles (48660948)
> step
CPU stepped to: $0399e in 2 cycles (48660950)
> step
CPU stepped to: $039a2 in 3 cycles (48660953)
> printreg r15
R15=$8080

> step
CPU stepped to: $03a34 in 5 cycles (48660958)
//// bitarithm_lsb
    3a34:   0e 43 MOV.W #0, R14
    3a36:   02 3c JMP $0004
    3a38:   5f 03 RRUM.W #1,R15 
    3a3a:   1e 53 ADD.W #1, R14
    3a3c:   1f b3 BIT.W #1, R15
    3a3e:   fc 27 JEQ $fff8
    3a40:   0f 4e MOV.W R14, R15
    3a42:   30 41 MOV.W @SP+, PC
> step
CPU stepped to: $03a36 in 1 cycles (48660959)
> step
CPU stepped to: $03a3c in 2 cycles (48660961)
> step
CPU stepped to: $03a3e in 1 cycles (48660962)
> step
CPU stepped to: $03a38 in 2 cycles (48660964)
> step
CPU stepped to: $03a3a in 2 cycles (48660966)
> step
CPU stepped to: $03a3c in 1 cycles (48660967)
> step
CPU stepped to: $03a3e in 1 cycles (48660968)
> step
CPU stepped to: $03a38 in 2 cycles (48660970)
> step
CPU stepped to: $03a3a in 2 cycles (48660972)
> step
CPU stepped to: $03a3c in 1 cycles (48660973)
> step
CPU stepped to: $03a3e in 1 cycles (48660974)
> step
CPU stepped to: $03a38 in 2 cycles (48660976)
> step
CPU stepped to: $03a3a in 2 cycles (48660978)
> step
CPU stepped to: $03a3c in 1 cycles (48660979)
> step
CPU stepped to: $03a3e in 1 cycles (48660980)
> step
CPU stepped to: $03a38 in 2 cycles (48660982)
> step
CPU stepped to: $03a3a in 2 cycles (48660984)
> step
CPU stepped to: $03a3c in 1 cycles (48660985)
> step
CPU stepped to: $03a3e in 1 cycles (48660986)
> step
CPU stepped to: $03a38 in 2 cycles (48660988)
> step
CPU stepped to: $03a3a in 2 cycles (48660990)
> step
CPU stepped to: $03a3c in 1 cycles (48660991)
> step
CPU stepped to: $03a3e in 1 cycles (48660992)
> step
CPU stepped to: $03a38 in 2 cycles (48660994)
> step
CPU stepped to: $03a3a in 2 cycles (48660996)
> step
CPU stepped to: $03a3c in 1 cycles (48660997)
> step
CPU stepped to: $03a3e in 1 cycles (48660998)
> step
CPU stepped to: $03a38 in 2 cycles (48661000)
> step
CPU stepped to: $03a3a in 2 cycles (48661002)
> step
CPU stepped to: $03a3c in 1 cycles (48661003)
> step
CPU stepped to: $03a3e in 1 cycles (48661004)
> step
CPU stepped to: $03a40 in 2 cycles (48661006)
> step
CPU stepped to: $03a42 in 1 cycles (48661007)
> printreg r15
R15=$0007

> step
CPU stepped to: $039a6 in 3 cycles (48661010)
> mem 0x3982 31 word dis
//// sched_run
    3982:   0b 12 PUSH.W R11
    3984:   82 43 b4 1f MOV.W #0, &sched_context_switch_request
    3988:   1f 42 d6 1f MOV.W &sched_active_thread, R15
    398c:   0f 93 CMP.W #0, R15
    398e:   07 24 JEQ $000e
    3990:   bf 90 06 00 02 00 CMP.W #$0006, $0002(R15)
    3996:   03 20 JNE $0006
    3998:   bf 40 07 00 02 00 MOV.W #$0007, $0002(R15)
    399e:   1f 42 86 13 MOV.W &runqueue_bitcache, R15
    39a2:   b0 12 34 3a CALL bitarithm_lsb
    39a6:   5f 02 RLAM.W #1,R15 
    39a8:   3f 50 b6 1f ADD.W #$1fb6, R15
    39ac:   2e 4f MOV.W @R15, R14
    39ae:   1b 4e 04 00 MOV.W $0004(R14), R11
    39b2:   af 4e 00 00 MOV.W @R14, (R15)
    39b6:   92 4b 04 00 06 11 MOV.W $0004(R11), &sched_active_pid
    39bc:   1f 42 d6 1f MOV.W &sched_active_thread, R15
    39c0:   0b 9f CMP.W R15, R11
    39c2:   0f 24 JEQ $001e
    39c4:   0f 93 CMP.W #0, R15
    39c6:   08 24 JEQ $0010
    39c8:   1e 4f 02 00 MOV.W $0002(R15), R14
    39cc:   3e 90 06 00 CMP.W #$0006, R14
    39d0:   03 20 JNE $0006
    39d2:   bf 40 07 00 02 00 MOV.W #$0007, $0002(R15)
    39d8:   3e 40 06 00 MOV.W #$0006, R14
    39dc:   0f 4b MOV.W R11, R15
    39de:   b0 12 dc 38 CALL sched_set_status
    39e2:   82 4b d6 1f MOV.W R11, &sched_active_thread
    39e6:   3b 41 MOV.W @SP+, R11
    39e8:   30 41 MOV.W @SP+, PC
//// (end of sched_run)

> step
CPU stepped to: $039a8 in 2 cycles (48661012)
> printreg r15
R15=$000e
> step
CPU stepped to: $039ac in 2 cycles (48661014)
> printreg r15
R15=$1fc4
> mem 0x1fb0 32 byte hex
1fb0   01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1fc0   00 00 00 00 50 13 00 00 00 00 00 00 00 00 00 00
> step
CPU stepped to: $039ae in 2 cycles (48661016)
> printreg r14
R14=$1350
> mem 0x1350 16 byte hex
1350   50 13 50 13 48 13 00 00 00 00 00 00 00 00 00 00
> printreg r11
R11=$1348
> mem 0x1340 16 byte hex
1340   0f 00 08 00 40 3f 10 3a 74 14 07 00 01 00 07 00
> step
CPU stepped to: $039b6 in 5 cycles (48661024)
> mem 0x1fb0 32 byte hex
1fb0   01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1fc0   00 00 00 00 50 13 00 00 00 00 00 00 00 00 00 00
> step
CPU stepped to: $039bc in 6 cycles (48661030)
> step
CPU stepped to: $039c0 in 3 cycles (48661033)
> printreg r15
R15=$1508
> printreg r11
R11=$1348
CPU stepped to: $039c2 in 1 cycles (48661034)
> step
CPU stepped to: $039c4 in 2 cycles (48661036)
> step
CPU stepped to: $039c6 in 1 cycles (48661037)
> step
CPU stepped to: $039c8 in 2 cycles (48661039)
> step
CPU stepped to: $039cc in 3 cycles (48661042)
> printreg r14
PC=$0003
> step
CPU stepped to: $039d0 in 2 cycles (48661044)
> step
CPU stepped to: $039d8 in 2 cycles (48661046)
> step
CPU stepped to: $039dc in 2 cycles (48661048)
> step
CPU stepped to: $039de in 1 cycles (48661049)

...

*** Break at $039e2
> printreg r1
SP=$14aa
> mem 0x1480 128 byte hex
1480   00 00 0a 00 fb ff ff ff 06 00 00 00 33 00 00 00
1490   00 00 66 11 01 00 ff ff 06 00 56 3e 48 13 09 00
14a0   84 71 91 71 01 00 48 13 e2 39[08 15]12 3b 00 00
14b0   05 00 06 00 07 00 ff ff de 14 01 00 08 15 fb ff
14c0   ff ff 10 15 ff ff 0d 00 ae 47 30 13 14 00 12 34
14d0   00 00 7e 4a 14 4f 1f 00 00 00 00 00 00 00 02 00
14e0   00 00 00 00 00 00 61 88 73 34 12 ff ff 00 00 00
14f0   07 00 08 00 09 00 0a 00 0b 00 0c 00 0d 00 08 00
> printreg r2
SR=$0001
> printreg r11
R11=$1348
> mem 0x1340 16 byte hex
1340   0f 00 08 00 40 3f 10 3a 74 14 06 00 01 00 07 00
1350   50 13 50 13 48 13 00 00 00 00 00 00 00 00 00 00
> step
CPU stepped to: $039e8 in 2 cycles (48661088)

> step
CPU stepped to: $03b12 in 3 cycles (48661091)
> mem 0x3ae6 38 word dis
//// thread_yield
    3ae6:   02 12 PUSH.W R2
    3ae8:   0f 12 PUSH.W R15
    3aea:   0e 12 PUSH.W R14
    3aec:   0d 12 PUSH.W R13
    3aee:   0c 12 PUSH.W R12
    3af0:   0b 12 PUSH.W R11
    3af2:   0a 12 PUSH.W R10
    3af4:   09 12 PUSH.W R9
    3af6:   08 12 PUSH.W R8
    3af8:   07 12 PUSH.W R7
    3afa:   06 12 PUSH.W R6
    3afc:   05 12 PUSH.W R5
    3afe:   04 12 PUSH.W R4
    3b00:   0f 41 MOV.W SP, R15
    3b02:   1e 42 d6 1f MOV.W &sched_active_thread, R14
    3b06:   8e 4f 00 00 MOV.W R15, (R14)
    3b0a:   32 c2 BIC.W #8, SR
    3b0c:   03 43 MOV.W #0, R3
    3b0e:   b0 12 82 39 CALL sched_run
    3b12:   32 d2 BIS.W #8, SR
    3b14:   03 43 MOV.W #0, R3
    3b16:   1f 42 d6 1f MOV.W &sched_active_thread, R15
    3b1a:   21 4f MOV.W @R15, SP
    3b1c:   34 41 MOV.W @SP+, R4
    3b1e:   35 41 MOV.W @SP+, R5
    3b20:   36 41 MOV.W @SP+, R6
    3b22:   37 41 MOV.W @SP+, R7
    3b24:   38 41 MOV.W @SP+, R8
    3b26:   39 41 MOV.W @SP+, R9
    3b28:   3a 41 MOV.W @SP+, R10
    3b2a:   3b 41 MOV.W @SP+, R11
    3b2c:   3c 41 MOV.W @SP+, R12
    3b2e:   3d 41 MOV.W @SP+, R13
    3b30:   3e 41 MOV.W @SP+, R14
    3b32:   3f 41 MOV.W @SP+, R15
    3b34:   00 13 RETI R0
    3b36:   30 41 MOV.W @SP+, PC
//// (end of thread_yield)
> printreg r2
SR=$0001
> step
CPU stepped to: $03b14 in 1 cycles (48661092)
> step
CPU stepped to: $03b16 in 1 cycles (48661093)
> printreg r2
SR=$0009
> step
CPU stepped to: $03b1a in 3 cycles (48661096)
> step
CPU stepped to: $03b1c in 2 cycles (48661098)
> printreg r1
SP=$1474
> mem 0x1470 64 byte hex
1470   00 00 00 00[00 00]36 39 39 39 30 00 7c 14 ce 14
1480   00 00 0a 00 fb ff ff ff 06 00 00 00[33 00]00 00
1490   00 00 66 11 01 00 ff ff 06 00 56 3e 48 13 09 00
14a0   84 71 91 71 01 00 48 13 e2 39 08 15 12 3b 00 00
> step
CPU stepped to: $03b1e in 2 cycles (48661100)
> step
CPU stepped to: $03b20 in 2 cycles (48661102)
> step
CPU stepped to: $03b22 in 2 cycles (48661104)
> step
CPU stepped to: $03b24 in 2 cycles (48661106)
> step
CPU stepped to: $03b26 in 2 cycles (48661108)
> step
CPU stepped to: $03b28 in 2 cycles (48661110)
> step
CPU stepped to: $03b2a in 2 cycles (48661112)
> step
CPU stepped to: $03b2c in 2 cycles (48661114)
> step
CPU stepped to: $03b2e in 2 cycles (48661116)
> step
CPU stepped to: $03b30 in 2 cycles (48661118)
> step
CPU stepped to: $03b32 in 2 cycles (48661120)
> step
CPU stepped to: $03b34 in 2 cycles (48661122)
> printreg r1
SP=$148c


> step
CPU stepped to: $00000 in 5 cycles (48661127)
******************************** FAILURE !!!!! ********************************
******************************** FAILURE !!!!! ********************************
******************************** FAILURE !!!!! ********************************
> printreg r0
PC=$0000       *** !!! NOT IN PROGRAM SPACE !!! ***
> printreg r1
SP=$1490
> printreg r2
SR=$0033       *** I.E.: IN DEEP SLEEP MODE, WITHOUT INTERRUPTS ENABLED !!! ***

rousselk avatar Jun 26 '14 14:06 rousselk

@rousselk Looking at your transcript the assembly of thread_yield() looks strange. In __save_context() the first register pushed is R2 which is SR but seems not be restored by __restore_context()!

thomaseichinger avatar Jun 26 '14 14:06 thomaseichinger