We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HI all iam working on cygnal mcus,we have limited keil programme space of 1000bytes now my programme is yet to cross the limit . how to reduce the code size , if any one knows please put a reply to me regards john e
What optimisation setting are you using for the Compiler and/or Linker? Have you read the Appendix "Writing Optimum Code" in the Manual? Other things to look at: Remember that accessing XDATA is both slowest and uses most code; PDATA is quicker, and uses less code; DATA is quickest, and uses least code. Loops counting down to zero are more efficient, as the compiler can use the DJNZ instruction. Remember that printf uses loads of code! Avoid int and anything larger; if you haven't already, try disabling ANSI Integer Promotion. Use Register Banks for your ISRs. Use Keil's bit extension for Boolean flags.
Pay attention to function parameter size and order. Read the function parameter passing section in the manual, so that you understand what the compiler will do with your parameters. Try to avoid writing functions that will spill parameters out of registers, and try to declare all your functions so that re-used parameters will stay in the same registers.