2010-09-11 04:32 AM
Jump from application program to Bootloader
2011-05-17 05:06 AM
When the application program jumps back to the reset adress of the Bootloader the IAP evaluates the jumper setting again and starts the in normal application without the bootloading routine.
This is simply not true, the boot loader does not evaluate the BOOT pin status (they effect which code is mapped/shadowed at zero at startup, but the RAM/ROM/FLASH always reside at their normal address), and setting up SP/PC to the entry point specified in the ROM will start execution of the code in the ROM. You can execute code in the ROM at any time while running your own boot code or app from FLASH. You had better be sure to be in near boot conditions, and not have interrupts and other nefarious peripherals, clocks and processes running. The cleanest way to achieve this is to reboot the processor into your own startup/boot code, and check a RAM based signature and jump directory into the ROM if the magic number is present, otherwise execute your normal startup.
2011-05-17 05:06 AM
The IAP doesn't evaluate the BOOT Pin. I guess you are talking about the ISP, or?
2011-05-17 05:06 AM
The IAP doesn't evaluate the BOOT Pin. I guess you are talking about the ISP, or?
Yes, perhaps I'm thinking of the ISP because you can't change it's behaviour, but don't you have total code ownership of the IAP (AN2557) code. If you don't want it to be dependent on the button, you could add code so it checks a RAM location for a magic value as well. Your application could set the magic value before rebooting. Alternatively you could set up a suitable boot environment within the application, *jumping* to a subroutine in the IAP that calls IAP_Init(), Main_Menu() and go from there. Either way you can modify the IAP Boot Code/Loader source to do *whatever* you want. You can also modify it so it can execute the ROM based ISP Boot Code/Loader regardless of the BOOT0/1 pins. The ability to do that will allow you to get out of a bind, if for example your application gets corrupted (IAP should really test it's integrity first), or you want to rewrite the IAP/APP FLASH with standard tools.