Library sizes on ATTiny85 - what size are they?

Hi,

I'm considering a couple of projects with the ATTiny85 which has 8KB of flash.

Is it correct that when you include a library, it sits in flash and reduces overall available space?

I want to consider SoftwareSerial and also TinyWire - how do I calculate how much space they will take up in flash??

Is there a list of libraries and compiled sizes anywhere?

Many thanks for your help.

headingwest:
I'm considering a couple of projects with the ATTiny85 which has 8KB of flash.

Is it correct that when you include a library, it sits in flash and reduces overall available space?

Yes. That's what the flash is for.

headingwest:
I want to consider SoftwareSerial and also TinyWire - how do I calculate how much space they will take up in flash??

Compile them and see. You don't even need a Tiny85 to do it, just compile without uploading.

headingwest:
Is it correct that when you include a library, it sits in flash and reduces overall available space?

I want to consider SoftwareSerial and also TinyWire - how do I calculate how much space they will take up in flash??

All your code goes into flash, library or not.

Is there a list of libraries and compiled sizes anywhere?

It would vary by processor, and also adding two libraries almost certainly would use less combined space than each one alone. This is because they are likely to share functions (eg. floating point maths). So you can't just add up the figures for each library and get a total.

Even adding a library, the memory used depends on whether you use all its features. Example:

void setup ()
  {
  Serial.begin (115200);
  }  // end of setup

void loop () { }

Compiles (for the Uno) to 1,744 bytes.

Now add one line (from the same library):

void setup ()
  {
  Serial.begin (115200);
  Serial.flush ();
  }  // end of setup

void loop () { }

Now it compiles to 1,760 bytes.

Add another couple of lines:

void setup ()
  {
  Serial.begin (115200);
  Serial.flush ();
  if (Serial.available ())
    Serial.print (Serial.read ());
  }  // end of setup

void loop () { }

Now 2,270 bytes.

And that is all from the HardwareSerial library.

So, there is no easy answer. Try it and see.

headingwest:
Hi,

I'm considering a couple of projects with the ATTiny85 which has 8KB of flash.

Is it correct that when you include a library, it sits in flash and reduces overall available space?

I want to consider SoftwareSerial and also TinyWire - how do I calculate how much space they will take up in flash??

Is there a list of libraries and compiled sizes anywhere?

Many thanks for your help.

It depends on what you use from the library. Just because a class or method is defined in the library, does not mean it gets compiled into your sketch.
Typically, only the methods you actually call will get compiled (linked) in. Everything else gets left out.

Only reliable way to tell is to write the code, compile it and see.