Hi!
I have Olimex development board with msp430f5438 & microSD card. I need to develop fw update from SW card. Created fw.bin from IAR , then I copy fw.bin to 0x10000 of flash (bank 1) and then copy it starting from 0x5c00 (bank 0) via copy_to_ram function (below, example is from example files).
The problem is that if FW version is different from fw.bin verion , fw stacks at power up (in the first states, few commands after _program_start). If I use the same version - everything works fine. Could you please answer what can be the problem? How to solve it?
Thanks,
Boris
#pragma location="RAMCODE"
//------------------------------------------------------------------------------
// This portion of the code is first stored in Flash and copied to RAM then
// finally executes from RAM.
//-------------------------------------------------------------------------------
void write_block_int(void)
{
unsigned int i;
uint16 * Flash_ptr, *Flash_ptr_src;
Flash_ptr = (uint16 *)0x5c00; // Initialize write address
Flash_ptr_src = (uint16 *)0x10000; // Initialize write address
__disable_interrupt(); // 5xx Workaround: Disable global
// interrupt while erasing. Re-Enable
// GIE if needed
// Erase Flash
while(BUSY & FCTL3); // Check if Flash being used
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY+ERASE; // Set Erase bit
*(unsigned int *)Flash_ptr = 0; // Dummy write to erase Flash seg
while(BUSY & FCTL3); // Check if Erase is done
// Write Flash
FCTL1 = FWKEY/*+BLKWRT*/+WRT; // Enable block write
for(i = 0; i < fw_length/2; i++)
{
*Flash_ptr++ = *Flash_ptr_src++; // Write long int to Flash
while(!(WAIT & FCTL3)); // Test wait until ready for next byte
}
FCTL1 = FWKEY; // Clear WRT, BLKWRT
while(BUSY & FCTL3); // Check for write completion
FCTL3 = FWKEY+LOCK; // Set LOCK
P10OUT &= ~0xC0;
WDTCTL = WDT_ARST_1000 | /*WDTTMSEL_L | */WDTCNTCL_L;
//__enable_interrupt();
((void (*)())0x170)();
while(1);
}