Two different applications (A and B) are added into a winIDEA workspace. Application A is debugged and then Application B is downloaded and debugged.
Once the Application B is downloaded the core is not stopped on the correct reset vector. Running the core from this state results in Hard Fault exception. Resetting the core after download but before running, fixes the issue. Further on, Application B runs OK when the device is running standalone or is in reset after download.
1. Open Hardware menu / CPU Options / Reset page.
2. Enable option Reset CPU after Download.
Immediately after reset, Cortex-M device loads stack pointer (SP) and program counter (PC) registers with values from Flash (usually address 0x0000’0000 and 0x0000’0004 respectively). winIDEA proceeds with programming Application B, the SP and PC are still loaded with the values from Application A. After programming operation completes, the Flash now contains changed stack pointer value and reset vector. However, for the core to correctly execute the new Application B the change values must be updated into respective core registers. This can be done multiple ways in winIDEA, but, for this specific use case, it is recommended that you configure an automatic reset of the device after programming (Download).
Sorry this article didn't answer your question, we'd love to hear how we can improve it.
Note: This form won't submit a case. We'll just use it to make this article better.