I'm running code on a K60FX12VLQ12 in external flash memory through the aliased region of memory. I'm trying to run a demo program and it resets when running the wdog_disable function (it unlocks the the watchdog then clears the wdog enable bit in the control register). I see in the comments that you can't single step through this code because it has to finish within 20 clock cycles.
If I run the code in internal RAM or FLASH, it gets by the wdog_disable function every time. When I run the code in external flash it resets before it gets past this section of code. I tried lowering the waitstates from 4 to 2 and it still would reset before making it through.
Does the code run too slow in external flash to disable the watchdog?
I'm using IAR Workbench and did some tests using the CYCLECOUNTER value in the debugger with different builds. I set a breakpoint early in the bootcode where the wdog_disable function is called. I ran the code until it hit the breakpoint and recorded the CYCLECOUNTER for each memory type.
Code Memory CYCLECOUNTS
Internal RAM 19
Internal FLASH 23
External FLASH 574
**Incidentally, when I single step through the code it takes 18 counts no matter where the code is running. Does that have to do with the type of breakpoint?