Hi All,
Encountered a strange problem recently. Needed to check the checksum of the MSP430F2350 flash.
Was having a issue with the checksum wherein the ckecksum calculated is 0x40 (decimal 64) more than the expected value.
Further investigation lead me to the exact location this happened. This happened when the checksum calculation was done where _abort() function is placed in the flash.
Attached is the disassembly of abort.
C$$EXIT, abort:
0xc150: 43 03 NOP
Instead of adding 03 when C150 address was accessed, 43 was being added [ 43 was added once more when c151 address was used ].
Iam using CCE V3.1 and MSP430 USB debug interface along with eval board for doing the testing.
Following is the code snippet i used.
#define __MSP430F2350__
#include <msp430.h>
#include <intrinsics.h>
#include <stdio.h>
#pragma DATA_SECTION (CHECKSUM_VALUE,".newch");
unsigned long CHECKSUM_VALUE;
int main()
{
unsigned long checksumm = 0;
unsigned char* ptr = (unsigned char*)0xC000;
unsigned int i = 1;
WDTCTL = WDTPW + WDTHOLD; //STOP THE WATCHDOG FROM BARKING
for(; i <= 16384;i++,ptr++)
{
unsigned char ucVal = 0;
ucVal = *ptr; //this shows correct value @ c150 i,e 0x03 (\3)
//checksumm += *ptr;
checksumm += ucVal; //ucVal is shown incorrectly as 0x43 or 'C'
if(i%100 ==0)
_nop();
}
return 0;
}
Has any one faced such/similar problem.?
I can even mail a print screen of the CCE to show this problem in more detail.