Terje,
What I meant is not "how do you determine the program is stopped?"
How do you determine the last code that was executed?
Are you running the debugger one instruction at a time and it never returns from _iap_entry "erase sectors" command?
In other words, are you sure it never entered the loop to copy the 1024 bytes to data array?
You can create and place in RAM the following:
NMI_Handler, // The NMI handler
HardFault_Handler, // The hard fault handler
MemManage_Handler, // The MPU fault handler
BusFault_Handler, // The bus fault handler
UsageFault_Handler,
Just have them stay in an infinite loop. Then you can determine if any of these exceptions occurred.
And yes, moving the vector table to RAM is a good idea. You need to do it anyway for this test.
hope this helps