user22875: I'm running a program on a ATtiny85 and running into problems because of a lack of available RAM. When I ran avr-nm on my ELF file I found that SoftwareSerial was taking up a lot of RAM even though I'm just using it to set the data transfer rate with mySerial.begin(9600); and nowhere else.
So I'm wondering if there is another way of doing this without using so much memory:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0,1);

mySerial.begin(9600);


user7508: Simplest thing would probably be to edit your copy of SoftwareSerial.h
and replace #define _SS_MAX_RX_BUFF 64 on line
42
by something smaller. If your loop() runs fast enough (no delays, no
blocking code) you could probably get away with buffering only a very
few bytes.
Or you could rewrite the library so that, instead of buffering the
incoming bytes, it handles them to you for processing. See for example
this receive-only UART code based on the USI
port for an illustration of the
approach.

22875: <p>I'm running a program on a ATtiny85 and running into problems because of a lack of available RAM. When I ran <code>avr-nm</code> on my ELF file I found that SoftwareSerial was taking up a lot of RAM even though I'm just using it to set the data transfer rate with <code>mySerial.begin(9600);</code> and nowhere else.</p>

<p>So I'm wondering if there is another way of doing this without using so much memory:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;

SoftwareSerial mySerial(0,1);

mySerial.begin(9600);
</code></pre>
 7508: <p>Simplest thing would probably be to edit your copy of SoftwareSerial.h
and replace <a href="https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.h#L42" rel="noreferrer"><code>#define _SS_MAX_RX_BUFF 64</code> on line
42</a>
by something smaller. If your <code>loop()</code> runs fast enough (no delays, no
blocking code) you could probably get away with buffering only a very
few bytes.</p>

<p>Or you could rewrite the library so that, instead of buffering the
incoming bytes, it handles them to you for processing. See for example
this <a href="http://www.technoblogy.com/show?VSX" rel="noreferrer">receive-only UART code based on the USI
port</a> for an illustration of the
approach.</p>
