Carl Norman

Comilier optimisation, expected reduction

Discussion created by Carl Norman on Aug 6, 2009
Latest reply on Aug 7, 2009 by Carl Norman



We have just completed redesigning an old product we had written in assembly. The assembly code (we wrote it about 5 years ago for HS08), the processor runs a GSM / GPRS / GPS device with various other specific functions. In assembly, the code is about 5Kb. Now we have re written the code in C and the project has hit the upper limit of 16Kb with about 90% of the code complete. (Part is S08AC16)


Using the smart sliders I set to optimise for code size, and out of 16Kb, it made less than 40 bytes difference over the default settings. So 40 bytes out of 16,000 bytes when optimised for size. Is this 'normal'?


I can obviously see some minor gains in writing my code more efficiently, which I will work on.


Is there something more I can do? Is there some documentation on writing code that Codewarrior can optimise better i.e. Do's an Dont's? Are there other compilers out there I can use that will optimise the code a better? Should I just be writing some of these functions in ASM?


I am quite suprised at how much larger the C code is over assembly, it will be nearly 5 times larger. The Assembly code is writted to be 'easy to read' to, not to be small.