Skip to content

setjmp issue #1689

@akouz

Description

@akouz

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: 11/jul/2017?
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 921600

Description:

ESP32 crashes when I run a cooperative operating system https://github.com/akouz/a_coos based on the standard "setjmp.h" library. I can run the sketch "a_coos.ino" on many microcontrollers, including ESP8266, but it does not work on ESP32.

As far as ESP32 Dev Board does not have built-in LED, to compile the sketch modify line 23 of "a_coos.ino" to

static int led = 5;

Debug Messages:

== COOS demo ==
.Guru Meditation Error of type LoadProhibited occurred on core 1. Exception was unhandled.
Register dump:
PC : 0x400d0ae1 PS : 0x00060930 A0 : 0x800d09d5 A1 : 0x3ffcf290
A2 : 0x800d09d5 A3 : 0x00000000 A4 : 0x80083a78 A5 : 0x3ffcf1c0
A6 : 0x00000000 A7 : 0x3ffcd380 A8 : 0x800d0bd5 A9 : 0x3ffcf2a0
A10 : 0x0000028b A11 : 0x0000028b A12 : 0x0001e2fb A13 : 0x3ffc2788
A14 : 0x3ffcf2b0 A15 : 0x3ffcf280 SAR : 0x00000017 EXCCAUSE: 0x0000001c
EXCVADDR: 0x800d0c39 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff

Backtrace: 0x400d0ae1:0x3ffcf290 0x400d09d2:0x3ffcf2c0 0x400dfe79:0x3ffcf2e0

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:716
load:0x40078000,len:0
load:0x40078000,len:11572
entry 0x40078a14
== COOS demo ==
.Guru Meditation Error: Core 1 panic'ed (Double exception)
Register dump:
PC : 0x40086b95 PS : 0x00050836 A0 : 0x800d0adc A1 : 0x3fffffdc
A2 : 0x4000004c A3 : 0x00000000 A4 : 0x3ffc2428 A5 : 0x400d088c
A6 : 0x3ffcf280 A7 : 0x3ffcf260 A8 : 0x3ffcf280 A9 : 0x09f53009
A10 : 0x00000077 A11 : 0x3ffc2430 A12 : 0x1009c500 A13 : 0xe52009d5
A14 : 0x00000020 A15 : 0xff000000 SAR : 0x00000017 EXCCAUSE: 0x00000002
EXCVADDR: 0x09f53008 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff

Backtrace: 0x40086b95Guru Meditation Error of type LoadStoreError occurred on core 1. Exception was unhandled.

Register dump:
PC : 0x400867d1 PS : 0x00060035 A0 : 0x80086910 A1 : 0x3ffffdfc
A2 : 0x40080b5c A3 : 0x00000000 A4 : 0x00000000 A5 : 0x3ffcf2e0
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x40080b5c A9 : 0x3ffffddc
A10 : 0x00000035 A11 : 0x3ffcf2c0 A12 : 0x800dfe7c A13 : 0x3ffcf2c0
A14 : 0x000237bc A15 : 0x3ffc2788 SAR : 0x00000017 EXCCAUSE: 0x00000003
EXCVADDR: 0x40080b5c LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000

Backtrace: 0x400867d1Guru Meditation Error of type LoadStoreError occurred on core 1. Exception was unhandled.

... etc, keeps repeating from "Register dump". Sorry, Exception Decoder decodes nothing out of it.

With some extra prints in the sketch I can see the following:

  1. Setup function void Coos::start(void) processed successfully, tasks invoked and return control to the scheduler. Thus, setjmp and longjmp functions work, I can store main context and then restore it.

  2. Function void Coos::run(void) crashes on line 123 of "coos.cpp", eg when it tries to invoke task using stored task context:

longjmp(task_context[task_no], 1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions