While working on the FRDM K64 I've noticed a strange behaviour; I've defined the blue led to toggle while working, among other functions which needs interrupts (using the example in the LPTMR driver source code). It toggles when working under Debug mode. In Release mode it does not. Obviously, the interrupt is not sent, which makes me wonder, whether the PIT interrupt (which I use for other functions) is not working also in Release mode?
Anything I can do to make it work under Release mode also?
Would you please tell us the version of KDS IDE are you using?
I test the lptmr driver example in SDK_2.1_FRDM-K64F with KDS3.2.
The red led will toggle with the default Optimization setting of release mode.
Check the LPTMR and NVIC values when working in debug and release mode. If you see a difference, check whether the release settings have higher optimisation setting and is optimising something away.
I've changed the optimization settings to '-none' and then interrupts came back. Other opt settings didn't work.
By the way, where/how do I check the values of NVIC/LPTMR?
With the debugger attached in each case, let the code run a sort time and pause. Then just look at the register view of the modules to see the differences.
If optimisation is causing problems you must have code that requires volatile definitions to ensure correct operation.
Although the tradition is to develop in debug mode and release in release mode this is not necessary a very wise strategy - I think that experienced developers will always work in release mode in order to find problems at the start of project rather at the end. It also means that all the development and testing that has been done in debug mode may be pointless in the release mode behaves differently (lots of effort down the drain). With a little practice it is not much harder to debug (even with GCC) in release mode and then you are continuously testing the final version all the time.
Newbie question... where do I look for the registers? I tried in the Registers tab but didn't find there the lptmr regsiters. I've installed EmbSys Registers, there I found the LPTMR, but in the debug and Release it is stuck at zero...
You need to double click on each register (EmbSys) that you want to monitor. They will display as green then and display the value when you step code.