2007-08-28 06:15 AM
2011-05-17 12:32 AM
I am getting data abort exception in my code. I confirmed that its not due to data transactions to the AHB memory space. There are other resons for this.
Most probably its due to Data TCM reads. I am using large array which is properly initialised. How should I handle this exception to resume normal operation.2011-05-17 12:32 AM
ACtually the DATA ABORT exception is raised for one of the following reason:
- Unaligned memory access An unaligned RAM data access is a read or write that involves an address that's not a multiple of the data size. - A write to ROM (flash) space - Memory access to reserved areas - An access to external unconfigured EBI bus. There is an irq exception you can handle to manage this error. I suggest to you to check your code in order to avoid the problem. Take care to reserve the right stack area for your code. Check if you have configured the RAM memory of your micro in the right way.2011-05-17 12:32 AM
On 25-09-2006 at 11:14, you wrote:
I am getting data abort exception in my code. I confirmed that its not due to data transactions to the AHB memory space. There are other resons for this.
Most probably its due to Data TCM reads.
I am using large array which is properly initialised.
How should I handle this exception to resume normal operation.
For starters, you might want to read this article:
http://www.embedded.com//showArticle.jhtml?articleID=192202641
Even though the article is about ARM7, many of the concepts are applicable to all ARM core versions. I would suggest you find the source of your data abort exception, [it is not that difficult], rather than resuming ''normal operation''. After all, the processor raised an exception from normal operation. When you include the data abort handler in your project, adjust the size of the data abort stack accordingly, else you invite another headache. Good luck.2011-05-17 12:32 AM
2011-05-17 12:32 AM
Hey hARMless,
Thanks for a reference to that article! It was great and went a long way to helping me understand why I was getting an abort exception. http://i.cmpnet.com/embedded/gifs/2006/0608/0806esdLynx02.gif Has anyone implemented a similar reporting mechanism (output Program Counter (PC), Link Register (LR), Stack Pointer (SP), etc.) that they would like to share? I've just been setting a break point inside the handler and using the debugger. However, having a nice way to output that info to the serial port would be a big time saver going forward. If anyone has one they want to share, I'm sure it would be much appreciated. If ST had one as part of the library, I bet that would go a long way to solving many customer support issues. If I don't hear back, I may try my hand at implementing something. BTW, my problem was solved by using volatile on a global variable. (sloppiness on my part). Solution was simple. Finding the problem took many hours.2011-05-17 12:32 AM
For some reason, when I use the BBCODE tags, this forum trashes my message. here it is again:
This is what I wrote a few days ago. It prints out the PC as well as decodes the LD/ST instruction that caused the data abort to show the register that holds the bad address. It would be nice if someone had a mini disassembler to do this. #pragma optimize=none void Abort_Handler(void) { // entire contents of register should be pushed on the staack // r0-r12, lr and spsr (15 values) unsigned long dummyStackPointer[1]; // this is a hack to get access to the stack frame from C. int i; uartDump(''\n\nData Abort. Register Dump:\n''); #define STACK_OFFSET 3 #pragma diag_suppress=Pe549 sprintf(exceptionBuffer, '' PC %08X\n'',dummyStackPointer[1+13+STACK_OFFSET]); uartDump(exceptionBuffer); if (dummyStackPointer[1+13+STACK_OFFSET] < 0x00080000) { sprintf(exceptionBuffer, '' opcode %08X (address ptr = R%2d)\n'', *(unsigned long*)dummyStackPointer[1+13+STACK_OFFSET], ((*(unsigned long*)dummyStackPointer[1+13+STACK_OFFSET]) >> 16) & 0xF); // quick and dirty disassembly of the opcode } else { sprintf(exceptionBuffer, '' invalid PC, cant disassemble\n''); } uartDump(exceptionBuffer); sprintf(exceptionBuffer, '' cpsr = %08X\n'',dummyStackPointer[STACK_OFFSET]); uartDump(exceptionBuffer); for(i=0;i<=12;i++) { sprintf(exceptionBuffer,'' r[%2d] = %08X\n'',i,dummyStackPointer[i+1+STACK_OFFSET]); uartDump(exceptionBuffer); } #pragma diag_warning=Pe549 uartDump(''Halting Execution.\n''); while(1); }2011-05-17 12:32 AM
Thanks lakata!
I'll give your code a try.