Hi, I'm doing a comparison between BL51 and Lx51 to determine the code space savings- I'm a bit suprised to see that for the same project, Lx51 yields a code reduction of only 0.6%- I've enabled the AJMP/ACALL setting, and altered the optimisation levels (speaking of which, under Lx51 raising the optimsation levels from 9 to the 'new' levels of 10/11 actually increases the code size) Does anyone have any similar experience of this phenomena- or any suggestion as to what else I should try to get the touted 10-15% reductions available using LX51? I'm only using the 'BANKAREA' LX51 controls... Thanks David
I came to this discussion kind of late. I was looking to understand why level 10 and 11 seem to make my gnerated .BINs larger. My projects are pretty big, getting just up to the 64K limit of teh classic 8051 architecture. I have very carefully followed all optimization instructions. However, you said that I must have done somethign wrong if I do not see a 5%. Please hlep me find what I did wrong so I can get this benefit. I really need it in some of the bigger varients of my project.
You should see a impact of at least 5% on a large application like yours. If you have not improvment, then you have most likely a configuration mistake of the toolchain. Maybe the optimization level is hard coded in some header file and overrules the command line settings.
Developers who get very little size reduction typically don't have much that can be optimized (lots of const data, tables, initialized variables, or just simply write optimal code to begin with). It's kind of ironic, isn't it that the better programmer you are, the less the optimizer helps. The Irony comes from the fact that if you are not very good, you will probably not work on projects large enough to need optimization. Erik
Linker code packing and AJMP/ACALL substitution is not very effective on small applications (that's why I asked the application size). In fact, there are a NUMBER of things that can reduce the effectiveness of the optimizer.
Common area: 14553 (inc. 3345 bytes const data) Bank 0: 62646 Bank1: 47812 I'm interested-how is this useful?
How many bytes TOTAL is your program? Jon
"I don't care where the optimisation takes place- If using LX51 provides me with two extra levels of optimisation (and a bigger hole in my pocket after buying PK51), I don't think it's unreasonable to expect an overall reduction in code size" I agree, although as noted elsewhere the extra two optimisation levels are at best of dubious value. The big saving comes with the code packing jump/call optimisation. "I can only assume that our projects are atypical..." Maybe - do you have a large amount of constant data or something?
"Most of the optimization takes place in the compiler, so BL51 vs LX51 doesn't really say anything about the efficiency of the optimizer." I don't care where the optimisation takes place- If using LX51 provides me with two extra levels of optimisation (and a bigger hole in my pocket after buying PK51), I don't think it's unreasonable to expect an overall reduction in code size, especially since, according to Keil: "The LX51 has Linker Code Packing which reduces typically code size by 10..15% compared to the maximum optimizations that you can get with BL51" I can only assume that our projects are atypical...
"Most of the optimization takes place in the compiler, so BL51 vs LX51 doesn't really say anything about the efficiency of the optimizer. Did you turn on "linker code packing", under LX51? Turning it on can sometimes reduce code size dramaticly." That's a bit contradictory, isn't it? Or don't you count linker optimisations as optimisations?
Most of the optimization takes place in the compiler, so BL51 vs LX51 doesn't really say anything about the efficiency of the optimizer. Did you turn on "linker code packing", under LX51? Turning it on can sometimes reduce code size dramaticly.
This was discussed at length a while back - even with some providing size comparison data: http://www.keil.com/forum/docs/thread3346.asp The results definitely do seem to depend upon the nature of your code...
"under Lx51 raising the optimsation levels from 9 to the 'new' levels of 10/11 actually increases the code size" Me too! Sometimes there is little of no difference and sometimes the code size grows.
That's strange - on all my fairly sizeable projects I see code size reductions of around the percentage Keil claim. Do you have 'Favour size' selected? "under Lx51 raising the optimsation levels from 9 to the 'new' levels of 10/11 actually increases the code size" This has been my experience as well. There have been another couple of threads on this subject, the conclusion seemed to be that optimisation level 9 gives the smallest code.
View all questions in Keil forum