Categories

{{ selectedCategory.name }}

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No topics found!

ARM Cortex-M: Application does not run correctly after download into Flash

24-Mar-2021

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.


Possible solution:

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  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).

Was this answer helpful?

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.

Similar topics

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No similar topics found!

Other topics in the same category

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No topics found!