当第一次retVal = bslReadProgram运行错误后运行retVal = bslReadProgram2,为什么 retVal = bslReadProgram2正确运行后, 还会运行retVal = bslReadProgram3
if( eventFlag == 0 ) // No events to handle?
{
// Enter low-power mode 0 with interrupts enabled
_BIS_SR(LPM0_bits + GIE);
}
if( eventFlag & EVENT_SW1 )
{
num=0;
eventFlag &= ~EVENT_SW1; // Clear event flag
LEDPORTOUT &= ~(LED1+LED2); // Ensure LED3 and LED4 are off
retVal = 0; // Clear return value variable
bslEntrySeq(); // BSL entry sequence
if( retVal == 0 )
{
retVal = bslReadProgram(0x1000); // Download program to target BSL
}
if( retVal < 0 ) // Check result
{
LEDPORTOUT |= LED1; // Set LED3 to indicate an error
num=num+1;
if(num==1)
{
retVal = bslReadProgram2(0x1000);
}
num=num+1;
if(num==2)
{
retVal = bslReadProgram3(0x1000);
}
}
else
{
LEDPORTOUT |= LED2; // Set LED4 to indicate success
}
} |