This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Deleting .OBJs versus "Build All"

We're still getting some odd results from the C51 toolchain from time to time. We get different builds if we manually delete all .OBJs than if we tell uVision to "build all". You'd think that would replace all the .OBJs.

We get different code generated when the load is rebuilt with the two methods. And in the "build all" case, the loads often do not run correctly, while the manually deleted version does. I can't imagine why there's a difference in the two cases; you'd think "build all" would rebuild everything, and start just by deleting the existing .obj.


A couple of examples of the same section of code from the two different build methods:

version 1:

                R      MOV     DPTR,#entry
                       MOV     A,R6
                       MOVX    @DPTR,A
                       INC     DPTR
                       MOV     A,R7
                       MOVX    @DPTR,A
                                           ; SOURCE LINE # 189
                                           ; SOURCE LINE # 191
                 R     MOV     queues,#08H
                                           ; SOURCE LINE # 192
                 R     MOV     queues+01H,#08H
                                           ; SOURCE LINE # 194
                 R     MOV     DPTR,#entry
                       MOVX    A,@DPTR
                       MOV     R6,A
                       INC     DPTR
                       MOVX    A,@DPTR
                       ADD     A,#05H
                       MOV     DPL,A



version 2:
                       MOV     R3,AR7
                       MOV     R2,AR6
                                           ; SOURCE LINE # 189
                                           ; SOURCE LINE # 191
                 R     MOV     queues,#08H
                                           ; SOURCE LINE # 192
                 R     MOV     queues+01H,#08H
                                           ; SOURCE LINE # 194
                       MOV     A,R3
                       ADD     A,#05H
                       MOV     DPL,A


version 1:
         R     MOV     DPTR,#link
                       MOV     A,R7
                       MOVX    @DPTR,A
                       INC     DPTR
                       MOV     A,R4
                       MOVX    @DPTR,A
                       INC     DPTR
                       MOV     A,R5
                       MOVX    @DPTR,A
                                           ; SOURCE LINE # 552

version 2:
                R     MOV     DPTR,#igmp
                       MOV     A,R4
                       MOVX    @DPTR,A
                       INC     DPTR
                       MOV     A,R5
                       MOVX    @DPTR,A
;---- Variable 'link' assigned to Register 'R3' ----
                       MOV     R3,AR7



This code happens to be from the 7.10 compiler, but we see the same thing with 7.50. Optimizations level 9 or 11, register coloring enabled. Load is bank switched, using LX51.

Any clues as to what is going on? And is there a way to guarantee reliable results from the build short of manually cleaning up the last build every time?

Parents
  • Thanks for the suggestions.

    We clear out the old objects with a "del *.obj", so anything else hiding in that directory will still be around.

    Which file holds register coloring information?

    We do have a __DATE__ __TIME__ in one module which, well, displays the date and time of the build on a CLI over a UART. That file is marked as "always build" in uVision.

    Most of the differences look very much like optimization to me. Some differences just omit repeated loading of R3 with 1 for a generic pointer to xdata, for example, or have some DPTR accesses where a temp appears to spill out of the register set.

    The most disturbing thing is that the loads are functionally different. That is, we get bugs or the code hangs with build all, but if we delete the obj's and rebuild, it works fine. Same source.

Reply
  • Thanks for the suggestions.

    We clear out the old objects with a "del *.obj", so anything else hiding in that directory will still be around.

    Which file holds register coloring information?

    We do have a __DATE__ __TIME__ in one module which, well, displays the date and time of the build on a CLI over a UART. That file is marked as "always build" in uVision.

    Most of the differences look very much like optimization to me. Some differences just omit repeated loading of R3 with 1 for a generic pointer to xdata, for example, or have some DPTR accesses where a temp appears to spill out of the register set.

    The most disturbing thing is that the loads are functionally different. That is, we get bugs or the code hangs with build all, but if we delete the obj's and rebuild, it works fine. Same source.

Children