How to solve the Trap3 TIN7 Nesting Error

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User18259
Level 1
Level 1
Hi,

Can someone help me checking if it`s correct to implement/solve the Trap class3 TIN7.

This issue was raised when finished a NMI trap handler and 2 instruction followed: rslcx, rfe
The NMI trap handler implemented like below:
void __trap(7) __vector_table(0) NMI_TrapService(void)
{
/* Set flag to indicate NMI trap raised */
}
2 instruction followed:
__asm (" rslcx");
__asm (" rfe");

then Trap class3 TIN7 was raised.

I`m not sure if there is some step missing or wrong. Please guide me.


Thank you in advance.
0 Likes
2 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
A Trap with Class 3 TIN 7 is a Nesting Error (NEST), per the TriCore Architecture Manual. A NEST will happen if CALL/RET and TRAP/RFE get mixed up - i.e., if you did a CALL, but the function ends in an RFE instead of a RET.

Can you double-check how NMI_TrapService is called? Perhaps an OS is getting in between. List out the code at BTV plus the Class 3 offset of 0x60, and see if it's jumping to NMI_TrapService, or if it's calling NMI_TrapService.

If you're using an OS, you might need to declare NMI_TrapService as a regular function rather than a trap.
0 Likes
User18259
Level 1
Level 1
Hi wrangler,

Yes, I`m using an OS from our vendor.
The NMI_TrapService is called in the way as below:
__asm (" call " NMI_TrapService);

After changed the declaration of this NMI_TrapService to a regular function, this issue has resolved.

Thank you again~
0 Likes