Program counter inadvertently jump to Boot ROM location

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Program counter inadvertently jump to Boot ROM location

655 Views
aporvasrivastava
Contributor I

Hi Team,

I am using MKE18F512VLH16 controller for my project. I want to understand that if there is any prevention or mitigation present to inadvertently update program counter to ROM Boot location (other than loader entry point) while running application from flash and if there is this control jump is possible then what will be behavior of controller.

Labels (1)
0 Kudos
3 Replies

643 Views
aporvasrivastava
Contributor I

My main question is regarding corrupted stack. What will be concurrence if stack is corrupted to ROM Loader location (other than loader entry point). Will this lead to any exception or execution will start from ROM?

0 Kudos

638 Views
bobpaddock
Senior Contributor III

It can deepened on your CPU core to some degree.

M0+ do not allow unaligned access so they would cause a hardware fault exception on a odd (vs even) return value 'returned' from the stack.

Otherwise execution will go to the address 'returned' via the stack and hard to say what can happen.

One theoretical scenario is the part of the bootloader initialization gets missed by jumping past it, so the bootloader ends up in some endless loop.

These are the cases that Watchdogs where meant to handle.

 

0 Kudos

651 Views
bobpaddock
Senior Contributor III

To be a little clearer, are you saying that you have running code now, that is randomly ending up in the bootloader?  The three most likely causes are a corrupted stack, a bad pointer-to-function, or hardware transients.

Or are you saying  that you want to control entry to the bootloader to prevent it from your application?
That is somewhat dependent on the CPU you are using.