??? 03/05/09 14:26 Read: times Msg Score: +1 +1 Informative |
#163094 - Requirements of "set ISP entry mode" IAP function |
Hi everyone,
I'd like to share what I found out about the IAP function "set ISP entry mode" of bootloader v7. When called from within the application, several RAM locations are mangled by this function. This is because it needs to change three bytes in the FLASH bank #1 and the task can be accomplished only by executing some code from FLASH bank #0. Hence, the function juggles with some portions of FLASH and RAM memories in order to copy data and code from/to bank #0 and bank #1, destroying the content of the RAM. More specifically, the involved memory ranges are (I analyzed the "always go to ISP" and "go to ISP when pin is low" modes only):
FLASH0 segment is restored, whereas data in BIT, IDATA, and XDATA memories are compromised. In my opinion, this side effect can be avoid in either of the following ways:
The latter can be achieved by following these steps:
The magic sequence is:
A backup can be avoided if you don't protect your code with a device signature:
|