Hello Team,
I am handling machine exception in software as shown below.
interrupt 5 void ECC_ISR(void)
{
/* Log the DTC */
__asm(JMP 0x00FFFFFC ); /* I am not able to jump to reset vector */
}
Vector 0 is mapped to _Startup
I believe something gone wrong with startup stack initialization as shown below
_EXTERN_C void _Startup(void) {
__asm {
LD S, #__SEG_END_SSTACK-1 /* initialize SP */
#ifdef __ALIGN_STACK_OPT__
TFR S, D6 /* align SP to 4*/
AND D6, #-4
TFR D6, S
#endif
}
DoZeroOut();
DoCopyDown();
#ifdef __cplusplus
__static_init();
#endif
main();
}
static void DoZeroOut(void) {
__asm {
LD D6, _startupData.nofZeroOuts
BEQ end /* nothing to do */
LD X, _startupData.pZeroOut
zeroOutLoop:
LD Y, (0,X) /* X points to the first range */
LD D7, (3,X) /* D7 holds size */
doZeroOut:
CLR.b (Y+)
DBNE D7, doZeroOut
LEA X, (7,X)
DBNE D6, zeroOutLoop
end:
}
}
static void DoCopyDown(void) {
__asm {
LD Y, _startupData.toCopyDownBeg
BEQ end /* the pointer is NULL */
nextItemLoop:
LD D6, (Y+) /* load the size */
BEQ end
LD X, (Y+) /* load the destination */
copyLoop:
MOV.b (Y+), (X+) /* copy the data */
DBNE D6, copyLoop
BRA nextItemLoop
end:
}
}
In Machine exception handler I am not able to jump to reset vector address 0x00FFFFFC .
How I can make it work ?
Please suggest.
Thank You very much.
Best Regards,
charudatta