Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task_wdt_isr causes illegal instruction during OTA partition erase #263

Closed
dac456 opened this issue Jan 18, 2017 · 1 comment
Closed

task_wdt_isr causes illegal instruction during OTA partition erase #263

dac456 opened this issue Jan 18, 2017 · 1 comment
Milestone

Comments

@dac456
Copy link

dac456 commented Jan 18, 2017

I've tested this both in my own code as well as the OTA example. The crash seems to occur when calling esp_partition_erase_range inside of esp_ota_begin.

I (1664) ota: Starting OTA example...
Guru Meditation Error of type IllegalInstruction occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x400d1dae PS : 0x00050031 A0 : 0x00040021 A1 : 0x3ffb0c70
A2 : 0x00000000 A3 : 0x3ffb0cb0 A4 : 0x4008152d A5 : 0x3ffb2494
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x08000000 A9 : 0x40084e0c
A10 : 0x3ff42000 A11 : 0x3ff42000 A12 : 0x00000000 A13 : 0x08000000
A14 : 0x00000003 A15 : 0x00000001 SAR : 0x00000014 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x400d1dae:0x3ffb0c70 0x00040021:0x00000000

GDB reports:

(gdb) info line *0x400d1dae
Line 55 of "/Users/dcook/Development/esp-idf/components/esp32/./task_wdt.c" starts at address 0x400d1dac <task_wdt_isr>
and ends at 0x400d1daf <task_wdt_isr+3>.

Adding the IRAM_ATTR flag to task_wdt_isr fixes the issue for me, and the docs state:

If the interrupt handler is not placed into IRAM, there is a possibility that interrupt will happen at the time when caches are disabled, which will cause an illegal instruction exception.

So this appears to be a bug.

@igrr
Copy link
Member

igrr commented Jan 18, 2017

We have a fix for this in the pipeline. Actually the bug here is not due to the lack of IRAM_ATTR on the ISR handler. Because esp_intr_alloc is called without IRAM flag, task WDT interrupt should be disabled automatically whenever flash cache is disabled. However there was a bug in the function which disabled interrupts... Adding IRAM_ATTR is a reasonable workaround, but the actual fix is (surprise!) just one character.

@igrr igrr closed this as completed in 7c155ab Jan 19, 2017
@igrr igrr removed the Status: In Progress Work is in progress label Jan 20, 2017
@igrr igrr modified the milestone: v2.0 Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants