www.ti.com
Bootloader Code Listing (V3.0)
EDIS;
// Form BootMode from BOOT select pins
BootMode
= GpioDataRegs.GPADAT.bit.GPIO18 << 2;
BootMode |= GpioDataRegs.GPADAT.bit.GPIO29 << 1;
BootMode |= GpioDataRegs.GPBDAT.bit.GPIO34;
// Read the password locations - this will unlock the
// CSM only if the passwords are erased.
Otherwise it
// will not have an effect.
CsmPwl.PSWD0;
CsmPwl.PSWD1;
CsmPwl.PSWD2;
CsmPwl.PSWD3;
CsmPwl.PSWD4;
CsmPwl.PSWD5;
CsmPwl.PSWD6;
CsmPwl.PSWD7;
// First check for modes which do not require
// a boot loader (Flash/RAM/OTP)
if(BootMode == FLASH_BOOT) return FLASH_ENTRY_POINT;
if(BootMode == RAM_BOOT)
return RAM_ENTRY_POINT;
if(BootMode == OTP_BOOT)
return OTP_ENTRY_POINT;
// Otherwise, disable the watchdog and check for the
// other boot modes that requre loaders
EALLOW;
SysCtrlRegs.WDCR = 0x0068;
EDIS;
if(BootMode == SCI_BOOT) EntryAddr = SCI_Boot();
else if(BootMode == SPI_BOOT) EntryAddr = SPI_Boot();
else if(BootMode == I2C_BOOT) EntryAddr = I2C_Boot();
else if(BootMode == CAN_BOOT) EntryAddr = CAN_Boot();
else if(BootMode == PARALLEL_BOOT) EntryAddr = Parallel_Boot();
else return FLASH_ENTRY_POINT;
EALLOW;
SysCtrlRegs.WDCR = 0x0028; // Enable watchdog module
SysCtrlRegs.WDKEY = 0x55;
// Clear the WD counter
SysCtrlRegs.WDKEY = 0xAA;
EDIS;
return EntryAddr;
}
SPRU722C – November 2004 – Revised October 2006
Bootloader Code Overview
63