[En-Nut-Discussion] data abort in NutThreadSwitch

Coleman Brumley cbrumley at polarsoft.biz
Thu Feb 26 00:52:11 CET 2009


Hello,

I've implemented the _data_abort handler that Harald provided at
http://www.ethernut.de/en/documents/arm-exceptions.html.

When I run my application, I get "Data Abort at 0x19970 0xE8BD0010" in the
terminal and the app stops running since it goes into an endless loop in the
data abort handler.

I'm using ethernut v4.6.4 compiled with the gccdbg settings.  I've built the
OS using NutConf with the at91sam7x-ek.conf file.  

Based on my research, the abort is occurring in NutThreadSwitch.  When I get
to the data abort handler, LR is 0x19978 which is PC+8.  If I subtract 8
from that and use the gdb command x/i 0x19970, it shows:

(gdb) x/i 0x19970
0x19970 <NutThreadSwitch+68>:	pop	{r4}

The full assembler code is (from the gdb command disas 0x19970):

Dump of assembler code for function NutThreadSwitch:
0x0001992c <NutThreadSwitch+0>:	ldr	r3, [pc, #80]	; 0x19984
<NutThreadSwitch+88>
0x00019930 <NutThreadSwitch+4>:	ldr	r3, [r3]
0x00019934 <NutThreadSwitch+8>:	push	{r4, r5, r6, r7, r8, r9, r10, r11,
lr}
0x00019938 <NutThreadSwitch+12>:	mrs	r4, CPSR
0x0001993c <NutThreadSwitch+16>:	push	{r4}
0x00019940 <NutThreadSwitch+20>:	str	sp, [r3, #24]
0x00019944 <NutThreadSwitch+24>:	ldr	r3, [pc, #60]	; 0x19988
<NutThreadSwitch+92>
0x00019948 <NutThreadSwitch+28>:	ldr	r2, [r3]
0x0001994c <NutThreadSwitch+32>:	ldr	r3, [pc, #48]	; 0x19984
<NutThreadSwitch+88>
0x00019950 <NutThreadSwitch+36>:	str	r2, [r3]
0x00019954 <NutThreadSwitch+40>:	ldr	r3, [pc, #40]	; 0x19984
<NutThreadSwitch+88>
0x00019958 <NutThreadSwitch+44>:	ldr	r2, [r3]
0x0001995c <NutThreadSwitch+48>:	mov	r3, #1	; 0x1
0x00019960 <NutThreadSwitch+52>:	strb	r3, [r2, #21]
0x00019964 <NutThreadSwitch+56>:	ldr	r3, [pc, #24]	; 0x19984
<NutThreadSwitch+88>
0x00019968 <NutThreadSwitch+60>:	ldr	r3, [r3]
0x0001996c <NutThreadSwitch+64>:	ldr	sp, [r3, #24]
0x00019970 <NutThreadSwitch+68>:	pop	{r4}
0x00019974 <NutThreadSwitch+72>:	bic	r4, r4, #192	; 0xc0
0x00019978 <NutThreadSwitch+76>:	msr	SPSR_fc, r4
0x0001997c <NutThreadSwitch+80>:	pop	{r4, r5, r6, r7, r8, r9,
r10, r11, lr}
0x00019980 <NutThreadSwitch+84>:	movs	pc, lr
0x00019984 <NutThreadSwitch+88>:	eoreq	r5, r0, r4, asr #3
0x00019988 <NutThreadSwitch+92>:	eoreq	r5, r0, r0, asr #3
End of assembler dump.

If it helps, r4 at this point is 0x600000d3.  I'm not sure what r4 is
*supposed* to contain here, but that doesn't look valid to me. 

My application is based on the httpserv example, which is a multithreaded
http server with a CGI form.  This exception happens anytime I try to load
the web page.  The same code works (i.e. doesn't cause the data abort) with
an older version of Nut/OS (4.1.9.99).

Has anyone else encountered this?  If so, what did you do about it?  Any
idea what could be causing this?
 
Regards and TIA,
Coleman




More information about the En-Nut-Discussion mailing list