I cannot use the MSP430 ROM BSL, because the custom board, already in production, has a connector with the UARTs signals (not the hw BSL signals), and we cannot make hardware changes (it is a pity we cannot configure the hw BSL signals).
To run the my BSL I only modify the reset vector, set = 0xF000. So at reset the MSP430 starts my BSL. It waits a bit for a firmware upload at the UARTs, at the end it starts the firmware.
The problem is that my bootload has to work with a firmware, but the firmware doesn't know it is launched by my bootloader (and not by a normal cpu reset).
What do you think of this routine ?
void simulate_reset_and_run(void) // reset the MSP430 to start-up conditions and launch the firmware { // reset USARTs U0ME &= ~(UTXE0 + URXE0); UCTL0 = SWRST; U1ME &= ~(UTXE1 + URXE1); UCTL1 = SWRST;
// reset modified ports P2DIR= 0; P3DIR= 0; P3SEL= 0; P5DIR= 0;
// reset clock to POR/PUC - how to ?
// Init watchdog timer - it is safe ? WDTCTL= WDTPW;
// reset interrupts and their flags IE1= IE2= 0; IFG2= IFG1= 0;
// launch the firmware asm jump 0x1100 }
ciao, Massimo