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

Need help on 8051 assembly code optimization

We are developing a product on 8051 microcontroller. We have done coding using assembly language. Right now our code size is very high and is overshooting the allocated ROM size.

We have started code optimization using “code optimizing tips†and by “optimizing the designâ€. But from “assembler and linker†I am unaware of any directive available for code optimization.

Please let me know for any tools/KEIL options which help in "Assembly code optimization" (Eg: Identifying repeated patterns, identifying duplicate expressions, removal of dead code, Suggesting right instruction etc…)

Parents
  • But from assembler and linker I am unaware of any directive available for code optimization.

    That's because, practically speaking, there isn't any. In theory there would be "linker code packing". But I don't think you have any chance to profit from that with hand-written assembly code.

    There's no nice way of putting it, so I'll be blunt: for what you're trying to do now, the original decision to do this code in assembly was spectacularly wrong. By coding assembly you assumed complete responsibility for all aspects of the code's performance. You refused to use the help offered by the tools --- so now you need to either help yourself, or buy external help, i.e. a consultant to revamp that code.

Reply
  • But from assembler and linker I am unaware of any directive available for code optimization.

    That's because, practically speaking, there isn't any. In theory there would be "linker code packing". But I don't think you have any chance to profit from that with hand-written assembly code.

    There's no nice way of putting it, so I'll be blunt: for what you're trying to do now, the original decision to do this code in assembly was spectacularly wrong. By coding assembly you assumed complete responsibility for all aspects of the code's performance. You refused to use the help offered by the tools --- so now you need to either help yourself, or buy external help, i.e. a consultant to revamp that code.

Children