SLAA450G April 2010 – April 2020
The BSL Protect function is called after each BOR and before user code is executed. There is no time and functionality limit placed on this code; however, if this function does not return, the device is rendered unresponsive. Excessively long delays in the return functions could lead to problems during debug. At its most basic, the BSL Protect function should perform two essential operations: protect the BSL memory and determine whether the BSL or user code should be executed after exiting the BSL Protect function.
The BSL Protect function is called with the stack pointer set to a default location, which is dependent on the device. Changing the stack pointer or manipulation of the stack pointer data values will most likely lead to a unresponsive device. In this case, nothing, not even reprogramming, will be possible. On some devices, the stack pointer space is very limited, and extensive use of the stack pointer within the BSL Protect function could lead to memory overflows. To ensure proper behavior, the stack access should be limited or the stack pointer should be moved to another location. To make sure that the device returns from the BSL Protect function correctly, the stack pointer must be restored before returning.