Reputation: 143
the following code is seen in reset handler: asm("b .\n");
This is arm for processor. Can someone explain this?
Upvotes: 3
Views: 1675
Reputation: 9099
Reset handlers comes into picture when there is some Fault exception. Now you can build handlers to cover these exceptions but to keep bootloaders simple they are usually kept infinite loops(which is essentially what this asm code is).
Now to state that exceptions are not expected at bootloader stage is not essentially true. Even after development stages there can be exceptions, which are mostly of Hardware related; example bootloader unable to initialize some HW because it has gone bad.
Also at bootloader stage rebooting the system in reset handler doesn't make any sense, as whatever caused the fault in this stage will likely happen again in the next bootup and the system will keep rebooting. At least this way debugger can be attached and even though cpu registers will be useless, bootloader logs, ram content can be collected and analysed.
Upvotes: 1