Help Implementing a Bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help Implementing a Bootloader

1,644 Views
airbusboy
Contributor I
Hi

I'm currently attempting to implement a bootloader application residing on an MC9S08GQ8 based upon the information located in AN2295. Ultimately, the bootloader will perform in-system (re)programing via the SCI.

I'm envisaging the bootloader residing in an area of protected Flash, with the interrupt vectors relocated to an area of unprotected Flash. The PE has taken care of that for me but i'm slightly unsure to whether or not interrupts can be executed by the bootloader itself. I've placed a 16-bit timer interrupt routine in the bootloader code but it never actually gets executed - that would suggest the former...

Some threads i've read state that a bootloader cannot execute interrupts whilst others i've read suggest that they can with some "work". Can some one please clarify this ? If they can, are there any C code examples around that demonstrate this ?

Many thanks

Gary
Labels (1)
0 Kudos
2 Replies

319 Views
Sampson
Contributor I
When the flash is protected the vectors (except reset) actually move to the highest addresses in the  unprotected flash.   Since  the processor cannot change the protected region on the fly. this does indeed make it difficult to use interrupts while in boot programming mode.  I wrote non-interrupt code that ran the SCI enough for boot programming to work. 
I guess it would be possible to temporarily modify the vectors at the top of the unprotected section to point to routines in the protected section (boot code) and use those interrupts.  You would then have to, as the last thing you do, program the top of the unprotected section with the new vectors.  Although
this is possible, I believe you increase your odds at "paperweighting" your product if something goes wrong.
0 Kudos

319 Views
bigmac
Specialist III
Hello,
 
Just thinking out loud -
 
What if the SCI vector, where ever it may reside, actually pointed to a fixed location in RAM, that contained a JMP instruction to the required ISR.  The bootloader could initialize the RAM for its own purpose, however when the user program is run, one of the first tasks would be to initialize the RAM to jump to the correct user ISR.
 
No doubt others will reveal the flaws in this reasoning.
 
Regards,
Mac
 
0 Kudos