Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By btidey
#65989 I was having crashes with pin change interrupt handler and thought that I should give the interrupt handler an ICACHE_RAM_ATTR but when I first tried to do this I was getting a 'not defined in scope' error from the compiler.

I.e. function without attribute compile -> OK, function with ICACHE_RAM_ATTR compile -> error.

I then thought maybe it would help if I put the interrupt handler definition above the setup code that called attachInterrupt. I had got used to the compiler not normally worrying about definition order.

That was the trick. Now compiled OK and crashes gone away in the runtime.

Not a problem now I know what to do, but I am curious why adding the attribute changes the compiler behaviour and whether there any other ordering rules to worry about.
User avatar
By RichardS
#91298 Not an Espressif issue, its Arduino and the funky way it deals with includes, total breaks the normal rules all the time.

RichardS