Other Parts Discussed in Thread: CC430F5137
Hello folks,
I'm thinking about adding FOTA upgrades for my CC430F5137. Here are the two sources that I have been learning from:
- https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/272514
- http://www.ti.com/lit/an/slaa511a/slaa511a.pdf
So, here is what I understand and a few related questions:
- From Jens-Michael Gross's response, the new firmware is received and stored in an unused part of the flash memory
- When the firmware is completely received, the MSP430 restarts and goes into the custom BSL. However, looking at the download package from (2), how is the BSL any different from other code? I don't see any additional decoration around the main() function (see below for what I mean). Or should I look at a different example?
- The BSL needs to run in RAM; this makes sense or else we'll be clobbering some parts of the BSL.
- Again, from Jens-Michael Gross's response, the new firmware is copied to the location of the current firmware (I believe this starts at 0x8000 for the CC430F5137). Is there no way to do some kind of remapping of flash memory to avoid this copy?
Main function in the Core BSL:
//******************************************************************************
// @fn main
// @brief Starting point of the WBSL, calls the needed routines prior
// to starting main program or entering WBSL
// @param none
// @return none
//******************************************************************************
void main()
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
// Upon power-up, check whether to run the Boot Loader or the Main Program.
init_buttons(); // Enable S1 button of FRAM board
__delay_cycles(1000); // Allow S1 to settle
if (TI_CC_SW_PxIN & TI_CC_S1) // Check S1 pin state
{
TI_CC_SW_PxREN &= ~TI_CC_S1; // Restore default S1 port state
startMainProgram(); // Transfer execution
} // In case this fails, start WBSL, sleep
else
{
TI_CC_SW_PxREN &= ~TI_CC_S1; // Restore default P4 state
}
cbsl_init(); // Enter the WBSL
}