The idea is that any new firmware does not include the upper 512bytes of Flash,
but as IRQ vectors will change with new firmware but is now part of the firmware-block as compiler Intvec have been moved -512 bytes down.
If you put your custom Loader in the upper 512bytes too and as you never erase this block, much less chance of bricking.
I guess opcode for BR could change from msp family? but this does work on a G2553.
CCS could use pragma location if it can not handle @
Not all vectors are available or used, so you should fill them with random value instead for the BSL password if you want some security.
But at least the BSL password will now stay the same from reversions.
static const unsigned int jumptable[49] @0xFF9E = {
0x4210,0xFDE0, // indirect BR &0x----
0x4210,0xFDE2,
0x4210,0xFDE4,
0x4210,0xFDE6,
0x4210,0xFDE8,
0x4210,0xFDEA,
0x4210,0xFDEC,
0x4210,0xFDEE,
0x4210,0xFDF0,
0x4210,0xFDF2,
0x4210,0xFDF4,
0x4210,0xFDF6,
0x4210,0xFDF8,
0x4210,0xFDFA,
0x4210,0xFDFC,
0x4210,0xFDFE,
0x0000, // BSL signature
0xFF9E,0xFFA2, // real intvec
0xFFA6,0xFFAA,
0xFFAE,0xFFB2,
0xFFB6,0xFFBA,
0xFFBE,0xFFC2,
0xFFC6,0xFFCA,
0xFFCE,0xFFD2,
0xFFD6,0xFFDA
};
int main( void )
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
if (jumptable[0] == 0xffff) {while(1){};}; // need to use array for something
Override default location of linker file and make a copy of it and move it to local project folder and edit:
// ------------------------------------- // Signature memory and interrupt vectors // -Z(CONST)SIGNATURE=FFDE-FFDF // used by BSL -Z(CODE)INTVEC=FDE0-FDFF // normally FFE0-FFFF -Z(CODE)RESET=FDFE-FDFF // normally FFFE-FFFF