Hi all,
My arm cortex A7 board has run RTEMS successfully now :)
There is a exception or a bug I find.
When using the rtems networking protocol, it's very easy to occur a data align 
exception like this,
---------------------------------------------------
*** FATAL ***
fatal source: 9 (RTEMS_FATAL_SOURCE_EXCEPTION)


R0   = 0x8d0c3380 R8  = 0x00000000
R1   = 0x00000014 R9  = 0x00000000
R2   = 0x0000003a R10 = 0x00000000
R3   = 0x0000003a R11 = 0x00000000
R4   = 0x8d1c4a1c R12 = 0x8d03f00e
R5   = 0x8d03f00e SP  = 0x8d1c49e8
R6   = 0x8d03f022 LR  = 0x802338fd
R7   = 0x8d1c49f0 PC  = 0x8023beea
CPSR = 0x60010173 VEC = 0x00000004
FPEXC = 0x40000000
FPSCR = 0x00000000
D00 = 0x600d0d06deadf00d
D01 = 0x0000000000000000
D02 = 0xfeaffcd61efcc7e8
D03 = 0xf55cbf675f9ed7ef
D04 = 0xf510b614876e87fe
D05 = 0x9c207dc5d1bff378
D06 = 0xffe3ffbfb3de176f
D07 = 0x856e2fff4bffdcf3
D08 = 0x0000000000000000
D09 = 0x0000000000000000
D10 = 0x0000000000000000
D11 = 0x0000000000000000
D12 = 0x0000000000000000
D13 = 0x0000000000000000
D14 = 0x0000000000000000
D15 = 0x0000000000000000
D16 = 0x0000000000004723
D17 = 0x48df800000000000
D18 = 0xae83ffc300000028
D19 = 0x7fbabb7bad21efbf
D20 = 0x08f6267cbc97ffe7
D21 = 0x7efeb9d0dfd3f6ad
D22 = 0x28e9be4f3ade887a
D23 = 0xb3fed9ab4edf7d59
D24 = 0x59f7f83df75bff56
D25 = 0x2cfdff5fadd6afdf
D26 = 0x737bf82beb84b8fa
D27 = 0xdfaf32b3fbf2d63f
D28 = 0xfcc7fe7e75f97ef5
D29 = 0xe3f3b3ebdff55d5f
D30 = 0x7d6c9c7bf8f27f6f
D31 = 0x9bfdb513aff9d2fc
RTEMS version: 5.0.0.67df1a5dfaf345cfa9101c42ba05174a41f3eaa5-modified
RTEMS tools: 7.3.0 20180125 (RTEMS 5, RSB 
77a00753035cd1f5ce224a2ae3afb27ea5a1bad8, Newlib 
2ab57ad59bc35dafffa69cd4da5e228971de069f)
executing thread ID: 0x08a010003
executing thread name: ntwk

---------------------------------------------------


The disassemble code near the exception place is this
---------------------------------------------------
8023beca:       e224            b.n     8023c316 <udp_input+0x502>
8023becc:       886b            ldrh    r3, [r5, #2]
8023bece:       461a            mov     r2, r3
8023bed0:       6cbb            ldr     r3, [r7, #72]   ; 0x48
8023bed2:       1a9b            subs    r3, r3, r2
8023bed4:       4619            mov     r1, r3
8023bed6:       6878            ldr     r0, [r7, #4]
8023bed8:       f7f2 f915       bl      8022e106 <m_adj>
8023bedc:       f107 042c       add.w   r4, r7, #44     ; 0x2c
8023bee0:       46ac            mov     r12, r5
8023bee2:       e8bc 000f       ldmia.w r12!, {r0, r1, r2, r3}
8023bee6:       c40f            stmia   r4!, {r0, r1, r2, r3}
8023bee8:       f8dc 3000       ldr.w   r3, [r12]

---------------------------------------------------


The exception is caused by "8023bee2:   e8bc 000f       ldmia.w r12!, {r0, r1, 
r2, r3}",
because the arm instruction "ldmia.w" needs the src address must be 4 byte 
aligned, 
but the exception context show the value of r12 is 0x8d03f00e, not 4 byte 
aligned.



The C code location is at cpukit/libnetworking/netinet/udp_usrreq.c, line 162
        /*       * Save a copy of the IP header in case we want restore it      
 * for sending an ICMP error message in response.        */     save_ip = *ip;


I think the root cause is the mbuf space is not 4 byte aligned, 
or by the reason of 14 bytes  ethernet header length that making "ip" is not 4 
byte aligned.


The exception can suppressed by memcpy, but it's not a good method.

------------------
Thanks & Best regards,
Rui Zhengxin
_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to