Can someone tell me why my code (see below) is causing me to break in isr_trap.asm??? I have narrowed it down to a function I have created. If I comment out the function and put dummy characters in code works just fine....The function is nothing more than a rearrangement of an array....
here is a small piece of main. The function systemIdentification is causing the grief. p_Seq is an unsigned int*. Function is declared properly.
if (!swInfo.err && (swInfo.twoSec & 0x0080)) {
if (!flag)
p_Seq = systemIdentification(pSysID);
switch (i) {
case 0:
mssg[4] = (0xC0);
mssg[5] = (char)(*p_Seq);
break;
case 1:
mssg[4] = (0xA0);
mssg[5] = 0xA0;//(char)(*(p_Seq + 1));
break;
Here is the function :
unsigned int* systemIdentification (volatile char *p) {
unsigned int j, zero;
unsigned int realign[6] = {0};
static unsigned int result[4];
for (j = 0; j < 6; j++) {
if (*(p+j) == 0xFE)
zero = j;
}
for (j=zero; j < 6; j++)
realign[j-zero] = *(p+j);
for (j = 0; j < zero; j++)
realign[j + (6-zero)] = *(p+j);
for (j = 0; j < 4; j++) {
result[j] = realign[j+1]^realign[j+2];
}
return result;
}
Code keeps jumping to :
.sect ".text:_isr:__TI_ISR_TRAP"
.align 2
.global __TI_ISR_TRAP
__TI_ISR_TRAP:
BIS.W #(0x0010),SR
JMP __TI_ISR_TRAP
NOP ; CPU40 Compatibility NOP
