I have an application where an interrupt is enabled and inside the handler that the MCU vendor provides for it, I call a static function that's inside a class and requires a single argument, this function calls several variables, methods and constants within the scope of the class.
In debug build configuration this works fine, but the moment I switch on any optimization, the ISR part of the application crashes and actually never enters.
It is actually the only difference between the arguments passed to the compiler.
I tried with __attribute__((interrupt("IRQ"))
preceding the implementation of the function that's inside the class and called from the ISR without any luck.
How could I proceed with debugging this application, or what coudl I be missing? Thank you.
Edit: The arguments passed to the gcc_v6.3 compiler are
Debug build:
-O0 -g3 -Wall -c -fmessage-length=0 -ffunction-sections -fdata-sections -mcpu=cortex-m4 -specs=nosys.specs
Release build:
-O3 -Wall -c -fmessage-length=0 -ffunction-sections -fdata-sections -mcpu=cortex-m4 -specs=nosys.specs