William Chops Westfield wrote: > With remarks its 3.5k If I drop all the remarks its 1.1k. The > resulting hex file after I compile and assemble is 3.5K. Which > might prove interesting fitting into 1K of space unless I have > things wrong and it will fit?. > > That is the reason I am curious as to what compiler will put out > the smallest code. > > One of the problems with a compiler is that it is trivially easy to > "accidentally" end up including some library that causes the code > size to get quickly out of control. (the usual example being > something like: 'printf("Hello World");' in C yanking in an entire > printf library, complete with floating point, etc... Use instead > 'puts("Hello world");' and things might be much better.) > > So you can look through your code and see if you've done something > similar, and whether there is an easy substitute to a big function. > Hopefully your compiler has some reasonable diagnostic output (symbol > tables and segment size information) that you can learn to read to > help point out the guilty parties... > > The same principle works the other way for environments with a > significant run-time environment. Consider a basic stamp (or Java); > you've already "paid the price" to have all sorts of functionality > "available", so actual "programs" can be quite tiny indeed... > > BillW Hya Bill, how ya doing partner? At a recent Atmel meeting in Orlando, the famous CxASM discussion was made star, and after little time (thanks God), both parties agreed that probably after 6 to 8kBytes of code, compilers start to make sense over asm, since after that, compilers can make better use of the variables, routines and optimizations start to shine bright. In some tied oppressive conclusion for the compiler party, it went clear that you can write a very small and fast code in assembly, LCD, keyboard, Uart, sensors reading, table conversion and linearization, hex to dec conversion, math processing routines and all, in less than 800 instructions, of course, unbeatable by compilers. Everybody ended the subject with orange juice and coffee (very black), to refuel the nerves shacking - I was laughing in a corner (of course). I still saying; ScrewDrivers and Hammers represent different ages, but both still being part of our life. However, never use a Hammer to push a screw, or a ScrewDriver to pull a nail. When in doubt - go for assembly... another rush! :) /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Wagner Lipnharski - UST Research Inc Orlando FLorida - USA - www.ustr.net /_/_/_/ Atmel AVR Consultant /_/_/_/ -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics