cancel
Showing results for 
Search instead for 
Did you mean: 

Jump from application program to Bootloader

garzarolli
Associate II
Posted on September 11, 2010 at 13:32

Jump from application program to Bootloader

3 REPLIES 3
Posted on May 17, 2011 at 14:06

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.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
garzarolli
Associate II
Posted on May 17, 2011 at 14:06

The IAP doesn't evaluate the BOOT Pin. I guess you are talking about the ISP, or?

Posted on May 17, 2011 at 14:06

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.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..