AnsweredAssumed Answered

sc3000, c代码定义了const数组,数组被放在rom区,但是反汇编代码看,确回写了const数组的地址,编译器有bug吗?

Question asked by qiong zhang on May 5, 2016
Latest reply on May 5, 2016 by qiong zhang

sc3000, c代码定义了const数组,数组被放在rom区,但是反汇编代码看,确回写了const数组的地址,编译器有bug吗?

/* 0x00000f0c */    LOOPSTART3

                        moveu.w (r4),d8 ; 1 word prefix (1WHR)   //从常量数组中取值

/* 0x00000f10 */        [ ; 2 word prefix (2W)

                        tfr d8,d3                              

                        cmpeq d8,d2                            

                        tfr d8,d9                              

                        ]

/* 0x00000f1a */        [ ; 1 word prefix (1WHR)

                        add #<7,d3                             

                        tfrf d9,d11                            

                        btd <(*+44) /* L241 */                 

                        ]

/* 0x00000f22 */        [ ; 1 word prefix (1WHR)

                        asrr #<3,d3                            

                        add #<7,d11                            

                        ]

/* 0x00000f28 */        [ ; 1 word prefix (1WHR)

                        moveu.w (r4+>2),d3                     

                        asrr #<3,d11                           

                        ]

/* 0x00000f30 */        [ ; 1 word prefix (1WHR)

                        add d9,d3,d3                           

                        tfr d3,d9                              

                        ]

/* 0x00000f36 */        [ ; 1 word prefix (1WHR)

                        cmpeq d3,d2                            

                        add #<7,d9                             

                        ]

/* 0x00000f3c */        [ ; 1 word prefix (1WHR)

                        bf <(*+16) /* L242 */                  

                        asrr #<3,d9                            

                        ]

/* 0x00000f42 */        add d9,d11,d3 ; 1 word prefix (1WHR)   

/* 0x00000f46 */;  L241:

/* 0x00000f46 */;  L240:

/* 0x00000f46 */        [

                        tfr d3,d1                           

                        sub d0,d0,d0                        

                        ]

/* 0x00000f4a */        iadd d4,d1                          

/* 0x00000f4c */;  L242:

/* 0x00000f4c */        [ ; 2 word prefix (2W)

                        tfr d2,d3                           

                        move.w d8,(r4)                         //回写常量数组,导致异常                 

                        extractu #13,#3,d0,d8               

                        tfra r0,r1                          

                        and

Outcomes