This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
A quick question. I am using a TMS320f28335 with CCS 5.3.00090 and and XDS560v2. I am trying to debug a rather nasty problem in which the stack pointer seems to get corrupted, and then bad data appears in the registers. Examination of the stack suggests that an IRET is executing with the stack pointer pointing to the wrong place, corrupting those registers saved automatically during interrupt response. This results in AMODE=PAGE0=1, and VMAP=0, so a bit of a mess. Examination of the stack shows a storm of interrupts, the first of which I can't identify, but which jumps to 0000h (the stacked return address is 0x00000001). There it attempts to execute an addressing mode which, due to AMODE=PAGE0=1, causes an illegal opcode trap. The vector for this is fetched from 0x00000026, whereas, with ENPIE still set to 1, and the vectors intact at 0xD00, makes no sense to me. In the default state of the system, the address at 0x00000026 points to another illegal opcode, hence the storm of interrupts which overflows the stack. I have verified with the use of hardware watchpoints that the vector is indeed being fetched from 0x00000026, using the debugger to load different addresses there.
Two questions:
1) My understanding was that if ENPIE is set, the vectors would automatically be fetched from the PIE vector table, regardless of the state of VMAP. This is demonstrably not happening.
2) Another puzzle is that the debugger appears to allow me to single step even though the DBGM bit remains set. I have tried this after a reset and it still works, single steps seem to be possible with DBGM set. Also, I managed to trigger a HW watchpoint with DBGM seemingly set.
Any help at all appreciated.
Cheers
Geoff
Geoffrey Mortimer said:1) My understanding was that if ENPIE is set, the vectors would automatically be fetched from the PIE vector table, regardless of the state of VMAP. This is demonstrably not happening.
No. VMAP has to be 1 in order for the PIE to respond. If VMAP is 0, then ENPIE is ignored. Refer to table 109 "Interrupt vector table mapping" in www.ti.com/lit/SPRUFB0D
Geoffrey Mortimer said:2) Another puzzle is that the debugger appears to allow me to single step even though the DBGM bit remains set. I have tried this after a reset and it still works, single steps seem to be possible with DBGM set. Also, I managed to trigger a HW watchpoint with DBGM seemingly set.
I'll need to refresh my memory a bit and get back to you. It may be that you are in "rude realtime mode" in which case DBGM is being ignored.
I'll also re-read your whole post and see if I think of anything to try.
Geoffrey Mortimer said:The return address for all successive interrupts is 0x8245 (due to the code loader used by the debugger leaving 0x8244 at location 0x0026).
Is this location being used by the code? If it is, you might try reserving it so you can use it for debug. I would an address there and have an ESTOP0 where it points to. That way you can stop the storm and maybe debug before it gets out of hand.
Another thing to check is that the prefetch is not going beyond valid memory. There is an errata in www.ti.com/lit/SPRZ272 that describes this. The CPU will get an invalid opcode - the "adding a NOP" fixes it makes me suspect this errata as a potential cause.
-Lori
Geoffrey Mortimer said:I am looking at a typical-for-automotive (don't worry, only a racing car!) interim solution in which I load a vector at 0x0026 which points to code which resets the processor by writing zero to the watchdog control register in the event of an illegal opcode trap occurring when the vectors are mapped at 0x0000.
Oops I missed this the first read through ! You could try vector 0x26 pointing to an ESTOP0 to halt and possibly debug back one step to how the PC got there.
Geoffrey Mortimer said:Oh for a trace debugger!
Yes. I know. I've debugged many issues where I wish we had trace on these devices.
-Lori
Hi Geoffrey,
Please refer restrictions part in section "RPTB label, loc16 Repeat A Block of Code" (page # 127) of this document.
Regards,
Vivek Singh
1) Do library routines use RPTB blocks?
Is it necessary for an RPTB block to be interrupted in order for there to be a problem, or can executing POP RB before returning from an interrupt sometimes cause problems in any case if not preceded by SETC INTM?
Hi Vivek
This seems to solve our problem - I have run with SETC INTM in the two ISRs which re-enable interrupts for 72 hours with no problem. One problem is that modifying the code often makes the problem go away on its own, and it is very intermittent. As a control, I have changed the instructions to CLRC INTM (which does nothing, but maintains the alignment of the code) and rerun the test, and the problem has returned.
We will now need to test this code on a my customer's boards, if successful I will mark the problem as solved!
Many thanks
Geoff
Hi Vivek
It has been running for 150 hours without problems with your suggested mods, Then I substituted NOPS for SETC INTM to preserve the timing, and it crashed. So I can be pretty confident the problem is solved. Many thanks indeed.
I think it might be worth documenting this more prominently. Many systems without RTOS need to re-enable interrupts in the slower routines, these, in my estimation, account for about half the systems out there. It really would not hurt to make this problem more evident than hiding it in the FPU manual.
Anyway, I reiterate my thanks!
Best regards
Geoff