Alice,
This is main function of the bootloader.
void main(void) {
INT8 c;
PLL_Init(SYNR_VALUE, REFDV_VALUE, POSTDIV_VALUE); //set 40MHz BUSCLK
FCLKDIV = FLASH_PRESCALER; //set flash prescaler
CopyCodeToRAM();
InterruptModuleSetup();
InitSCI(); //initialize SCI
EnableInterrupts;
OutStr("\f\r\nS12X Bootloader v1.0\r\n"); // sign-on
for(;;) {
//display menu
OutStr("\r\na.) Erase Flash\r\n");
OutStr("b.) Program Flash\r\n");
OutStr("c.) Set Baud Rate\r\n");
OutStr("d.) Execute Application\r\n");
OutStr("? ");
c = getchar(); //get choice
(void)putchar(c); //echo choice
OutStr("\r\n"); //next line
switch (c) {
case 'a':
c = EraseFlash();
if (c != 0) //go erase all the Flash (except the bootloader)
OutStr(GetErrorString(c)); //and report an error if there was one
else
OutStr("\r\nErased successfully!\r\n");
break;
case 'b':
c = ProgramFlash();
if (c != 0) //go program the Flash
OutStr(GetErrorString(c)); //and report an error if there was one
else
OutStr("\r\nDownloaded successfully!\r\n");
break;
case 'c':
SetBaud(); //go set the SCI baud rate
break;
case 'd':
AppExecute(); //go execute the application
break;
default:
break;
}
} /* loop forever */
/* please make sure that you never leave main */
}
I can see that with this programed into the S12x that it would continusly wait for keyboard input. That means the application code would never excute on startup. If the application code was running, then a command to jump to the bootloader would work. I just cannot see how the application would ever run so you can jump to the bootloader. This is a egg or chicken thing....
Ray.