Bootloader in MC9S08AW32

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

Bootloader in MC9S08AW32

2,153 Views
Daniel_FE
Contributor I
Dear all:
 
I had a problem in bootloader. Hope someone can help me.
 
I designed a bootloader in MC9S08AW32.
 
Everything was ok for my main app. and bootloader.
 
But when I did a  reset (illegal opcode reset) or call the _startup() routine from main app.
The MCU will be hanged.
 
I try to debug this issue, but I can't find the problem.
 
My bootloade was located in 0xF000-0xFFAF , and flash protected function enable , interrupt vector redirection enable.
I want to use the interrupt in my bootloader, so I made a interrupt vector re-mapping to ram.
 
So I can run the interrupt between main app. and bootloader.
 
I try to use the Freescale orignal bootloader, and no problem in doing a reset or calling a _startup().
 
Does anyone help me?
Thanks.
 
P.S. Sorry my poor english. Hope everybody can understand my english.
 
Labels (1)
0 Kudos
Reply
1 Reply

437 Views
ajn
Contributor I
Hello!
Are you sure that the bootloader reset vector points at _startup() function? In the prm-file you use the command:
 
VECTOR 0 _Startup.
 
But this is the case if you do not run interrupts in your bootloader.
 
Try to add this command to your prm file and see if you got an error message that the interrupt vector table (the reset entry) and this command point at the same place.  If this is the case you are pointing at right location.
 
 
If you have change  NVPROT_INIT,  NVOPT_INIT registers you need to go to the redirect table location to find the interrupt vector are you doing this when you coping the interrupt table to RAM in the bootloader?
 
The first part of the interrupt table is not used so you have add correct offset for the interrupt table. Have you done that?  I use 4 kb protection and this gives following interrupt vector table in my application program.
 
void (* const _vect[])() @0xEFCC = {   /* Interrupt vector table */
         UNASSIGNED_ISR,               /* Int.no. 25 Vrti (at EFCC)                  Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 24 Viic1 (at EFCE)                 Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 23 Vatd1 (at EFD0)                 Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 22 Vkeyboard1 (at EFD2)            Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 21 Vsci2tx (at EFD4)               Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 20 Vsci2rx (at EFD6)               Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 19 Vsci2err (at EFD8)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 18 Vsci1tx (at EFDA)               Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 17 Vsci1rx (at EFDC)               Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 16 Vsci1err (at EFDE)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 15 Vspi1 (at EFE0)                 Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 14 Vtpm2ovf (at EFE2)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 13 Vtpm2ch4 (at EFE4)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 12 Vtpm2ch3 (at EFE6)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 11 Vtpm2ch2 (at EFE8)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no. 10 Vtpm2ch1 (at EFEA)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no.  9 Vtpm2ch0 (at EFEC)              Unassigned */
         LEDTimer,                     /* Int.no.  8 Vtpm1ovf (at EFEE)              Used */
         UNASSIGNED_ISR,               /* Int.no.  7 Vtpm1ch2 (at FFF0)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no.  6 Vtpm1ch1 (at FFF2)              Unassigned */
         UNASSIGNED_ISR,               /* Int.no.  5 Vtpm1ch0 (at FFF4)              Unassigned */
         isrVicg,                      /* Int.no.  4 Vicg (at FFF6)                  Used */
         UNASSIGNED_ISR,               /* Int.no.  3 Vlvd (at FFF8)                  Unassigned */
         UNASSIGNED_ISR,               /* Int.no.  2 Virq (at FFFA)                  Unassigned */
         UNASSIGNED_ISR,               /* Int.no.  1 Vswi (at EFFC)*/
       //  _Startup                      /* Int.no.  0 Vreset (at EFFE) */
 };
 
 
 
 
0 Kudos
Reply