Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: WEMOS D1 mini
- Core Version: 95fd7b5
- Development Env: Visual Micro IDE
- Operating System: Windows
Settings in IDE
- Module: LOLIN(WEMOS) D1 R2 & mini
- Flash Mode: [qio|dio|other]
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method: [ck|nodemcu]
- Flash Frequency: [40Mhz]
- CPU Frequency: 80Mhz
- Upload Using: SERIAL
- Upload Speed: 921600
Problem Description
Using detachInterrupt after __attachInterruptArg with a non-null argument, that's also not incidentally of type ArgStructure (as defined in FunctionalInterrupt.h), leads to a crash.
MCVE Sketch
class Interrupt
{
public:
void ICACHE_RAM_ATTR isr() {}
static void ICACHE_RAM_ATTR isr_static(void* self)
{
if (self) static_cast<Interrupt*>(self)->isr();
}
};
Interrupt intr;
void setup()
{
Serial.begin(9600);
delay(1000);
__attachInterruptArg(D6, Interrupt::isr_static, &intr, CHANGE);
detachInterrupt(D6);
}
// Add the main program code into the continuous loop() function
void loop()
{
}
Debug Messages
Exception (9):
epc1=0x4020328b epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000017 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffdd0 end: 3fffffc0 offset: 01a0
3fffff70: 4010637c 3ffee248 402010f8 3fffefa0
3fffff80: 401003e4 3ffee2b4 3ffee348 4010043c
3fffff90: 3fffdad0 00000000 3ffee219 40201061
3fffffa0: feefeffe feefeffe feefeffe 402011a0
3fffffb0: feefeffe feefeffe 3ffe84f4 40100739
<<<stack<<<
:Error:9 -> LoadStoreAlignmentCause: Attempt to read/write memory with an unaligned address (for example, trying to read/write a 32-bit word at an address that is not a multiple of 4)
0x4020328b std
0x4010637c Interrupt
0x402010f8 esp_yield
0x401003e4 detachInterrupt
0x4010043c detachInterrupt
0x40201061 setup
0x402011a0 loop_wrapper()
0x40100739 cont_wrapper