diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2013-12-03 21:15:17 +0100 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2014-01-22 09:39:19 +0100 |
commit | 1848db3d66e232b10d7e701063f1238809cf6a53 (patch) | |
tree | 28e31399ee5203f350b0fe67477ef9d4999b8b36 /bootloaders/caterina-LilyPadUSB/Makefile | |
parent | 99f7ef7c673e02d559eb55d064f38a105393c8f6 (diff) |
Put each HardwareSerial instance in its own .cpp file
By putting the ISRs and HardwareSerial instance for each instance in a
separate compilation unit, the compile will only consider them for
linking when the instance is actually used. The ISR is always referenced
by the compiler runtime and the Serialx_available() function is always
referenced by SerialEventRun(), but both references are weak and thus do
not cause the compilation to be included in the link by themselves.
The effect of this is that when multiple HardwareSerial ports are
available, but not all are used, buffers are only allocated and ISRs are
only included for the serial ports that are used. On the mega, this
lowers memory usage from 653 bytes to just 182 when only using the first
serial port.
On boards with just a single port, there is no change, since the code
and memory was already left out when no serial port was used at all.
This fixes #1425 and fixes #1259.
Diffstat (limited to 'bootloaders/caterina-LilyPadUSB/Makefile')
0 files changed, 0 insertions, 0 deletions