Hi rahul,
What kind of log data you have?
As first I would like to recommend investigation of reset source:
1. Please, disassembly capacitor from reset pin if their capacitance is too high for recognition of COP/CM reset. More details: https://community.freescale.com/docs/DOC-103737
2. Please create specific routines for COP and CM reset vectors. For example:
//function prototype of _Startup function (Start12.c)
void _Startup(void);
//******************************************************************************
// COP interurpt
//******************************************************************************
#pragma CODE_SEG NON_BANKED
interrupt 2 void COP_ISR(void)
{
DDRA = 0xff;
PORTA = 0x00; //LEDs on - show we entered the COP_ISR
for(i=0; i<60000; i++) //delay
{
asm nop;
}
PORTA = 0xff;
asm jmp _Startup; //jump to power-on reset vector
// !!! RTI instruction cannot be executed because this is not interrupt !!!
}
#pragma CODE_SEG DEFAULT
Note: similar way we could define “interrupt 1 void CM_ISR” routine.
3. If COP or CM are not reset sources (e.g. LEDs do not signalize after spurious reset), we should clear PORF, LVRF and ILAF flags in CRGFLG register check these flags after spurious reset.If none of these reset sources are detected, only External Reset remains. Please check schematic…
4. If none of these reset sources are detected, only External Reset remains. Please check schematic…
The stack overflow may be tested by watermark technique – You will fill 0x2000 to 0x20FF by some known pattern e.g. 0x55 (directly after reset). After that, you will let run code and after some time, you could check how many bytes from the stack was used.
S12XE have three reset vectors. If all three vectors point to the same code, code execution time should be almost the same. Reset sequence length for system resets also depends on external pull-up resistor and capacitor at RESET pin.
I am afraid that I am not sure with your request about “the same function for RAM”.
Illegal address reset is caused by access to unimplemented memory. From this point of view it has no sense to think whether 0x00600000 is in RAM or Flash because this address is not valid.
After reset, CPU starts code executing from address stored in appropriate reset vector. If we want execute some code from RAM, we have to copy this code from flash to RAM and call this function (or jump to subroutine) in RAM. I do not see any difference between execution your Reset() function from flash or from RAM. Result will be the same.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------