[ECOS] Macro cpu_to_je16 in jffs2.h compile error

Frank Lin franklin373@gmail.com
Fri May 30 03:51:00 GMT 2008


Macro #define cpu_to_je16(x) ((jint16_t){x}) compile to:



        struct jffs2_unknown_node marker = {
0xc11a13c <jffs2_mark_erased_block+608>:        sub     r3, r11, #76    ; 0x4c
0xc11a140 <jffs2_mark_erased_block+612>:        mov     r2, #12 ; 0xc
0xc11a144 <jffs2_mark_erased_block+616>:        mov     r0, r3
0xc11a148 <jffs2_mark_erased_block+620>:        mov     r1, #0  ; 0x0
0xc11a14c <jffs2_mark_erased_block+624>:        bl      0xc10bf60 <_memset>
            .magic =    cpu_to_je16(JFFS2_MAGIC_BITMASK),
0xc11a150 <jffs2_mark_erased_block+628>:        ldr r3, [pc, #1024] ; 0xc11a558 <jffs2_mark_erased_block+1660>
0xc11a154 <jffs2_mark_erased_block+632>:        sub     r2, r11, #80    ; 0x50
0xc11a158 <jffs2_mark_erased_block+636>:        mov     r12, #2 ; 0x2
0xc11a15c <jffs2_mark_erased_block+640>:        mov     r0, r2
0xc11a160 <jffs2_mark_erased_block+644>:        mov     r1, r3
0xc11a164 <jffs2_mark_erased_block+648>:        mov     r2, r12
0xc11a168 <jffs2_mark_erased_block+652>:        bl      0xc10bd04 <_memcpy>
0xc11a16c <jffs2_mark_erased_block+656>:        ldrh    r3, [r11, -#80]
0xc11a170 <jffs2_mark_erased_block+660>:        strh    r3, [r11, -#76]
            .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
0xc11a174 <jffs2_mark_erased_block+664>:        ldr r3, [pc, #992]  ; 0xc11a55c <jffs2_mark_erased_block+1664>
0xc11a178 <jffs2_mark_erased_block+668>:        sub     r2, r11, #76    ; 0x4c
0xc11a17c <jffs2_mark_erased_block+672>:        mov     r12, #2 ; 0x2
0xc11a180 <jffs2_mark_erased_block+676>:        mov     r0, r2
0xc11a184 <jffs2_mark_erased_block+680>:        mov     r1, r3
0xc11a188 <jffs2_mark_erased_block+684>:        mov     r2, r12
0xc11a18c <jffs2_mark_erased_block+688>:        bl      0xc10bd04 <_memcpy>
0xc11a190 <jffs2_mark_erased_block+692>:        ldrh    r3, [r11, -#76]     <-------these two instruction obviously error
0xc11a194 <jffs2_mark_erased_block+696>:        strh    r3, [r11, -#74]     <-------ram will be same value
            .totlen =   cpu_to_je32(c->cleanmarker_size)



I don't know why, maybe gcc bug, now I change macro to:
#define cpu_to_je16(x) ({jint16_t temp;temp.v16=x;temp;})
now result OK.


More information about the Ecos-discuss mailing list