Other Parts Discussed in Thread: SYSBIOS
Hello support,
this question is related to the thread "e2e.ti.com/.../3615369, but more focused on ITRAP behavior.
I'm testing a reaction to NMI Illegal Operation.
In the "TMS320C28x CPU Instruction Set" document (par. 3.6) is written:
"An illegal-instruction trap cannot be blocked, not even during emulation.Once initiated, an illegal instruction
trap operates the same as a TRAP #19 instruction. The handling of an interrupt initiated by the
TRAP instruction is described in Section 3.5.2. As part of its operation, the illegal-instruction trap saves
the return address on the stack. Thus, you can detect the offending address by examining this saved
value.
I could not find further information about how get the "offending address", therefore I ask you
1. When I am inside the Illegal Operation ISR, at which SP location can I find the stored "offending address" ? (I guess it is a 32bit)
Is it at SP[-1] and SP [-2] ? Or the CPU saves it "before" the context saving ? At which offset, with respect of the current SP, can I find it ?
2. Is there a way to trigger the ITRAP #19, different than the statement __asm "TRAP #19" ?
I mean, calling TRAP #19 sure triggers the corresponding NMI, but what about the offending address, since actually there was not a real Illegal Operation ?
3. Do you have a short assembly example (suitable for Piccolo) about SP content reading, that I can insert in my TRAP #19 ISR ?
best regards
As additional information,
I have tried the following simple ISR function, triggered through TRAP #19
uint32_t IllegalOperationAddress;
interrupt void Cbk_ISR_IL_OP_handler(void)
{
__asm(" PUSH XAR1 ");
__asm(" MOVL XAR1, #IllegalOperationAddress ");
__asm(" MOVL ACC,*-SP[2] ");
__asm(" MOVL *XAR1, ACC ");
__asm(" POP XAR1 ");
}
and I see that I can transfer the content of SP - 2 into Accumulator and then into variable IllegalOperationAddress.
It seems to me that I just need to know which is the good offset where I can find the Illegal Address in stack, and I can have this "Illegal Address" into my variable IllegalOperationAddress.
By the way, I see that entering the ISR Cbk_ISR_IL_OP_handler() the SP increments of 15 units (I believe is the context saving) and then there is an additional increment of 5 due to the following instructions:
ASP
PUSH RB
MOV32 *SP++, STF
that are present also in case my ISR function is empty......therefore, can it really be that it is enough to me to know the proper offset to apply to the statement
__asm(" MOVL ACC,*-SP[offset] ");
in order to get the "offending address" ?
best regards