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

about code size

hi, I'm a C51 beginner,I writen a C51 program which generated binary code about 30Kbytes, but in .asm program,it generated binary code only about 16Kbyte. How can I save the C51 program's code size? thanks!

Parents
  • The 8051 prefered integer size is unsigned 8 bits or unsigned 1 bit.

    1)When ever possible use bit then unsigned char, then use char.

    2) Use the no integer promote option. This keeps intemediate calculation 8 bits. You might have to change your code to accomadate this.

    3) Avoid generic pointers, i.e. always prefer data*, idata*, pdata*, xdata*, or code* over a plain *.

    4) If you have the resources, store fequently use variable first in data, then in idata & pdata, and finally in xdata.

Reply
  • The 8051 prefered integer size is unsigned 8 bits or unsigned 1 bit.

    1)When ever possible use bit then unsigned char, then use char.

    2) Use the no integer promote option. This keeps intemediate calculation 8 bits. You might have to change your code to accomadate this.

    3) Avoid generic pointers, i.e. always prefer data*, idata*, pdata*, xdata*, or code* over a plain *.

    4) If you have the resources, store fequently use variable first in data, then in idata & pdata, and finally in xdata.

Children