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

"using 0" ==> weird bugs involving R0

we just figured out that placing "using 0" after an interrupt handler definition is a bad idea. At least when using optimize 9,size, "using 0" tells the compiler not to bother pushing/popping R0. Then it happily goes around writing to R0, doesn't pop it, and all sorts of interesting (bad) things happen. Take away "using 0," and the compiler starts pushing/popping R0, and life gets boring (good) again.

Parents
  • Spencer;
    The manual warns against "using 0". This gives the compiler/linker permission to trash some of the registers without saving. Since Reg Bank 0 is the default system Reg Bank, never attempt to re-assign.
    Also, just a note. Never skip a reg bank assignment. That is, don't assign "using 1" and "using 3". You just moved the stack pointer default to the last position of reg bank 3 and lost 8 precious bytes at the location of reg bank 2.
    Bradford

Reply
  • Spencer;
    The manual warns against "using 0". This gives the compiler/linker permission to trash some of the registers without saving. Since Reg Bank 0 is the default system Reg Bank, never attempt to re-assign.
    Also, just a note. Never skip a reg bank assignment. That is, don't assign "using 1" and "using 3". You just moved the stack pointer default to the last position of reg bank 3 and lost 8 precious bytes at the location of reg bank 2.
    Bradford

Children
No data