Why is my program so big?
NumPy
Posts: 27
13652 bytes sent?
There is only 32k available.
code:
/** * This is the main Measure freq program file.
*/
#include <propeller.h>
#include "simpletools.h"
int main(void)
{
int myfreq;
int pin1;
pin1=input(1);
myfreq=pulse_in(1,1);
printf("Frequency = %d",myfreq);
return 0;
}
There is only 32k available.
code:
/** * This is the main Measure freq program file.
*/
#include <propeller.h>
#include "simpletools.h"
int main(void)
{
int myfreq;
int pin1;
pin1=input(1);
myfreq=pulse_in(1,1);
printf("Frequency = %d",myfreq);
return 0;
}
Comments
is the culprit I'll bet. Include "simpletext.h" and replace printf with:
putStr("Frequency = ");
putDec(myfreq);
putStr("\n");
You pay a big penalty in code size for the formatting power of printf();
photomankc's idea is best for smallest code.
simpletools.h includes simpletext.h of course (and lots of other stuff too).