CopyThreads icon indicating copy to clipboard operation
CopyThreads copied to clipboard

Exception running on NodeMCU

Open DE-lab opened this issue 4 years ago • 1 comments

Hi

I would like to use CopyThreads but get the following exception (continuously) when running on NodeMCU (12-E) 8266 (flashed for Arduino IDE c++). I used your blink example verbatim.

Thanks

Daniel

14:22:40.230 -> LED1 HIGH67 14:22:40.247 -> 14:22:43.397 -> --------------- CUT HERE FOR EXCEPTION DECODER --------------- 14:22:43.431 -> 14:22:43.431 -> Soft WDT reset 14:22:43.442 -> 14:22:43.442 -> >>>stack>>> 14:22:43.446 -> 14:22:43.446 -> ctx: cont 14:22:43.453 -> sp: 3ffffdd0 end: 3fffffc0 offset: 01a0 14:22:43.473 -> 3fffff70: 00000000 feefeffe 40201298 40201280
14:22:43.492 -> 3fffff80: 3fffdad0 00000000 3ffee4d8 40201126
14:22:43.515 -> 3fffff90: 3ffee588 00000000 3ffee574 4020144e
14:22:43.540 -> 3fffffa0: feefeffe feefeffe feefeffe 40201cf4
14:22:43.564 -> 3fffffb0: feefeffe feefeffe 3ffe85d8 40100bc9
14:22:43.592 -> <<<stack<<< 14:22:43.596 -> 14:22:43.596 -> --------------- CUT HERE FOR EXCEPTION DECODER --------------- 14:22:43.635 -> 14:22:43.640 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6) 14:22:43.664 -> 14:22:43.664 -> load 0x4010f000, len 3460, room 16 14:22:43.681 -> tail 4 14:22:43.697 -> chksum 0xcc 14:22:43.705 -> load 0x3fff20b8, len 40, room 4 14:22:43.807 -> tail 4 14:22:43.807 -> chksum 0xc9 14:22:43.814 -> csum 0xc9 14:22:43.820 -> v00042290 14:22:43.825 -> ~ld 14:22:43.830 -> LED1 HIGH67 14:22:43.846 -> 14:22:46.725 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------

DE-lab avatar May 25 '21 12:05 DE-lab

Hey Daniel, thank you for reporting the issue. i never tried the code on esp8266/Xtensa. It might be, that the stack_size calculation in https://github.com/jensh/CopyThreads/blob/master/src/cthread.c#L218 is wrong, or _cth_backup_stack()/_cth_restore_stack() doesn't work on that platform the way it is implemented. There are a lot of (maybe wrong) assumptions in the c-code, to avoid arch-specific inline assembler code. You might try a lower compiler optimization level (-O0) for cthread.c.

Isn't NodeMCU itself multi-threaded? There might also be a conflict between copyThreads longjmp/setjmp usage with NodeMCU. Your log-dump doesn't give me any hint. Sorry.

jensh avatar May 25 '21 19:05 jensh